diff --git a/app/controllers/admin/callforpapers_controller.rb b/app/controllers/admin/callforpapers_controller.rb index 910b273e..3d8f8768 100644 --- a/app/controllers/admin/callforpapers_controller.rb +++ b/app/controllers/admin/callforpapers_controller.rb @@ -1,7 +1,7 @@ class Admin::CallforpapersController < ApplicationController before_filter :verify_organizer - def show + def index @cfp = @conference.call_for_papers if @cfp.nil? @cfp = CallForPapers.new @@ -11,17 +11,22 @@ class Admin::CallforpapersController < ApplicationController def update @cfp = @conference.call_for_papers @cfp.update_attributes(params[:call_for_papers]) - redirect_to(admin_conference_cfp_info_path(:id => @conference.short_title), :notice => 'Call for Papers was successfully updated.') - + redirect_to(admin_conference_callforpapers_path( + id: @conference.short_title), + notice: 'Call for Papers was successfully updated.') end def create - @cfp = CallForPapers.new(params[:call_for_papers]) + @cfp = CallForPapers.new(params[:call_for_papers]) @conference.call_for_papers = @cfp if @cfp.save - redirect_to(admin_conference_cfp_info_path(:id => @conference.short_title), :notice => 'Call for Papers was successfully updated.') + redirect_to(admin_conference_callforpapers_path( + id: @conference.short_title), + notice: 'Call for Papers was successfully updated.') else - redirect_to(admin_conference_cfp_info_path(:id => @conference.short_title), :error => 'Call for Papers failed.') + redirect_to(admin_conference_callforpapers_path( + id: @conference.short_title), + error: 'Call for Papers failed.') end end end diff --git a/app/controllers/admin/emails_controller.rb b/app/controllers/admin/emails_controller.rb index fcdc0d6a..dbdfc44d 100644 --- a/app/controllers/admin/emails_controller.rb +++ b/app/controllers/admin/emails_controller.rb @@ -3,11 +3,12 @@ class Admin::EmailsController < ApplicationController def update @conference.email_settings.update_attributes(params[:email_settings]) - redirect_to(admin_conference_email_settings_path(@conference.short_title), :notice => 'Settings have been successfully updated.') + redirect_to(admin_conference_emails_path( + @conference.short_title), + notice: 'Settings have been successfully updated.') end - def show + def index @settings = @conference.email_settings end - end diff --git a/app/controllers/admin/eventtype_controller.rb b/app/controllers/admin/eventtype_controller.rb index 04d8f2e0..125af325 100644 --- a/app/controllers/admin/eventtype_controller.rb +++ b/app/controllers/admin/eventtype_controller.rb @@ -2,15 +2,17 @@ class Admin::EventtypeController < ApplicationController before_filter :verify_organizer def show - render :event_type_list + render :eventtype_list end def update - begin - @conference.update_attributes!(params[:conference]) - redirect_to(admin_conference_eventtype_list_path(:conference_id => @conference.short_title), :notice => 'Event types were successfully updated.') - rescue Exception => e - redirect_to(admin_conference_eventtype_list_path(:conference_id => @conference.short_title), :alert => 'Event types update failed: #{e.message}') - end + @conference.update_attributes!(params[:conference]) + redirect_to(admin_conference_eventtype_path( + conference_id: @conference.short_title), + notice: 'Event types were successfully updated.') + rescue Exception => e + redirect_to(admin_conference_eventtype_path( + conference_id: @conference.short_title), + alert: 'Event types update failed: #{e.message}') end -end \ No newline at end of file +end diff --git a/app/controllers/admin/rooms_controller.rb b/app/controllers/admin/rooms_controller.rb index fb72df5f..00342258 100644 --- a/app/controllers/admin/rooms_controller.rb +++ b/app/controllers/admin/rooms_controller.rb @@ -7,11 +7,13 @@ class Admin::RoomsController < ApplicationController def update if @conference.update_attributes(params[:conference]) - redirect_to(admin_conference_rooms_list_path(:conference_id => @conference.short_title), :notice => 'Rooms were successfully updated.') + redirect_to(admin_conference_rooms_path( + conference_id: @conference.short_title), + notice: 'Rooms were successfully updated.') else - redirect_to(admin_conference_rooms_list_path(:conference_id => @conference.short_title), :notice => 'Room update failed.') + redirect_to(admin_conference_rooms_path( + conference_id: @conference.short_title), + notice: 'Room update failed.') end - end - end diff --git a/app/controllers/admin/tracks_controller.rb b/app/controllers/admin/tracks_controller.rb index c7126bdd..102cdd68 100644 --- a/app/controllers/admin/tracks_controller.rb +++ b/app/controllers/admin/tracks_controller.rb @@ -3,18 +3,20 @@ class Admin::TracksController < ApplicationController def show respond_to do |format| - format.html { render :tracks_list} - format.json { render :json => @conference.tracks.to_json } + format.html { render :tracks_list } + format.json { render json: @conference.tracks.to_json } end end def update if @conference.update_attributes(params[:conference]) - redirect_to(admin_conference_tracks_list_path(:conference_id => @conference.short_title), :notice => 'Tracks were successfully updated.') + redirect_to(admin_conference_tracks_path( + conference_id: @conference.short_title), + notice: 'Tracks were successfully updated.') else - redirect_to(admin_conference_tracks_list_path(:conference_id => @conference.short_title), :notice => 'Tracks update failed.') + redirect_to(admin_conference_tracks_path( + conference_id: @conference.short_title), + notice: 'Tracks update failed.') end - end - end diff --git a/app/views/admin/callforpapers/show.html.haml b/app/views/admin/callforpapers/index.html.haml similarity index 87% rename from app/views/admin/callforpapers/show.html.haml rename to app/views/admin/callforpapers/index.html.haml index 7f879e54..79ce99dc 100644 --- a/app/views/admin/callforpapers/show.html.haml +++ b/app/views/admin/callforpapers/index.html.haml @@ -2,7 +2,7 @@ .col-md-3 = render 'admin/conference/sidebar' .col-md-9 - = semantic_form_for(@cfp, :url => admin_conference_cfp_update_path(@conference.short_title),:html => {:multipart => true}) do |f| + = semantic_form_for(@cfp, :url => admin_conference_callforpaper_path(@conference.short_title, @conference.call_for_papers),:html => {:multipart => true}) do |f| = f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" } = f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" } = f.input :hard_deadline, :as => :string, :input_html => { :id => "cfp-hard-datepicker", :readonly => "readonly" } diff --git a/app/views/admin/conference/_sidebar.html.haml b/app/views/admin/conference/_sidebar.html.haml index 55797542..c4e8b1e0 100644 --- a/app/views/admin/conference/_sidebar.html.haml +++ b/app/views/admin/conference/_sidebar.html.haml @@ -4,22 +4,22 @@ = link_to "Conference", admin_conference_path(@conference.short_title) %li{:class=> active_nav_li(admin_conference_venue_info_path(@conference.short_title))} = link_to "Venue", admin_conference_venue_info_path(@conference.short_title) - %li{:class=> active_nav_li(admin_conference_cfp_info_path(@conference.short_title))} - = link_to "Call for Papers", admin_conference_cfp_info_path(@conference.short_title) - %li{:class=> active_nav_li(admin_conference_rooms_list_path(@conference.short_title))} - = link_to "Rooms", admin_conference_rooms_list_path(@conference.short_title) - %li{:class=> active_nav_li(admin_conference_tracks_list_path(@conference.short_title))} - = link_to "Tracks", admin_conference_tracks_list_path(@conference.short_title) - %li{:class=> active_nav_li(admin_conference_eventtype_list_path(@conference.short_title))} - = link_to "Event Types", admin_conference_eventtype_list_path(@conference.short_title) + %li{:class=> active_nav_li(admin_conference_callforpapers_path(@conference.short_title))} + = link_to "Call for Papers", admin_conference_callforpapers_path(@conference.short_title) + %li{:class=> active_nav_li(admin_conference_rooms_path(@conference.short_title))} + = link_to "Rooms", admin_conference_rooms_path(@conference.short_title) + %li{:class=> active_nav_li(admin_conference_tracks_path(@conference.short_title))} + = link_to "Tracks", admin_conference_tracks_path(@conference.short_title) + %li{:class=> active_nav_li(admin_conference_eventtype_index_path(@conference.short_title))} + = link_to "Event Types", admin_conference_eventtype_index_path(@conference.short_title) %li{:class=> active_nav_li(admin_conference_difficulty_levels_path(@conference.short_title))} = link_to "Difficulty Levels", admin_conference_difficulty_levels_path(@conference.short_title) %li{:class=> active_nav_li(admin_conference_social_events_path(@conference.short_title))} = link_to "Social Events", admin_conference_social_events_path(@conference.short_title) %li{:class=> active_nav_li(admin_conference_supporter_levels_path(@conference.short_title))} = link_to "Supporter Levels", admin_conference_supporter_levels_path(@conference.short_title) - %li{:class=> active_nav_li(admin_conference_email_settings_path(@conference.short_title))} - = link_to "Emails", admin_conference_email_settings_path(@conference.short_title) + %li{:class=> active_nav_li(admin_conference_emails_path(@conference.short_title))} + = link_to "Emails", admin_conference_emails_path(@conference.short_title) %li{:class=> active_nav_li(admin_conference_questions_path(@conference.short_title))} = link_to "Questions", admin_conference_questions_path(@conference.short_title) %li{:class=> active_nav_li(admin_conference_volunteers_info_path(@conference.short_title))} diff --git a/app/views/admin/difficulty_levels/index.html.haml b/app/views/admin/difficulty_levels/index.html.haml index 2da43293..124c47bd 100644 --- a/app/views/admin/difficulty_levels/index.html.haml +++ b/app/views/admin/difficulty_levels/index.html.haml @@ -2,7 +2,7 @@ .col-md-3 = render 'admin/conference/sidebar' .col-md-9 - = semantic_form_for(@conference, :url => admin_conference_difficulty_levels_path(@conference.short_title)) do |f| + = semantic_form_for @conference, :url => admin_conference_difficulty_level_path(@conference.short_title, @conference.difficulty_levels) do |f| = f.input :use_difficulty_levels, :label => false = dynamic_association :difficulty_levels, "Difficulty_Levels", f = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} diff --git a/app/views/admin/emails/show.html.haml b/app/views/admin/emails/index.html.haml similarity index 95% rename from app/views/admin/emails/show.html.haml rename to app/views/admin/emails/index.html.haml index 1f65f7b9..77c170d4 100644 --- a/app/views/admin/emails/show.html.haml +++ b/app/views/admin/emails/index.html.haml @@ -24,7 +24,7 @@ %tr %td {eventtitle} %td The title of an accepted or rejected proposal - = semantic_form_for(@settings, :url => admin_conference_email_settings_path(@conference.short_title),:html => {:multipart => true}) do |f| + = semantic_form_for(@settings, :url => admin_conference_email_path(@conference.short_title, @conference.email_settings),:html => {:multipart => true}) do |f| = f.input :send_on_registration, :label => false, :hint => "Send an email when the user registers for the conference?" = f.input :registration_subject = f.input :registration_email_template, :input_html => { :rows => 10, :cols => 20} diff --git a/app/views/admin/eventtype/event_type_list.html.haml b/app/views/admin/eventtype/event_type_list.html.haml index 637b7c99..dfac0b33 100644 --- a/app/views/admin/eventtype/event_type_list.html.haml +++ b/app/views/admin/eventtype/event_type_list.html.haml @@ -2,6 +2,6 @@ .col-md-3 = render 'admin/conference/sidebar' .col-md-9 - = semantic_form_for(@conference, :url => admin_conference_eventtype_update_path(@conference.short_title)) do |f| + = semantic_form_for(@conference, :url => admin_conference_eventtype_path(@conference.short_title, @conference.event_types)) do |f| = dynamic_association :event_types, "Event Types", f = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} diff --git a/app/views/admin/rooms/rooms_list.html.haml b/app/views/admin/rooms/index.html.haml similarity index 81% rename from app/views/admin/rooms/rooms_list.html.haml rename to app/views/admin/rooms/index.html.haml index 0410f33c..e2021354 100644 --- a/app/views/admin/rooms/rooms_list.html.haml +++ b/app/views/admin/rooms/index.html.haml @@ -2,6 +2,6 @@ .col-md-3 = render 'admin/conference/sidebar' .col-md-9 - = semantic_form_for(@conference, :url => admin_conference_rooms_update_path(@conference.short_title)) do |f| + = semantic_form_for(@conference, :url => admin_conference_room_path(@conference.short_title, @conference.rooms)) do |f| = dynamic_association :rooms, "Rooms", f = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} diff --git a/app/views/admin/social_events/social_events_list.html.haml b/app/views/admin/social_events/index.html.haml similarity index 78% rename from app/views/admin/social_events/social_events_list.html.haml rename to app/views/admin/social_events/index.html.haml index 579abd55..c6cf1f1a 100644 --- a/app/views/admin/social_events/social_events_list.html.haml +++ b/app/views/admin/social_events/index.html.haml @@ -2,6 +2,6 @@ .col-md-3 = render 'admin/conference/sidebar' .col-md-9 - = semantic_form_for(@conference, :url => admin_conference_social_events_path(@conference.short_title)) do |f| + = semantic_form_for(@conference, :url => admin_conference_social_event_path(@conference.short_title, @conference.social_events)) do |f| = dynamic_association :social_events, "Social Events", f = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} diff --git a/app/views/admin/supporter_levels/supporter_levels.html.haml b/app/views/admin/supporter_levels/index.html.haml similarity index 80% rename from app/views/admin/supporter_levels/supporter_levels.html.haml rename to app/views/admin/supporter_levels/index.html.haml index e45f0e4b..fa809dbc 100644 --- a/app/views/admin/supporter_levels/supporter_levels.html.haml +++ b/app/views/admin/supporter_levels/index.html.haml @@ -2,7 +2,7 @@ .col-md-3 = render 'admin/conference/sidebar' .col-md-9 - = semantic_form_for(@conference, :url => admin_conference_supporter_levels_path(@conference.short_title)) do |f| + = semantic_form_for(@conference, :url => admin_conference_supporter_level_path(@conference.short_title, @conference.supporter_levels)) do |f| = f.input :use_supporter_levels, :label => false = dynamic_association :supporter_levels, "Supporter Levels", f = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} diff --git a/app/views/admin/tracks/tracks_list.html.haml b/app/views/admin/tracks/index.html.haml similarity index 81% rename from app/views/admin/tracks/tracks_list.html.haml rename to app/views/admin/tracks/index.html.haml index edb3485f..0076776a 100644 --- a/app/views/admin/tracks/tracks_list.html.haml +++ b/app/views/admin/tracks/index.html.haml @@ -2,6 +2,6 @@ .col-md-3 = render 'admin/conference/sidebar' .col-md-9 - = semantic_form_for(@conference, :url => admin_conference_tracks_update_path(@conference.short_title)) do |f| + = semantic_form_for(@conference, :url => admin_conference_track_path(@conference.short_title, @conference.tracks)) do |f| = dynamic_association :tracks, "Tracks", f = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} diff --git a/config/routes.rb b/config/routes.rb index ccc0a49b..e437fe45 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -16,30 +16,22 @@ Osem::Application.routes.draw do put "/registrations/edit" => "registrations#update" delete "/registrations" => "registrations#delete" put "/registrations/change_field" => "registrations#change_field" - get "/emailsettings" => "emails#show", :as => "email_settings" - put "/emailsettings" => "emails#update" - get "/supporter_levels" => "supporter_levels#show" - put "/supporter_levels" => "supporter_levels#update" get "/venue" => "venue#show", :as => "venue_info" put "/venue" => "venue#update", :as => "venue_update" - get "/social_events" => "social_events#show", :as => "social_events" - put "/social_events" => "social_events#update" - get "/rooms" => "rooms#show", :as => "rooms_list" - put "/rooms" => "rooms#update", :as => "rooms_update" - get "/tracks" => "tracks#show", :as => "tracks_list" - put "/tracks" => "tracks#update", :as => "tracks_update" get "/dietary_choices" => "dietchoices#show", :as => "dietary_list" put "/dietary_choices" => "dietchoices#update", :as => "dietary_update" get "/volunteers_list" => "volunteers#show" get "/volunteers" => "volunteers#index", :as => "volunteers_info" put "/volunteers" => "volunteers#update", :as => "volunteers_update" - get "/cfp" => "callforpapers#show", :as => "cfp_info" - put "/cfp" => "callforpapers#update", :as => "cfp_update" - post "/cfp" => "callforpapers#create", :as => "cfp_create" - get "/event_types" => "eventtype#show", :as => "eventtype_list" - put "/event_types" => "eventtype#update", :as => "eventtype_update" - put "/difficulty_levels" => "difficulty_levels#update" - resources :difficulty_levels + + resources :difficulty_levels, only: [:show, :update, :index] + resources :rooms, only: [:show, :update, :index] + resources :tracks, only: [:show, :update, :index] + resources :eventtype, only: [:show, :update, :index] + resources :social_events, only: [:show, :update, :index] + resources :supporter_levels, only: [:show, :update, :index] + resources :emails, only: [:show, :update, :index] + resources :callforpapers, only: [:show, :update, :index] put "/questions/update_conference" => "questions#update_conference" resources :questions resources :events do