Skip to content

Commit

Permalink
Added allow_user_screen_creation field and fixed dashboard form logic C…
Browse files Browse the repository at this point in the history
…loses #93
  • Loading branch information
augustf committed May 29, 2012
1 parent d112d79 commit 39a6dd1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion app/views/dashboard/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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" %>
Expand Down
3 changes: 2 additions & 1 deletion config/locales/views/dashboard/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
1 change: 1 addition & 0 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 39a6dd1

Please sign in to comment.