@**
 * Copyright (C) 2012, 2017 Kaj Magnus Lindberg
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *@

@(emailId: String, doWhat: String, nextPage: String)

@{/* To do: move to unsubscribe/ */}

@unsubForm = {
  <form accept-charset='UTF-8' method='post'>
  <p>Unsubscribe from email notifications, e.g. of replies to your comments?</p>
  <div>
  <input type='submit' value='Yes, unsubscribe'>
  </div>
  </form>
}


@unsubDoneInfo = {
  <p id="e2eYouHaveBeenUnsubscribed">You have been unsubscribed.
  </p>
  <br>
  <br>
  <p>If you want to prevent resubscriptions during the next months, you can do that,
    <a href='@nextPage'>here.</a> That is, you'd prevent yourself and other people from subscribing
    to email notifications again, using your email address.
  </p>
}


@preventResubForm = {
  <form accept-charset='UTF-8' method='post'>
  <p>Prevent resubscriptions?</p>
  <p>Do you want to prevent yourself and everyone else from
    subscribing to email notifications, using your email address, during the next months?
  </p>
  <div>
  <input type='submit' value='Prevent resubscriptions'>
  </div>
  </form>
}


@resubsPreventedInfo = {
  <p>Resubscriptions are now prevented.</p>
  <p><small>You can actually still resubscribe to email notifications, but then
    you need to authenticate yourself. You do that by signing up or logging in
    <a href='/'>at the forum</a>, with emai and password, or Gmail or Facebook, for example.</small>
  </p>
  <p>Kind regards</p>
}


<!DOCTYPE html>
<head>
<style>
p { max-width: 30em; }
input { min-width: 11em; }
</style>
</head>
<body>
  @doWhat match {
    case "" => { @unsubForm }
    case "unsub-done" => { @unsubDoneInfo }
    case "prevent-resub" => { @preventResubForm }
    case "resub-prevented" => { @resubsPreventedInfo }
    case _ => {
      talkyard.server.TyLogger("unsubscribePage").error("Bad doWhat: "+ doWhat + " [TyEBADDOWHAT]")
      <p>Internal server error [TyEBADDOWHAT]</p>
    }
  }
</body>
