multiple site -> supporters

This commit is contained in:
Kyle Drake 2014-12-03 02:50:22 -08:00
parent 2f432281a3
commit e1a4c4b5c9
4 changed files with 24 additions and 15 deletions

6
app.rb
View file

@ -119,6 +119,12 @@ end
post '/settings/create_child' do
require_login
if !current_site.plan_feature(:unlimited_site_creation)
flash[:error] = 'Cannot create a new site with your current plan, please become a supporter.'
redirect '/settings#sites'
end
site = Site.new
site.parent_site_id = parent_site.id

View file

@ -920,9 +920,9 @@ class Site < Sequel::Model
end
def plan_type
return 'free' if values[:plan_type].nil?
return 'supporter' if values[:plan_type].match /^plan_/
values[:plan_type]
return 'free' if owner.values[:plan_type].nil?
return 'supporter' if owner.values[:plan_type].match /^plan_/
owner.values[:plan_type]
end
def latest_events(current_page=1, limit=10)

View file

@ -251,5 +251,4 @@ end
def res
JSON.parse last_response.body, symbolize_names: true
end
end

View file

@ -18,15 +18,19 @@
<h3>Create New Site</h3>
<p>You can now create new sites that are linked to this account! All of your sites will share the free space you have available.</p>
<% if current_site.plan_feature(:unlimited_site_creation) %>
<p>You can now create new sites that are linked to this account! All of your sites will share the free space you have available.</p>
<form action="/settings/create_child" method="POST">
<%== csrf_token_input_html %>
<p>Site Name:</p>
<input name="username" type="text">
<form action="/settings/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>
<div>
<input class="btn-Action" type="submit" value="Create New Site">
</div>
</form>
<% else %>
<p>Multiple site creation is only available for supporter accounts. <a href="/plan">Upgrade now</a>!</p>
<% end %>