A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

204 lines
5.4 KiB

  1. {{define "head"}}
  2. <title>{{.SiteName}}</title>
  3. <style type="text/css">
  4. h2 {
  5. font-weight: normal;
  6. }
  7. #pricing.content-container div.form-container #payment-form {
  8. display: block !important;
  9. }
  10. #pricing #signup-form table {
  11. max-width: inherit !important;
  12. width: 100%;
  13. }
  14. #pricing #payment-form table {
  15. margin-top: 0 !important;
  16. max-width: inherit !important;
  17. width: 100%;
  18. }
  19. tr.subscription {
  20. border-spacing: 0;
  21. }
  22. #pricing.content-container tr.subscription button {
  23. margin-top: 0 !important;
  24. margin-bottom: 0 !important;
  25. width: 100%;
  26. }
  27. #pricing tr.subscription td {
  28. padding: 0 0.5em;
  29. }
  30. #pricing table.billing > tbody > tr > td:first-child {
  31. vertical-align: middle !important;
  32. }
  33. .billing-section {
  34. display: none;
  35. }
  36. .billing-section.bill-me {
  37. display: table-row;
  38. }
  39. #btn-create {
  40. color: white !important;
  41. }
  42. #total-price {
  43. padding-left: 0.5em;
  44. }
  45. #alias-site.demo {
  46. color: #999;
  47. }
  48. #alias-site {
  49. text-align: left;
  50. margin: 0.5em 0;
  51. }
  52. form dd {
  53. margin: 0;
  54. }
  55. .banner-container {
  56. text-align: left;
  57. }
  58. .banner-container h1 {
  59. margin-top: 0;
  60. max-width: 8em;
  61. }
  62. .or {
  63. margin-bottom: 2.5em !important;
  64. }
  65. </style>
  66. {{end}}
  67. {{define "content"}}
  68. <div id="pricing" class="content-container wide-form">
  69. <div class="row">
  70. <div class="banner-container">
  71. {{.Banner}}
  72. <p><a href="{{if .Content}}#more{{else}}/about{{end}}">Learn more...</a></p>
  73. </div>
  74. <div{{if not .OpenRegistration}} style="padding: 2em 0;"{{end}}>
  75. {{ if .OpenRegistration }}
  76. {{template "oauth-buttons" .}}
  77. {{if not .DisablePasswordAuth}}
  78. {{if .Flashes}}<ul class="errors">
  79. {{range .Flashes}}<li class="urgent">{{.}}</li>{{end}}
  80. </ul>{{end}}
  81. <div id="billing">
  82. <form action="/auth/signup" method="POST" id="signup-form" onsubmit="return signup()">
  83. <dl class="billing">
  84. <label>
  85. <dt>Username</dt>
  86. <dd>
  87. <input type="text" id="alias" name="alias" style="width: 100%; box-sizing: border-box;" tabindex="1" autofocus {{if .ForcedLanding}}disabled{{end}} />
  88. {{if .Federation}}<p id="alias-site" class="demo">@<strong>your-username</strong>@{{.FriendlyHost}}</p>{{else}}<p id="alias-site" class="demo">{{.FriendlyHost}}/<strong>your-username</strong></p>{{end}}
  89. </dd>
  90. </label>
  91. <label>
  92. <dt>Password</dt>
  93. <dd><input type="password" id="password" name="pass" autocomplete="new-password" placeholder="" tabindex="2" style="width: 100%; box-sizing: border-box;" {{if .ForcedLanding}}disabled{{end}} /></dd>
  94. </label>
  95. <label>
  96. <dt>Email (optional)</dt>
  97. <dd><input type="email" name="email" id="email" style="letter-spacing: 1px; width: 100%; box-sizing: border-box;" placeholder="me@example.com" tabindex="3" {{if .ForcedLanding}}disabled{{end}} /></dd>
  98. </label>
  99. <dt>
  100. <button id="btn-create" type="submit" style="margin-top: 0" {{if .ForcedLanding}}disabled{{end}}>Create blog</button>
  101. </dt>
  102. </dl>
  103. </form>
  104. </div>
  105. {{end}}
  106. {{ else }}
  107. <p style="font-size: 1.3em; margin: 1rem 0;">Registration is currently closed.</p>
  108. <p>You can always sign up on <a href="https://writefreely.org/instances">another instance</a>.</p>
  109. {{ end }}
  110. </div>
  111. </div>
  112. {{if .Content}}
  113. <a name="more"></a><hr style="margin: 1em auto 3em;" />
  114. {{end}}
  115. </div>
  116. {{ if .Content }}
  117. <div class="content-container snug">
  118. {{.Content}}
  119. </div>
  120. {{ end }}
  121. <script type="text/javascript" src="/js/h.js"></script>
  122. <script type="text/javascript">
  123. function signup() {
  124. var $pass = document.getElementById('password');
  125. // Validate input
  126. if (!aliasOK) {
  127. var $a = $alias;
  128. $a.el.className = 'error';
  129. $a.el.focus();
  130. $a.el.scrollIntoView();
  131. return false;
  132. }
  133. if ($pass.value == "") {
  134. var $a = $pass;
  135. $a.className = 'error';
  136. $a.focus();
  137. $a.scrollIntoView();
  138. return false;
  139. }
  140. var $btn = document.getElementById('btn-create');
  141. $btn.disabled = true;
  142. $btn.value = 'Creating...';
  143. return true;
  144. }
  145. var $alias = H.getEl('alias');
  146. var $aliasSite = document.getElementById('alias-site');
  147. var aliasOK = true;
  148. var typingTimer;
  149. var doneTypingInterval = 750;
  150. var doneTyping = function() {
  151. // Check on username
  152. var alias = $alias.el.value;
  153. if (alias != "") {
  154. var params = {
  155. username: alias
  156. };
  157. var http = new XMLHttpRequest();
  158. http.open("POST", '/api/alias', true);
  159. // Send the proper header information along with the request
  160. http.setRequestHeader("Content-type", "application/json");
  161. http.onreadystatechange = function() {
  162. if (http.readyState == 4) {
  163. data = JSON.parse(http.responseText);
  164. if (http.status == 200) {
  165. aliasOK = true;
  166. $alias.removeClass('error');
  167. $aliasSite.className = $aliasSite.className.replace(/(?:^|\s)demo(?!\S)/g, '');
  168. $aliasSite.className = $aliasSite.className.replace(/(?:^|\s)error(?!\S)/g, '');
  169. $aliasSite.innerHTML = '{{ if .Federation }}@<strong>' + data.data + '</strong>@{{.FriendlyHost}}{{ else }}{{.FriendlyHost}}/<strong>' + data.data + '</strong>/{{ end }}';
  170. } else {
  171. aliasOK = false;
  172. $alias.setClass('error');
  173. $aliasSite.className = 'error';
  174. $aliasSite.textContent = data.error_msg;
  175. }
  176. }
  177. }
  178. http.send(JSON.stringify(params));
  179. } else {
  180. $aliasSite.className += ' demo';
  181. $aliasSite.innerHTML = '{{ if .Federation }}@<strong>your-username</strong>@{{.FriendlyHost}}{{ else }}{{.FriendlyHost}}/<strong>your-username</strong>/{{ end }}';
  182. }
  183. };
  184. $alias.on('keyup input', function() {
  185. clearTimeout(typingTimer);
  186. typingTimer = setTimeout(doneTyping, doneTypingInterval);
  187. });
  188. </script>
  189. {{end}}