Skip to content

Commit

Permalink
Added ConcertoConfig editing to dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
augustf committed May 3, 2012
1 parent 3101044 commit 95be664
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
10 changes: 9 additions & 1 deletion app/controllers/dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@ class DashboardController < ApplicationController

# GET /dashboard
def index

@concerto_configs = ConcertoConfig.all
end

#get a hash of concerto_config keysand values and update them using the ConcertoConfig setter
def update
params[:concerto_config].each do |k,v|
ConcertoConfig.set(k,v)
end
render :action => :index
end

end
20 changes: 19 additions & 1 deletion app/views/dashboard/index.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
This is the Dashboard.
<%= form_tag "/dashboard/update" do %>
<%= t(:public_concerto) %>:
<%= check_box_tag "concerto_config[public_concerto]", true, :checked => !!ConcertoConfig[:public_concerto] %><br />

<%= t(:default_upload_type) %>:
<%= text_field_tag "concerto_config[default_upload_type]", ConcertoConfig[:default_upload_type] %><br />

<%= t(:content_default_start_time) %>:
<%= text_field_tag "concerto_config[content_default_start_time]", ConcertoConfig[:content_default_start_time] %><br />

<%= t(:content_default_end_time) %>:
<%= text_field_tag "concerto_config[content_default_end_time]", ConcertoConfig[:content_default_end_time] %><br />

<%= t(:content_default_duration) %>:
<%= text_field_tag "concerto_config[content_default_duration]", ConcertoConfig[:content_default_duration] %><br />

<%= submit_tag "Save" %>
<% end %>
7 changes: 7 additions & 0 deletions config/locales/views/dashboard/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
en:
#index
public_concerto: "Public Concerto access"
default_upload_type: "Default content upload type"
content_default_start_time: "Default start time for content"
content_default_end_time: "Default end time for content"
content_default_duration: "Default duration for content (in days)"
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

#Set a non-restul route to the dashboard
match 'dashboard/' => 'dashboard#index'

match 'dashboard/update' => 'dashboard#update', :via => "post"
# The priority is based upon order of creation:
# first created -> highest priority.

Expand Down

0 comments on commit 95be664

Please sign in to comment.