start on accounts using site context, improved settings page, clean up space representation

This commit is contained in:
Kyle Drake 2014-10-07 02:22:08 +02:00
parent 8a36f1c6f5
commit d3c1546d45
17 changed files with 243 additions and 105 deletions

View file

@ -1,11 +1,11 @@
<h2>Neocities Plan</h2>
<% if current_site.supporter? && !current_site.plan_ended %>
<p class="tiny">You currently have the <strong>Supporter Plan (<%= current_site.maximum_space_in_megabytes %>MB)</strong>. Thank you! We love you.
<p class="tiny">You currently have the <strong>Supporter Plan (<%= current_site.maximum_space.to_space_pretty %>)</strong>. Thank you! We love you.
</p>
<a class="btn-Action" href="/plan">Manage Plan</a>
<% else %>
<p class="tiny">
You currently have the <strong>Free Plan (<%= current_site.maximum_space_in_megabytes %>MB)</strong>.<br>Want to get more space and help Neocities? Become a supporter!
You currently have the <strong>Free Plan (<%= current_site.maximum_space.to_space_pretty %>)</strong>.<br>Want to get more space and help Neocities? Become a supporter!
</p>
<a class="btn-Action" href="/plan">Supporter Info</a>
<% end %>

42
views/settings/sites.erb Normal file
View file

@ -0,0 +1,42 @@
<h2>Your Sites</h2>
<% if current_site.children_dataset.count == 0 %>
<h6>No other sites are currently linked to this account.</h6>
<% else %>
<table class="table">
<tr>
<td>
<a href="//<%= current_site.host %>"><strong><%= current_site.title %></strong></a> (primary)
</td>
<td>
Manage this site
</td>
</tr>
<% current_site.children.each do |site| %>
<tr>
<td>
<a href="//<%= site.host %>" target="_blank"><%= site.title %></a>
</td>
<td>
<a href="#">Manage this site</a>
</td>
</tr>
<% end %>
</table>
<% end %>
<h3>Create New Site</h3>
<p>You can now create new sites that are linked to this account! Sites will share the free space you have available. You have <strong><%= Site::CHILD_SITES_MAX - current_site.children_dataset.count %></strong> new sites remaining.</p>
<form action="/site/create_child" method="POST">
<%== csrf_token_input_html %>
<p>Site Name:</p>
<input name="username" type="text">
<div>
<input class="btn-Action" type="submit" value="Create New Site">
</div>
</form>