Skip to content
Browse files

Added allow_user_screen_creation field and fixed dashboard form logic…

… Closes #93
  • Loading branch information...
1 parent d112d79 commit 39a6dd14133cd18d24cba8de847e71341ab419cb @augustf augustf committed May 28, 2012
Showing with 11 additions and 3 deletions.
  1. +3 −1 app/models/ability.rb
  2. +5 −1 app/views/dashboard/index.html.erb
  3. +2 −1 config/locales/views/dashboard/en.yml
  4. +1 −0 db/seeds.rb
View
4 app/models/ability.rb
@@ -92,7 +92,9 @@ def user_abilities(user)
## Screens
# Authenticated users can create screens
- can :create, Screen if user.persisted?
+ if ConcertoConfig[:allow_user_screen_creation] == "true"
+ can :create, Screen if user.persisted?
+ end
# Anyone can read public screens
can :read, Screen, :is_public => true
# Users can read, update and delete their own screens
View
6 app/views/dashboard/index.html.erb
@@ -6,7 +6,11 @@
<%= text_field_tag "concerto_config[#{c.key}]", ConcertoConfig[c.key.to_sym] %><br />
<% elsif c.value_type == "boolean" %>
<%= t(c.key.to_sym) %>:
- <%= check_box_tag "concerto_config[#{c.key}]", true, :checked => !!ConcertoConfig[c.key.to_sym] %><br />
+ <% if ConcertoConfig[c.key.to_sym] == "true" %>
+ <%= check_box_tag "concerto_config[#{c.key}]", true, :checked => true %><br />
+ <% else %>
+ <%= check_box_tag "concerto_config[#{c.key}]", true%><br />
+ <% end %>
<% end %>
<% end %>
<%= submit_tag "Save" %>
View
3 config/locales/views/dashboard/en.yml
@@ -8,4 +8,5 @@ en:
start_date_offset: "Time between submission and content start"
default_content_run_time: "Default content run time (in days)"
setup_complete: "Concerto setup complete"
- allow_registration: "Allow open user registration"
+ allow_registration: "Allow open user registration"
+ allow_user_screen_creation: "Allow user screen creation"
View
1 db/seeds.rb
@@ -35,6 +35,7 @@
ConcertoConfig.find_or_create_by_key(:key => "default_content_run_time", :value => "7", :value_default => "7", :value_type => "integer")
ConcertoConfig.find_or_create_by_key(:key => "setup_complete", :value => "false", :value_default => "true", :value_type => "boolean")
ConcertoConfig.find_or_create_by_key(:key => "allow_registration", :value => "true", :value_default => "true", :value_type => "boolean")
+ConcertoConfig.find_or_create_by_key(:key => "allow_user_screen_creation", :value => "false", :value_default => "false", :value_type => "boolean")
#Create an initial feed
Feed.find_or_create_by_name(:name => "Concerto", :description => "Initial Concerto Feed", :group_id => 1, :is_viewable => 1, :is_submittable => 1)

0 comments on commit 39a6dd1

Please sign in to comment.
Something went wrong with that request. Please try again.