diff --git a/app/controllers/admin/conference_controller.rb b/app/controllers/admin/conferences_controller.rb similarity index 99% rename from app/controllers/admin/conference_controller.rb rename to app/controllers/admin/conferences_controller.rb index 2daf7f93..b7063e6e 100644 --- a/app/controllers/admin/conference_controller.rb +++ b/app/controllers/admin/conferences_controller.rb @@ -1,5 +1,5 @@ module Admin - class ConferenceController < Admin::BaseController + class ConferencesController < Admin::BaseController load_and_authorize_resource :conference, find_by: :short_title load_resource :program, through: :conference, singleton: true, except: :index load_resource :user, only: [:remove_user] diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 68b88cce..9646b86c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -30,7 +30,7 @@ class ApplicationController < ActionController::Base (!session[:return_to] || session[:return_to] && session[:return_to] == root_path) - admin_conference_index_path + admin_conferences_path else session[:return_to] || root_path end diff --git a/app/controllers/conference_controller.rb b/app/controllers/conferences_controller.rb similarity index 84% rename from app/controllers/conference_controller.rb rename to app/controllers/conferences_controller.rb index 75dce7c0..53e5bd6d 100644 --- a/app/controllers/conference_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -1,6 +1,6 @@ -class ConferenceController < ApplicationController +class ConferencesController < ApplicationController protect_from_forgery with: :null_session - before_filter :respond_to_options + before_action :respond_to_options load_and_authorize_resource find_by: :short_title load_resource :program, through: :conference, singleton: true, except: :index diff --git a/app/controllers/proposal_controller.rb b/app/controllers/proposals_controller.rb similarity index 79% rename from app/controllers/proposal_controller.rb rename to app/controllers/proposals_controller.rb index b798dea1..3ef8bd5f 100644 --- a/app/controllers/proposal_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -1,5 +1,5 @@ -class ProposalController < ApplicationController - before_filter :authenticate_user!, except: [:show, :new, :create] +class ProposalsController < ApplicationController + before_action :authenticate_user!, except: [:show, :new, :create] load_resource :conference, find_by: :short_title load_resource :program, through: :conference, singleton: true load_and_authorize_resource :event, parent: false, through: :program @@ -20,7 +20,7 @@ class ProposalController < ApplicationController def new @user = User.new - @url = conference_program_proposal_index_path(@conference.short_title) + @url = conference_program_proposals_path(@conference.short_title) @languages = @program.languages_list end @@ -30,7 +30,7 @@ class ProposalController < ApplicationController end def create - @url = conference_program_proposal_index_path(@conference.short_title) + @url = conference_program_proposals_path(@conference.short_title) # We allow proposal submission and sign up on same page. # If user is not signed in then first create new user and then sign them in @@ -55,7 +55,7 @@ class ProposalController < ApplicationController event_role: 'speaker') if @event.save ahoy.track 'Event submission', title: 'New submission' - redirect_to conference_program_proposal_index_path(@conference.short_title), notice: 'Proposal was successfully submitted.' + redirect_to conference_program_proposals_path(@conference.short_title), notice: 'Proposal was successfully submitted.' else flash[:error] = "Could not submit proposal: #{@event.errors.full_messages.join(', ')}" render action: 'new' @@ -66,7 +66,7 @@ class ProposalController < ApplicationController @url = conference_program_proposal_path(@conference.short_title, params[:id]) if @event.update(event_params) - redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title), + redirect_to conference_program_proposals_path(conference_id: @conference.short_title), notice: 'Proposal was successfully updated.' else flash[:error] = "Could not update proposal: #{@event.errors.full_messages.join(', ')}" @@ -86,10 +86,10 @@ class ProposalController < ApplicationController end if @event.save - redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title), + redirect_to conference_program_proposals_path(conference_id: @conference.short_title), notice: 'Proposal was successfully withdrawn.' else - redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title), + redirect_to conference_program_proposals_path(conference_id: @conference.short_title), error: "Could not withdraw proposal: #{@event.errors.full_messages.join(', ')}" end end @@ -107,14 +107,14 @@ class ProposalController < ApplicationController if @event.save if @conference.user_registered?(current_user) - redirect_to conference_program_proposal_index_path(@conference.short_title), + redirect_to conference_program_proposals_path(@conference.short_title), notice: 'The proposal was confirmed.' else redirect_to new_conference_conference_registration_path(conference_id: @conference.short_title), alert: 'The proposal was confirmed. Please register to attend the conference.' end else - redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title), + redirect_to conference_program_proposals_path(conference_id: @conference.short_title), error: "Could not confirm proposal: #{@event.errors.full_messages.join(', ')}" end end @@ -126,16 +126,16 @@ class ProposalController < ApplicationController begin @event.restart rescue Transitions::InvalidTransition - redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title), + redirect_to conference_program_proposals_path(conference_id: @conference.short_title), error: "The proposal can't be re-submitted." return end if @event.save - redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title), + redirect_to conference_program_proposals_path(conference_id: @conference.short_title), notice: "The proposal was re-submitted. The #{@conference.short_title} organizers will review it again." else - redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title), + redirect_to conference_program_proposals_path(conference_id: @conference.short_title), error: "Could not re-submit proposal: #{@event.errors.full_messages.join(', ')}" end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4b7b1699..aecf1c65 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -38,12 +38,12 @@ module ApplicationHelper "Registered: #{event.registrations.count}" end - # Set resource_name for devise so that we can call the devise help links (views/devise/shared/_links) from anywhere (eg sign_up form in proposal#new) + # Set resource_name for devise so that we can call the devise help links (views/devise/shared/_links) from anywhere (eg sign_up form in proposals#new) def resource_name :user end - # Set devise_mapping for devise so that we can call the devise help links (views/devise/shared/_links) from anywhere (eg sign_up form in proposal#new) + # Set devise_mapping for devise so that we can call the devise help links (views/devise/shared/_links) from anywhere (eg sign_up form in proposals#new) def devise_mapping @devise_mapping ||= Devise.mappings[:user] end diff --git a/app/models/email_settings.rb b/app/models/email_settings.rb index 5f7c8296..6d6c4478 100644 --- a/app/models/email_settings.rb +++ b/app/models/email_settings.rb @@ -42,7 +42,7 @@ class EmailSettings < ActiveRecord::Base if event h['eventtitle'] = event.title - h['proposalslink'] = Rails.application.routes.url_helpers.conference_program_proposal_index_url( + h['proposalslink'] = Rails.application.routes.url_helpers.conference_program_proposals_url( conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')) end h diff --git a/app/views/admin/conference/_campaigns.html.haml b/app/views/admin/conferences/_campaigns.html.haml similarity index 100% rename from app/views/admin/conference/_campaigns.html.haml rename to app/views/admin/conferences/_campaigns.html.haml diff --git a/app/views/admin/conference/_doughnut_chart.html.haml b/app/views/admin/conferences/_doughnut_chart.html.haml similarity index 100% rename from app/views/admin/conference/_doughnut_chart.html.haml rename to app/views/admin/conferences/_doughnut_chart.html.haml diff --git a/app/views/admin/conference/_line_chart.html.haml b/app/views/admin/conferences/_line_chart.html.haml similarity index 100% rename from app/views/admin/conference/_line_chart.html.haml rename to app/views/admin/conferences/_line_chart.html.haml diff --git a/app/views/admin/conference/_recent_registrations.html.haml b/app/views/admin/conferences/_recent_registrations.html.haml similarity index 100% rename from app/views/admin/conference/_recent_registrations.html.haml rename to app/views/admin/conferences/_recent_registrations.html.haml diff --git a/app/views/admin/conference/_recent_submissions.html.haml b/app/views/admin/conferences/_recent_submissions.html.haml similarity index 100% rename from app/views/admin/conference/_recent_submissions.html.haml rename to app/views/admin/conferences/_recent_submissions.html.haml diff --git a/app/views/admin/conference/_recent_users.html.haml b/app/views/admin/conferences/_recent_users.html.haml similarity index 100% rename from app/views/admin/conference/_recent_users.html.haml rename to app/views/admin/conferences/_recent_users.html.haml diff --git a/app/views/admin/conference/_targets.html.haml b/app/views/admin/conferences/_targets.html.haml similarity index 100% rename from app/views/admin/conference/_targets.html.haml rename to app/views/admin/conferences/_targets.html.haml diff --git a/app/views/admin/conference/_todo_list.html.haml b/app/views/admin/conferences/_todo_list.html.haml similarity index 100% rename from app/views/admin/conference/_todo_list.html.haml rename to app/views/admin/conferences/_todo_list.html.haml diff --git a/app/views/admin/conference/_top_submitter.html.haml b/app/views/admin/conferences/_top_submitter.html.haml similarity index 100% rename from app/views/admin/conference/_top_submitter.html.haml rename to app/views/admin/conferences/_top_submitter.html.haml diff --git a/app/views/admin/conference/edit.html.haml b/app/views/admin/conferences/edit.html.haml similarity index 100% rename from app/views/admin/conference/edit.html.haml rename to app/views/admin/conferences/edit.html.haml diff --git a/app/views/admin/conference/index.html.haml b/app/views/admin/conferences/index.html.haml similarity index 100% rename from app/views/admin/conference/index.html.haml rename to app/views/admin/conferences/index.html.haml diff --git a/app/views/admin/conference/new.html.haml b/app/views/admin/conferences/new.html.haml similarity index 92% rename from app/views/admin/conference/new.html.haml rename to app/views/admin/conferences/new.html.haml index 2144332e..80307e4f 100644 --- a/app/views/admin/conference/new.html.haml +++ b/app/views/admin/conferences/new.html.haml @@ -1,6 +1,6 @@ .row .col-md-8 - = semantic_form_for(@conference, :url => admin_conference_index_path) do |f| + = semantic_form_for(@conference, :url => admin_conferences_path) do |f| = f.inputs 'Basic Information' do = f.input :title, hint: "The name of your conference as it shall appear throughout the site. Example: 'OpenSUSE Conference 2013'", input_html: { required: 'required' } diff --git a/app/views/admin/conference/show.html.haml b/app/views/admin/conferences/show.html.haml similarity index 100% rename from app/views/admin/conference/show.html.haml rename to app/views/admin/conferences/show.html.haml diff --git a/app/views/admin/events/_proposal.html.haml b/app/views/admin/events/_proposal.html.haml index 118f6034..7dfe697a 100644 --- a/app/views/admin/events/_proposal.html.haml +++ b/app/views/admin/events/_proposal.html.haml @@ -35,7 +35,7 @@ %b Highlight %td = check_box_tag @conference.short_title, @event.id, @event.is_highlight, - method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{@event.id}?event[is_highlight]=", + method: :patch, url: "/admin/conferences/#{@conference.short_title}/program/events/#{@event.id}?event[is_highlight]=", class: 'switch-checkbox', data: { size: 'small', off_color: 'warning', on_text: 'Yes', @@ -91,7 +91,7 @@ %b Requires Registration %td = check_box_tag @conference.short_title, @event.id, @event.require_registration, - method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{@event.id}?event[require_registration]=", + method: :patch, url: "/admin/conferences/#{@conference.short_title}/program/events/#{@event.id}?event[require_registration]=", class: 'switch-checkbox', data: { size: 'small', off_color: 'warning', on_text: 'Yes', diff --git a/app/views/admin/events/edit.html.haml b/app/views/admin/events/edit.html.haml index 0ea1048e..0933948d 100644 --- a/app/views/admin/events/edit.html.haml +++ b/app/views/admin/events/edit.html.haml @@ -1 +1 @@ -= render 'proposal/form' \ No newline at end of file += render 'proposals/form' \ No newline at end of file diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index b7bb2b21..75349458 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -9,11 +9,11 @@ All the submissions of your speakers .row .col-md-4 - = render partial: 'admin/conference/doughnut_chart', locals: {title: 'Events state', data: @event_distribution} + = render partial: 'admin/conferences/doughnut_chart', locals: {title: 'Events state', data: @event_distribution} .col-md-4 - = render partial: 'admin/conference/doughnut_chart', locals: {title: 'Confirmed events scheduled', data: @scheduled_event_distribution} + = render partial: 'admin/conferences/doughnut_chart', locals: {title: 'Confirmed events scheduled', data: @scheduled_event_distribution} .col-md-4 - = render partial: 'admin/conference/doughnut_chart', locals: {title: 'Tracks of confirmed events', data: @tracks_distribution_confirmed} + = render partial: 'admin/conferences/doughnut_chart', locals: {title: 'Tracks of confirmed events', data: @tracks_distribution_confirmed} .row .col-md-12 %div.margin-event-table @@ -85,7 +85,7 @@ %td.text-center{'data-order' => "#{event.require_registration}"} = check_box_tag @conference.short_title, event.id, event.require_registration, - method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{event.id}?event[require_registration]=", + method: :patch, url: "/admin/conferences/#{@conference.short_title}/program/events/#{event.id}?event[require_registration]=", class: 'switch-checkbox', data: { size: 'small', off_color: 'warning', on_text: 'Yes', @@ -96,7 +96,7 @@ %td.text-center{'data-order' => "#{event.is_highlight}"} = check_box_tag @conference.short_title, event.id, event.is_highlight, - method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{event.id}?event[is_highlight]=", + method: :patch, url: "/admin/conferences/#{@conference.short_title}/program/events/#{event.id}?event[is_highlight]=", class: 'switch-checkbox', data: { size: 'small', off_color: 'warning', on_text: 'Yes', diff --git a/app/views/admin/events/registrations.html.haml b/app/views/admin/events/registrations.html.haml index 21042349..b3632d0c 100644 --- a/app/views/admin/events/registrations.html.haml +++ b/app/views/admin/events/registrations.html.haml @@ -32,7 +32,7 @@ %td= event_registration.email %td= event_registration.created_at %td - = check_box_tag @conference.short_title, @event.id, event_registration.attended, class: 'switch-checkbox', method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{@event.id}/toggle_attendance?events_registration_id=#{event_registration.id}&&event_registration[attended]=", + = check_box_tag @conference.short_title, @event.id, event_registration.attended, class: 'switch-checkbox', method: :patch, url: "/admin/conferences/#{@conference.short_title}/program/events/#{@event.id}/toggle_attendance?events_registration_id=#{event_registration.id}&&event_registration[attended]=", data: { size: 'small', off_color: 'danger', on_text: 'Yes', diff --git a/app/views/admin/registrations/index.html.haml b/app/views/admin/registrations/index.html.haml index be03da65..0e7035c0 100644 --- a/app/views/admin/registrations/index.html.haml +++ b/app/views/admin/registrations/index.html.haml @@ -12,10 +12,10 @@ %p.text-muted All the people who registered to your event .col-md-4 - = render partial: 'admin/conference/doughnut_chart', locals: {title: 'Affiliation', data: @affiliation_distribution} + = render partial: 'admin/conferences/doughnut_chart', locals: {title: 'Affiliation', data: @affiliation_distribution} - unless @conference.pending? .col-md-4 - = render partial: 'admin/conference/doughnut_chart', locals: {title: 'Attended registrations', data: @registration_distribution} + = render partial: 'admin/conferences/doughnut_chart', locals: {title: 'Attended registrations', data: @registration_distribution} .row .col-md-12 %div.margin-event-table diff --git a/app/views/admin/roles/_users.html.haml b/app/views/admin/roles/_users.html.haml index dbfbe76a..9d73421b 100644 --- a/app/views/admin/roles/_users.html.haml +++ b/app/views/admin/roles/_users.html.haml @@ -14,7 +14,7 @@ - if ( can? :toggle_user, @role ) %td.text-right = hidden_field_tag "role[user_ids][]", nil - = check_box_tag @conference.short_title, @role.id, (@role.user_ids.include? user.id), method: :post, url: "/admin/conference/#{@conference.short_title}/roles/#{@role.name}/toggle_user?user[email]=#{user.email}&user[state]=", class: 'switch-checkbox', data: { size: 'small', off_color: 'warning', on_text: 'Yes', off_text: 'No' } + = check_box_tag @conference.short_title, @role.id, (@role.user_ids.include? user.id), method: :post, url: "/admin/conferences/#{@conference.short_title}/roles/#{@role.name}/toggle_user?user[email]=#{user.email}&user[state]=", class: 'switch-checkbox', data: { size: 'small', off_color: 'warning', on_text: 'Yes', off_text: 'No' } %td= user.id %td= user.name %td= user.email diff --git a/app/views/admin/venues/show.html.haml b/app/views/admin/venues/show.html.haml index 48fe9bcd..b50c10da 100644 --- a/app/views/admin/venues/show.html.haml +++ b/app/views/admin/venues/show.html.haml @@ -8,7 +8,7 @@ .row .col-md-6 - if @conference.venue.location? - = render 'conference/venue_map' + = render '/conferences/venue_map' -else - if @venue.commercial.nil? .row diff --git a/app/views/conference/_call_for_paper.html.haml b/app/views/conferences/_call_for_paper.html.haml similarity index 94% rename from app/views/conference/_call_for_paper.html.haml rename to app/views/conferences/_call_for_paper.html.haml index 44d8a983..289c3d9e 100644 --- a/app/views/conference/_call_for_paper.html.haml +++ b/app/views/conferences/_call_for_paper.html.haml @@ -40,4 +40,4 @@ .row .col-md-12.text-center %p.cta-button - = link_to "Submit your paper now", conference_program_proposal_index_path(@conference.short_title), class: 'btn btn-success btn-lg text-center' + = link_to "Submit your paper now", conference_program_proposals_path(@conference.short_title), class: 'btn btn-success btn-lg text-center' diff --git a/app/views/conference/_conference_details.html.haml b/app/views/conferences/_conference_details.html.haml similarity index 97% rename from app/views/conference/_conference_details.html.haml rename to app/views/conferences/_conference_details.html.haml index 40d04fb5..3f60d997 100644 --- a/app/views/conference/_conference_details.html.haml +++ b/app/views/conferences/_conference_details.html.haml @@ -31,7 +31,7 @@ - if conference.registration_limit_exceeded? Sorry, no places left - if !current_user.nil? && current_user.proposal_count(conference) > 0 - = link_to "My Proposals", conference_program_proposal_index_path(conference.short_title), :class =>"btn btn-default" + = link_to "My Proposals", conference_program_proposals_path(conference.short_title), :class =>"btn btn-default" - elsif can? :new, conference.program.events.new = link_to "Submit Proposal", new_conference_program_proposal_path(conference.short_title), :class =>"btn btn-default" - if current_user.nil? || !current_user.subscribed?(conference) diff --git a/app/views/conference/_footer.html.haml b/app/views/conferences/_footer.html.haml similarity index 100% rename from app/views/conference/_footer.html.haml rename to app/views/conferences/_footer.html.haml diff --git a/app/views/conference/_gallery.html.haml b/app/views/conferences/_gallery.html.haml similarity index 100% rename from app/views/conference/_gallery.html.haml rename to app/views/conferences/_gallery.html.haml diff --git a/app/views/conference/_lodging.html.haml b/app/views/conferences/_lodging.html.haml similarity index 100% rename from app/views/conference/_lodging.html.haml rename to app/views/conferences/_lodging.html.haml diff --git a/app/views/conference/_program.html.haml b/app/views/conferences/_program.html.haml similarity index 89% rename from app/views/conference/_program.html.haml rename to app/views/conferences/_program.html.haml index aaa699a9..f07816a4 100644 --- a/app/views/conference/_program.html.haml +++ b/app/views/conferences/_program.html.haml @@ -37,4 +37,4 @@ .row .col-md-12.text-center %p.cta-button - = link_to "Submit your paper now", conference_proposal_index_path(@conference.short_title), class: 'btn btn-success btn-lg text-center' + = link_to "Submit your paper now", conference_proposals_path(@conference.short_title), class: 'btn btn-success btn-lg text-center' diff --git a/app/views/conference/_registration.html.haml b/app/views/conferences/_registration.html.haml similarity index 100% rename from app/views/conference/_registration.html.haml rename to app/views/conferences/_registration.html.haml diff --git a/app/views/conference/_schedule_splashpage.html.haml b/app/views/conferences/_schedule_splashpage.html.haml similarity index 100% rename from app/views/conference/_schedule_splashpage.html.haml rename to app/views/conferences/_schedule_splashpage.html.haml diff --git a/app/views/conference/_social_media.html.haml b/app/views/conferences/_social_media.html.haml similarity index 100% rename from app/views/conference/_social_media.html.haml rename to app/views/conferences/_social_media.html.haml diff --git a/app/views/conference/_sponsors.html.haml b/app/views/conferences/_sponsors.html.haml similarity index 100% rename from app/views/conference/_sponsors.html.haml rename to app/views/conferences/_sponsors.html.haml diff --git a/app/views/conference/_tickets.html.haml b/app/views/conferences/_tickets.html.haml similarity index 100% rename from app/views/conference/_tickets.html.haml rename to app/views/conferences/_tickets.html.haml diff --git a/app/views/conference/_venue.html.haml b/app/views/conferences/_venue.html.haml similarity index 97% rename from app/views/conference/_venue.html.haml rename to app/views/conferences/_venue.html.haml index 4fd97b90..62af90c7 100644 --- a/app/views/conference/_venue.html.haml +++ b/app/views/conferences/_venue.html.haml @@ -2,7 +2,7 @@ %li %a.smoothscroll{ href: '#venue' } Venue -if @conference.venue.location? - = render 'conference/venue_map' + = render '/conferences/venue_map' -else .container .row diff --git a/app/views/conference/_venue_map.html.haml b/app/views/conferences/_venue_map.html.haml similarity index 100% rename from app/views/conference/_venue_map.html.haml rename to app/views/conferences/_venue_map.html.haml diff --git a/app/views/conference/index.html.haml b/app/views/conferences/index.html.haml similarity index 100% rename from app/views/conference/index.html.haml rename to app/views/conferences/index.html.haml diff --git a/app/views/conference/show.html.haml b/app/views/conferences/show.html.haml similarity index 100% rename from app/views/conference/show.html.haml rename to app/views/conferences/show.html.haml diff --git a/app/views/layouts/_admin_sidebar.html.haml b/app/views/layouts/_admin_sidebar.html.haml index 44cdb3b9..62645e0c 100644 --- a/app/views/layouts/_admin_sidebar.html.haml +++ b/app/views/layouts/_admin_sidebar.html.haml @@ -6,7 +6,7 @@ %span.caret %ul.dropdown-menu{role:'menu'} %li - = link_to(admin_conference_index_path) do + = link_to(admin_conferences_path) do %span.fa.fa-home All Conferences - @conferences.each do |conference| diff --git a/app/views/layouts/_admin_sidebar_index.html.haml b/app/views/layouts/_admin_sidebar_index.html.haml index b00bb546..4ae56dce 100644 --- a/app/views/layouts/_admin_sidebar_index.html.haml +++ b/app/views/layouts/_admin_sidebar_index.html.haml @@ -6,7 +6,7 @@ %span.caret %ul.dropdown-menu{role: 'menu'} %li - = link_to(admin_conference_index_path) do + = link_to(admin_conferences_path) do %span.fa.fa-home All Conferences - @conferences.each do |conference| diff --git a/app/views/layouts/_user_menu.html.haml b/app/views/layouts/_user_menu.html.haml index e626ddd9..95c7937e 100644 --- a/app/views/layouts/_user_menu.html.haml +++ b/app/views/layouts/_user_menu.html.haml @@ -9,7 +9,7 @@ Edit Profile -if @conference and @conference.program %li - = link_to(conference_program_proposal_index_path(@conference.short_title)) do + = link_to(conference_program_proposals_path(@conference.short_title)) do %span.fa.fa-comment My Submissions %li @@ -25,7 +25,7 @@ %li.divider %li - if Conference.any? - = link_to(admin_conference_index_path()) do + = link_to(admin_conferences_path()) do %span.fa.fa-home Administration - if can? :create, Conference diff --git a/app/views/proposal/_encouragement_text.html.haml b/app/views/proposals/_encouragement_text.html.haml similarity index 100% rename from app/views/proposal/_encouragement_text.html.haml rename to app/views/proposals/_encouragement_text.html.haml diff --git a/app/views/proposal/_form.html.haml b/app/views/proposals/_form.html.haml similarity index 98% rename from app/views/proposal/_form.html.haml rename to app/views/proposals/_form.html.haml index d42174b0..3729e675 100644 --- a/app/views/proposal/_form.html.haml +++ b/app/views/proposals/_form.html.haml @@ -6,7 +6,7 @@ = link_to 'Commercials', '#commercials-content', 'data-toggle' => 'tab' .tab-content #proposal-content.tab-pane.active - = render 'proposal/proposal_form' + = render 'proposals/proposal_form' #commercials-content.tab-pane %p.text-muted You can add commercials for your proposal. These commercials will be displayed on the diff --git a/app/views/proposal/_proposal_form.html.haml b/app/views/proposals/_proposal_form.html.haml similarity index 100% rename from app/views/proposal/_proposal_form.html.haml rename to app/views/proposals/_proposal_form.html.haml diff --git a/app/views/proposal/_tooltip.html.haml b/app/views/proposals/_tooltip.html.haml similarity index 100% rename from app/views/proposal/_tooltip.html.haml rename to app/views/proposals/_tooltip.html.haml diff --git a/app/views/proposal/edit.html.haml b/app/views/proposals/edit.html.haml similarity index 100% rename from app/views/proposal/edit.html.haml rename to app/views/proposals/edit.html.haml diff --git a/app/views/proposal/index.html.haml b/app/views/proposals/index.html.haml similarity index 100% rename from app/views/proposal/index.html.haml rename to app/views/proposals/index.html.haml diff --git a/app/views/proposal/new.html.haml b/app/views/proposals/new.html.haml similarity index 100% rename from app/views/proposal/new.html.haml rename to app/views/proposals/new.html.haml diff --git a/app/views/proposal/registrations.html.haml b/app/views/proposals/registrations.html.haml similarity index 100% rename from app/views/proposal/registrations.html.haml rename to app/views/proposals/registrations.html.haml diff --git a/app/views/proposal/show.html.haml b/app/views/proposals/show.html.haml similarity index 100% rename from app/views/proposal/show.html.haml rename to app/views/proposals/show.html.haml diff --git a/config/routes.rb b/config/routes.rb index fac0b4f4..7bd331d9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -25,7 +25,7 @@ Osem::Application.routes.draw do end end resources :comments, only: [:index] - resources :conference do + resources :conferences do resource :contact, except: [:index, :new, :create, :show, :destroy] resources :schedules, only: [:index, :create, :show, :update, :destroy] resources :event_schedules, only: [:create, :update, :destroy] @@ -102,17 +102,17 @@ Osem::Application.routes.draw do get '/revision_history/:id/revert_attribute' => 'versions#revert_attribute', as: 'revision_history_revert_attribute' end - resources :conference, only: [:index, :show] do + resources :conferences, only: [:index, :show] do resource :program, only: [] do - resources :proposal, except: :destroy do + resources :proposals, except: :destroy do get 'commercials/render_commercial' => 'commercials#render_commercial' resources :commercials, only: [:create, :update, :destroy] member do get :registrations - patch '/withdraw' => 'proposal#withdraw' + patch '/withdraw' => 'proposals#withdraw' get :registrations - patch '/confirm' => 'proposal#confirm' - patch '/restart' => 'proposal#restart' + patch '/confirm' => 'proposals#confirm' + patch '/restart' => 'proposals#restart' end end end @@ -145,7 +145,7 @@ Osem::Application.routes.draw do end end - get '/admin' => redirect('/admin/conference') + get '/admin' => redirect('/admin/conferences') - root to: 'conference#index', via: [:get, :options] + root to: 'conferences#index', via: [:get, :options] end diff --git a/spec/controllers/admin/conferences_controller_spec.rb b/spec/controllers/admin/conferences_controller_spec.rb index 2384c909..eac4c68c 100644 --- a/spec/controllers/admin/conferences_controller_spec.rb +++ b/spec/controllers/admin/conferences_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Admin::ConferenceController do +describe Admin::ConferencesController do # It is necessary to use bang version of let to build roles before user let(:conference) { create(:conference, end_date: Date.new(2014, 05, 26) + 15) } diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb new file mode 100644 index 00000000..214e522a --- /dev/null +++ b/spec/controllers/application_controller_spec.rb @@ -0,0 +1,38 @@ +require 'spec_helper' + +describe ApplicationController, type: :controller do + let(:conference) { create(:conference) } + + describe 'user is signed in' do + + describe 'as admin' do + let(:admin) { create(:admin) } + before { sign_in(admin) } + + it 'redirects to the admin homepage' do + expect(controller.after_sign_in_path_for(admin)).to eq admin_conferences_path + end + end + + describe 'as regular user' do + let(:user) { create(:user) } + before { sign_in(user) } + + context 'with no return_to value in the session' do + it 'redirects to the root_path' do + expect(controller.after_sign_in_path_for(user)).to eq root_path + end + end + + context 'with a specific return_to value provided in the session' do + it 'redirects to the conferences_path' do + @request.session['return_to'] = conferences_path + expect(controller.after_sign_in_path_for(user)).to eq conferences_path + end + end + + end + + end + +end diff --git a/spec/controllers/conference_controller_spec.rb b/spec/controllers/conferences_controller_spec.rb similarity index 85% rename from spec/controllers/conference_controller_spec.rb rename to spec/controllers/conferences_controller_spec.rb index 493fcb42..6479eb34 100644 --- a/spec/controllers/conference_controller_spec.rb +++ b/spec/controllers/conferences_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' -describe ConferenceController do - let(:conference) { create(:conference, splashpage: create(:splashpage, public: true), venue: create(:venue)) } +describe ConferencesController do + let(:conference) { create(:conference, splashpage: create(:splashpage, public: true), venue: create(:venue)) } let!(:cfp) { create(:cfp, program: conference.program) } let(:room) { create(:room, venue: conference.venue) } diff --git a/spec/controllers/proposal_controller_spec.rb b/spec/controllers/proposals_controller_spec.rb similarity index 93% rename from spec/controllers/proposal_controller_spec.rb rename to spec/controllers/proposals_controller_spec.rb index f6ea2b9c..43d6e4fa 100644 --- a/spec/controllers/proposal_controller_spec.rb +++ b/spec/controllers/proposals_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe ProposalController do +describe ProposalsController do let(:user) { create(:user) } let(:conference) { create(:conference, short_title: 'lama101') } let(:event) { create(:event, program: conference.program) } @@ -16,7 +16,7 @@ describe ProposalController do it 'assigns user and url variables' do expect(assigns(:user)).to be_instance_of(User) - expect(assigns(:url)).to eq '/conference/lama101/program/proposal' + expect(assigns(:url)).to eq '/conferences/lama101/program/proposals' end it 'renders new template' do @@ -32,7 +32,7 @@ describe ProposalController do post :create, event: attributes_for(:event, event_type_id: event_type.id), conference_id: conference.short_title, user: attributes_for(:user) - expect(assigns(:url)).to eq '/conference/lama101/program/proposal' + expect(assigns(:url)).to eq '/conferences/lama101/program/proposals' end context 'user is saved successfully' do @@ -75,7 +75,7 @@ describe ProposalController do end it 'redirects to proposal index path', run: true do - expect(response).to redirect_to conference_program_proposal_index_path conference.short_title + expect(response).to redirect_to conference_program_proposals_path conference.short_title end it 'shows success message in flash notice', run: true do @@ -199,7 +199,7 @@ describe ProposalController do it 'assigns user and url variables' do expect(assigns(:user)).to be_instance_of(User) - expect(assigns(:url)).to eq '/conference/lama101/program/proposal' + expect(assigns(:url)).to eq '/conferences/lama101/program/proposals' end it 'renders new template' do @@ -214,7 +214,7 @@ describe ProposalController do it 'assigns event and url variables' do expect(assigns(:event)).to eq event - expect(assigns(:url)).to eq "/conference/lama101/program/proposal/#{event.id}" + expect(assigns(:url)).to eq "/conferences/lama101/program/proposals/#{event.id}" end it 'renders edit template' do @@ -229,7 +229,7 @@ describe ProposalController do it 'assigns url variables' do post :create, event: attributes_for(:event, event_type_id: event_type.id), conference_id: conference.short_title - expect(assigns(:url)).to eq '/conference/lama101/program/proposal' + expect(assigns(:url)).to eq '/conferences/lama101/program/proposals' end context 'creates proposal successfully' do @@ -252,7 +252,7 @@ describe ProposalController do end it 'redirects to proposal index path', run: true do - expect(response).to redirect_to conference_program_proposal_index_path conference.short_title + expect(response).to redirect_to conference_program_proposals_path conference.short_title end it 'shows success message in flash notice', run: true do @@ -298,7 +298,7 @@ describe ProposalController do patch :update, event: attributes_for(:event, title: 'some title', event_type_id: event_type.id), conference_id: conference.short_title, id: event.id - expect(assigns(:url)).to eq "/conference/lama101/program/proposal/#{event.id}" + expect(assigns(:url)).to eq "/conferences/lama101/program/proposals/#{event.id}" end context 'updates successfully' do @@ -314,7 +314,7 @@ describe ProposalController do end it 'redirects to proposal index path' do - expect(response).to redirect_to conference_program_proposal_index_path conference.short_title + expect(response).to redirect_to conference_program_proposals_path conference.short_title end it 'shows success message in flash notice' do @@ -349,7 +349,7 @@ describe ProposalController do it 'assigns url variable' do patch :withdraw, conference_id: conference.short_title, id: event.id - expect(assigns(:url)).to eq "/conference/lama101/program/proposal/#{event.id}" + expect(assigns(:url)).to eq "/conferences/lama101/program/proposals/#{event.id}" end context 'withdraws successfully' do @@ -363,7 +363,7 @@ describe ProposalController do end it 'redirects to proposal index path' do - expect(response).to redirect_to conference_program_proposal_index_path conference.short_title + expect(response).to redirect_to conference_program_proposals_path conference.short_title end it 'shows success message in flash notice' do @@ -404,7 +404,7 @@ describe ProposalController do end it 'redirects to proposal index path' do - expect(response).to redirect_to conference_program_proposal_index_path conference.short_title + expect(response).to redirect_to conference_program_proposals_path conference.short_title end it 'shows error in flash message' do @@ -426,7 +426,7 @@ describe ProposalController do end it 'assigns url variable' do - expect(assigns(:url)).to eq "/conference/lama101/program/proposal/#{event.id}" + expect(assigns(:url)).to eq "/conferences/lama101/program/proposals/#{event.id}" end it 'change state of event to confirmed' do @@ -439,7 +439,7 @@ describe ProposalController do before { patch :confirm, conference_id: conference.short_title, id: event.id } it 'assigns url variable' do - expect(assigns(:url)).to eq "/conference/lama101/program/proposal/#{event.id}" + expect(assigns(:url)).to eq "/conferences/lama101/program/proposals/#{event.id}" end it 'change state of event to confirmed' do @@ -455,7 +455,7 @@ describe ProposalController do end it 'redirects to proposal index path' do - expect(response).to redirect_to conference_program_proposal_index_path conference.short_title + expect(response).to redirect_to conference_program_proposals_path conference.short_title end it 'shows success message in flash notice' do @@ -510,7 +510,7 @@ describe ProposalController do end it 'redirects to proposal index path' do - expect(response).to redirect_to conference_program_proposal_index_path conference.short_title + expect(response).to redirect_to conference_program_proposals_path conference.short_title end it 'shows error in flash message' do @@ -524,7 +524,7 @@ describe ProposalController do it 'assigns url variable' do patch :restart, conference_id: conference.short_title, id: event.id - expect(assigns(:url)).to eq "/conference/lama101/program/proposal/#{event.id}" + expect(assigns(:url)).to eq "/conferences/lama101/program/proposals/#{event.id}" end context 'resubmits successfully' do @@ -538,7 +538,7 @@ describe ProposalController do end it 'redirects to proposal index path' do - expect(response).to redirect_to conference_program_proposal_index_path conference.short_title + expect(response).to redirect_to conference_program_proposals_path conference.short_title end it 'shows success message in flash notice' do @@ -558,7 +558,7 @@ describe ProposalController do end it 'redirects to proposal index path' do - expect(response).to redirect_to conference_program_proposal_index_path conference.short_title + expect(response).to redirect_to conference_program_proposals_path conference.short_title end it 'shows error in flash message' do @@ -578,7 +578,7 @@ describe ProposalController do end it 'redirects to proposal index path' do - expect(response).to redirect_to conference_program_proposal_index_path conference.short_title + expect(response).to redirect_to conference_program_proposals_path conference.short_title end it 'shows error in flash message' do diff --git a/spec/features/ability_spec.rb b/spec/features/ability_spec.rb index 8ac8a1ec..2bcd8331 100644 --- a/spec/features/ability_spec.rb +++ b/spec/features/ability_spec.rb @@ -34,28 +34,28 @@ feature 'Has correct abilities' do expect(current_path).to eq(admin_conference_path(conference1.short_title)) expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard') - expect(page).to have_link('Basics', href: "/admin/conference/#{conference1.short_title}/edit") - expect(page).to have_link('Contact', href: "/admin/conference/#{conference1.short_title}/contact/edit") - expect(page).to have_link('Commercials', href: "/admin/conference/#{conference1.short_title}/commercials") - expect(page).to have_link('Events', href: "/admin/conference/#{conference1.short_title}/program/events") - expect(page).to have_link('Registrations', href: "/admin/conference/#{conference1.short_title}/registrations") - expect(page).to have_link('Schedules', href: "/admin/conference/#{conference1.short_title}/schedules") - expect(page).to have_link('Campaigns', href: "/admin/conference/#{conference1.short_title}/campaigns") - expect(page).to have_link('Goals', href: "/admin/conference/#{conference1.short_title}/targets") - expect(page).to have_link('Venue', href: "/admin/conference/#{conference1.short_title}/venue") - expect(page).to have_link('Rooms', href: "/admin/conference/#{conference1.short_title}/venue/rooms") - expect(page).to have_link('Lodgings', href: "/admin/conference/#{conference1.short_title}/lodgings") - expect(page).to have_link('Sponsorship', href: "/admin/conference/#{conference1.short_title}/sponsorship_levels") - expect(page).to have_link('Sponsors', href: "/admin/conference/#{conference1.short_title}/sponsors") - expect(page).to have_link('Tickets', href: "/admin/conference/#{conference1.short_title}/tickets") - expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference1.short_title}/emails") - expect(page).to have_link('Program', href: "/admin/conference/#{conference1.short_title}/program") - expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference1.short_title}/program/cfp") - expect(page).to have_link('Tracks', href: "/admin/conference/#{conference1.short_title}/program/tracks") - expect(page).to have_link('Event Types', href: "/admin/conference/#{conference1.short_title}/program/event_types") - expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference1.short_title}/program/difficulty_levels") - expect(page).to have_link('Questions', href: "/admin/conference/#{conference1.short_title}/questions") - expect(page).to have_link('Roles', href: "/admin/conference/#{conference1.short_title}/roles") + expect(page).to have_link('Basics', href: "/admin/conferences/#{conference1.short_title}/edit") + expect(page).to have_link('Contact', href: "/admin/conferences/#{conference1.short_title}/contact/edit") + expect(page).to have_link('Commercials', href: "/admin/conferences/#{conference1.short_title}/commercials") + expect(page).to have_link('Events', href: "/admin/conferences/#{conference1.short_title}/program/events") + expect(page).to have_link('Registrations', href: "/admin/conferences/#{conference1.short_title}/registrations") + expect(page).to have_link('Schedules', href: "/admin/conferences/#{conference1.short_title}/schedules") + expect(page).to have_link('Campaigns', href: "/admin/conferences/#{conference1.short_title}/campaigns") + expect(page).to have_link('Goals', href: "/admin/conferences/#{conference1.short_title}/targets") + expect(page).to have_link('Venue', href: "/admin/conferences/#{conference1.short_title}/venue") + expect(page).to have_link('Rooms', href: "/admin/conferences/#{conference1.short_title}/venue/rooms") + expect(page).to have_link('Lodgings', href: "/admin/conferences/#{conference1.short_title}/lodgings") + expect(page).to have_link('Sponsorship', href: "/admin/conferences/#{conference1.short_title}/sponsorship_levels") + expect(page).to have_link('Sponsors', href: "/admin/conferences/#{conference1.short_title}/sponsors") + expect(page).to have_link('Tickets', href: "/admin/conferences/#{conference1.short_title}/tickets") + expect(page).to have_link('E-Mails', href: "/admin/conferences/#{conference1.short_title}/emails") + expect(page).to have_link('Program', href: "/admin/conferences/#{conference1.short_title}/program") + expect(page).to have_link('Call for Papers', href: "/admin/conferences/#{conference1.short_title}/program/cfp") + expect(page).to have_link('Tracks', href: "/admin/conferences/#{conference1.short_title}/program/tracks") + expect(page).to have_link('Event Types', href: "/admin/conferences/#{conference1.short_title}/program/event_types") + expect(page).to have_link('Difficulty Levels', href: "/admin/conferences/#{conference1.short_title}/program/difficulty_levels") + expect(page).to have_link('Questions', href: "/admin/conferences/#{conference1.short_title}/questions") + expect(page).to have_link('Roles', href: "/admin/conferences/#{conference1.short_title}/roles") visit edit_admin_conference_path(conference1.short_title) expect(current_path).to eq(edit_admin_conference_path(conference1.short_title)) @@ -114,29 +114,29 @@ feature 'Has correct abilities' do expect(current_path).to eq(admin_conference_path(conference2.short_title)) expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard') - expect(page).to_not have_link('Basics', href: "/admin/conference/#{conference2.short_title}/edit") + expect(page).to_not have_link('Basics', href: "/admin/conferences/#{conference2.short_title}/edit") expect(page).to have_text('Basics') - expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference2.short_title}/contact/edit") - expect(page).to have_link('Commercials', href: "/admin/conference/#{conference2.short_title}/commercials") - expect(page).to have_link('Events', href: "/admin/conference/#{conference2.short_title}/program/events") - expect(page).to_not have_link('Registrations', href: "/admin/conference/#{conference2.short_title}/registrations") - expect(page).to_not have_link('Schedules', href: "/admin/conference/#{conference2.short_title}/schedules") - expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference2.short_title}/campaigns") - expect(page).to_not have_link('Goals', href: "/admin/conference/#{conference2.short_title}/targets") - expect(page).to have_link('Venue', href: "/admin/conference/#{conference2.short_title}/venue") - expect(page).to have_link('Rooms', href: "/admin/conference/#{conference2.short_title}/venue/rooms") - expect(page).to_not have_link('Lodgings', href: "/admin/conference/#{conference2.short_title}/lodgings") - expect(page).to_not have_link('Sponsorship', href: "/admin/conference/#{conference2.short_title}/sponsorship_levels") - expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference2.short_title}/sponsors") - expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference2.short_title}/supporter_levels") - expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference2.short_title}/emails") - expect(page).to have_link('Program', href: "/admin/conference/#{conference2.short_title}/program") - expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference2.short_title}/program/cfp") - expect(page).to have_link('Tracks', href: "/admin/conference/#{conference2.short_title}/program/tracks") - expect(page).to have_link('Event Types', href: "/admin/conference/#{conference2.short_title}/program/event_types") - expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference2.short_title}/program/difficulty_levels") - expect(page).to_not have_link('Questions', href: "/admin/conference/#{conference2.short_title}/questions") - expect(page).to have_link('Roles', href: "/admin/conference/#{conference2.short_title}/roles") + expect(page).to_not have_link('Contact', href: "/admin/conferences/#{conference2.short_title}/contact/edit") + expect(page).to have_link('Commercials', href: "/admin/conferences/#{conference2.short_title}/commercials") + expect(page).to have_link('Events', href: "/admin/conferences/#{conference2.short_title}/program/events") + expect(page).to_not have_link('Registrations', href: "/admin/conferences/#{conference2.short_title}/registrations") + expect(page).to_not have_link('Schedules', href: "/admin/conferences/#{conference2.short_title}/schedules") + expect(page).to_not have_link('Campaigns', href: "/admin/conferences/#{conference2.short_title}/campaigns") + expect(page).to_not have_link('Goals', href: "/admin/conferences/#{conference2.short_title}/targets") + expect(page).to have_link('Venue', href: "/admin/conferences/#{conference2.short_title}/venue") + expect(page).to have_link('Rooms', href: "/admin/conferences/#{conference2.short_title}/venue/rooms") + expect(page).to_not have_link('Lodgings', href: "/admin/conferences/#{conference2.short_title}/lodgings") + expect(page).to_not have_link('Sponsorship', href: "/admin/conferences/#{conference2.short_title}/sponsorship_levels") + expect(page).to_not have_link('Sponsors', href: "/admin/conferences/#{conference2.short_title}/sponsors") + expect(page).to_not have_link('Supporter Levels', href: "/admin/conferences/#{conference2.short_title}/supporter_levels") + expect(page).to have_link('E-Mails', href: "/admin/conferences/#{conference2.short_title}/emails") + expect(page).to have_link('Program', href: "/admin/conferences/#{conference2.short_title}/program") + expect(page).to have_link('Call for Papers', href: "/admin/conferences/#{conference2.short_title}/program/cfp") + expect(page).to have_link('Tracks', href: "/admin/conferences/#{conference2.short_title}/program/tracks") + expect(page).to have_link('Event Types', href: "/admin/conferences/#{conference2.short_title}/program/event_types") + expect(page).to have_link('Difficulty Levels', href: "/admin/conferences/#{conference2.short_title}/program/difficulty_levels") + expect(page).to_not have_link('Questions', href: "/admin/conferences/#{conference2.short_title}/questions") + expect(page).to have_link('Roles', href: "/admin/conferences/#{conference2.short_title}/roles") visit edit_admin_conference_path(conference2.short_title) expect(current_path).to eq(root_path) @@ -191,29 +191,29 @@ feature 'Has correct abilities' do expect(current_path).to eq(admin_conference_path(conference3.short_title)) expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard') - expect(page).to_not have_link('Basics', href: "/admin/conference/#{conference2.short_title}/edit") + expect(page).to_not have_link('Basics', href: "/admin/conferences/#{conference2.short_title}/edit") expect(page).to have_text('Basics') - expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference3.short_title}/contact/edit") - expect(page).to have_link('Commercials', href: "/admin/conference/#{conference3.short_title}/commercials") - expect(page).to_not have_link('Events', href: "/admin/conference/#{conference3.short_title}/program/events") - expect(page).to have_link('Registrations', href: "/admin/conference/#{conference3.short_title}/registrations") - expect(page).to_not have_link('Schedules', href: "/admin/conference/#{conference3.short_title}/schedules") - expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference3.short_title}/campaigns") - expect(page).to_not have_link('Targets', href: "/admin/conference/#{conference3.short_title}/targets") - expect(page).to_not have_link('Venue', href: "/admin/conference/#{conference3.short_title}/venue") - expect(page).to_not have_link('Rooms', href: "/admin/conference/#{conference3.short_title}/venue/rooms") - expect(page).to_not have_link('Lodgings', href: "/admin/conference/#{conference3.short_title}/lodgings") - expect(page).to_not have_link('Sponsorship', href: "/admin/conference/#{conference3.short_title}/sponsorship_levels") - expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference3.short_title}/sponsors") - expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference3.short_title}/supporter_levels") - expect(page).to_not have_link('E-Mails', href: "/admin/conference/#{conference3.short_title}/emails") - expect(page).to_not have_link('Program', href: "/admin/conference/#{conference3.short_title}/program") - expect(page).to_not have_link('Call for papers', href: "/admin/conference/#{conference3.short_title}/program/cfp") - expect(page).to_not have_link('Tracks', href: "/admin/conference/#{conference3.short_title}/program/tracks") - expect(page).to_not have_link('Event types', href: "/admin/conference/#{conference3.short_title}/program/event_types") - expect(page).to_not have_link('Difficulty levels', href: "/admin/conference/#{conference3.short_title}/program/difficulty_levels") - expect(page).to have_link('Questions', href: "/admin/conference/#{conference3.short_title}/questions") - expect(page).to have_link('Roles', href: "/admin/conference/#{conference3.short_title}/roles") + expect(page).to_not have_link('Contact', href: "/admin/conferences/#{conference3.short_title}/contact/edit") + expect(page).to have_link('Commercials', href: "/admin/conferences/#{conference3.short_title}/commercials") + expect(page).to_not have_link('Events', href: "/admin/conferences/#{conference3.short_title}/program/events") + expect(page).to have_link('Registrations', href: "/admin/conferences/#{conference3.short_title}/registrations") + expect(page).to_not have_link('Schedules', href: "/admin/conferences/#{conference3.short_title}/schedules") + expect(page).to_not have_link('Campaigns', href: "/admin/conferences/#{conference3.short_title}/campaigns") + expect(page).to_not have_link('Targets', href: "/admin/conferences/#{conference3.short_title}/targets") + expect(page).to_not have_link('Venue', href: "/admin/conferences/#{conference3.short_title}/venue") + expect(page).to_not have_link('Rooms', href: "/admin/conferences/#{conference3.short_title}/venue/rooms") + expect(page).to_not have_link('Lodgings', href: "/admin/conferences/#{conference3.short_title}/lodgings") + expect(page).to_not have_link('Sponsorship', href: "/admin/conferences/#{conference3.short_title}/sponsorship_levels") + expect(page).to_not have_link('Sponsors', href: "/admin/conferences/#{conference3.short_title}/sponsors") + expect(page).to_not have_link('Supporter Levels', href: "/admin/conferences/#{conference3.short_title}/supporter_levels") + expect(page).to_not have_link('E-Mails', href: "/admin/conferences/#{conference3.short_title}/emails") + expect(page).to_not have_link('Program', href: "/admin/conferences/#{conference3.short_title}/program") + expect(page).to_not have_link('Call for papers', href: "/admin/conferences/#{conference3.short_title}/program/cfp") + expect(page).to_not have_link('Tracks', href: "/admin/conferences/#{conference3.short_title}/program/tracks") + expect(page).to_not have_link('Event types', href: "/admin/conferences/#{conference3.short_title}/program/event_types") + expect(page).to_not have_link('Difficulty levels', href: "/admin/conferences/#{conference3.short_title}/program/difficulty_levels") + expect(page).to have_link('Questions', href: "/admin/conferences/#{conference3.short_title}/questions") + expect(page).to have_link('Roles', href: "/admin/conferences/#{conference3.short_title}/roles") visit edit_admin_conference_path(conference3.short_title) expect(current_path).to eq(root_path) diff --git a/spec/features/base_controller_spec.rb b/spec/features/base_controller_spec.rb index 366327a2..be52c3a9 100644 --- a/spec/features/base_controller_spec.rb +++ b/spec/features/base_controller_spec.rb @@ -12,7 +12,7 @@ feature 'BaseController' do describe 'GET #verify_user_admin' do context 'when user is a guest' do it 'redirects to sign in page' do - visit admin_conference_index_path + visit admin_conferences_path expect(current_path).to eq new_user_session_path end end @@ -23,39 +23,39 @@ feature 'BaseController' do end it 'not an admin it redirects to root_path' do - visit admin_conference_index_path + visit admin_conferences_path expect(current_path).to eq root_path expect(flash).to eq 'You are not authorized to access this area!' end it 'an admin he can access the admin area' do user.is_admin = true - visit admin_conference_index_path - expect(current_path).to eq admin_conference_index_path + visit admin_conferences_path + expect(current_path).to eq admin_conferences_path end it 'an organizer he can access the admin area' do user.role_ids = organizer_role.id - visit admin_conference_index_path - expect(current_path).to eq admin_conference_index_path + visit admin_conferences_path + expect(current_path).to eq admin_conferences_path end it 'a volunteers_coordinator he can access the admin area' do user.role_ids = volunteers_coordinator_role.id - visit admin_conference_index_path - expect(current_path).to eq admin_conference_index_path + visit admin_conferences_path + expect(current_path).to eq admin_conferences_path end it 'a cfp he can access the admin area' do user.role_ids = cfp_role.id - visit admin_conference_index_path - expect(current_path).to eq admin_conference_index_path + visit admin_conferences_path + expect(current_path).to eq admin_conferences_path end it 'an info_desk he can access the admin area' do user.role_ids = info_desk_role.id - visit admin_conference_index_path - expect(current_path).to eq admin_conference_index_path + visit admin_conferences_path + expect(current_path).to eq admin_conferences_path end end end diff --git a/spec/features/commercials_spec.rb b/spec/features/commercials_spec.rb index 9b530c49..65efa0b6 100644 --- a/spec/features/commercials_spec.rb +++ b/spec/features/commercials_spec.rb @@ -9,8 +9,6 @@ feature Commercial do context 'in admin area' do scenario 'adds, updates, deletes of a conference', feature: true, js: true do - expected_count = conference.commercials.count + 1 - sign_in organizer visit admin_conference_commercials_path(conference.short_title) @@ -22,14 +20,14 @@ feature Commercial do fill_in 'commercial_url', with: 'https://www.youtube.com/watch?v=M9bq_alk-sw' click_button 'Create Commercial' expect(flash).to eq('Commercial was successfully created.') - expect(conference.commercials.count).to eq(expected_count) + expect(conference.commercials.count).to eq(1) commercial = conference.commercials.where(url: 'https://www.youtube.com/watch?v=M9bq_alk-sw').first fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=VNkDJk5_9eU' click_button 'Update' expect(flash).to eq('Commercial was successfully updated.') - expect(conference.commercials.count).to eq(expected_count) + expect(conference.commercials.count).to eq(1) commercial.reload expect(commercial.url).to eq 'https://www.youtube.com/watch?v=VNkDJk5_9eU' @@ -37,7 +35,7 @@ feature Commercial do click_link 'Delete' expect(flash).to eq('Commercial was successfully destroyed.') - expect(conference.commercials.count).to eq(expected_count - 1) + expect(conference.commercials.count).to eq(0) end end @@ -49,8 +47,6 @@ feature Commercial do user_id: participant.id, event_id: event.id, event_role: 'submitter')] - - @expected_count = Commercial.count + 1 sign_in participant end @@ -68,7 +64,7 @@ feature Commercial do click_button 'Create Commercial' expect(flash).to eq('Commercial was successfully created.') - expect(event.commercials.count).to eq(@expected_count) + expect(event.commercials.count).to eq(1) end scenario 'does not add an invalid commercial of an event', feature: true, js: true do @@ -82,7 +78,7 @@ feature Commercial do click_button 'Create Commercial' expect(flash).to include('An error prohibited this Commercial from being saved:') expect(current_path).to eq edit_conference_program_proposal_path(conference.short_title, event.id) - expect(event.commercials.count).to eq 0 + expect(event.commercials.count).to eq(0) end scenario 'updates a commercial of an event', feature: true, versioning: true, js: true do @@ -94,7 +90,7 @@ feature Commercial do fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=M9bq_alk-sw' click_button 'Update' expect(flash).to eq('Commercial was successfully updated.') - expect(event.commercials.count).to eq(@expected_count) + expect(event.commercials.count).to eq(1) commercial.reload expect(commercial.url).to eq('https://www.youtube.com/watch?v=M9bq_alk-sw') end @@ -122,7 +118,7 @@ feature Commercial do click_link 'Delete' page.driver.network_traffic expect(flash).to eq('Commercial was successfully destroyed.') - expect(event.commercials.count).to eq(@expected_count - 1) + expect(event.commercials.count).to eq(0) end end end diff --git a/spec/features/proposal_spec.rb b/spec/features/proposals_spec.rb similarity index 94% rename from spec/features/proposal_spec.rb rename to spec/features/proposals_spec.rb index 28d05bfc..4c6d6dfe 100644 --- a/spec/features/proposal_spec.rb +++ b/spec/features/proposals_spec.rb @@ -107,7 +107,7 @@ feature Event do scenario 'signed_in user submits a valid proposal', feature: true, js: true do sign_in participant_without_bio expected_count = Event.count + 1 - visit conference_program_proposal_index_path(conference.short_title) + visit conference_program_proposals_path(conference.short_title) click_link 'New Proposal' fill_in 'event_title', with: 'Example Proposal' @@ -121,13 +121,13 @@ feature Event do click_button 'Create Proposal' expect(flash).to eq('Proposal was successfully submitted.') - expect(current_path).to eq(conference_program_proposal_index_path(conference.short_title)) + expect(current_path).to eq(conference_program_proposals_path(conference.short_title)) expect(Event.count).to eq(expected_count) end scenario 'confirms a proposal', feature: true, js: true do sign_in participant - visit conference_program_proposal_index_path(conference.short_title) + visit conference_program_proposals_path(conference.short_title) expect(page.has_content?('Example Proposal')).to be true expect(@event.state).to eq('unconfirmed') click_link "confirm_proposal_#{@event.id}" @@ -141,7 +141,7 @@ feature Event do scenario 'withdraw a proposal', feature: true, js: true do sign_in participant @event.confirm! - visit conference_program_proposal_index_path(conference.short_title) + visit conference_program_proposals_path(conference.short_title) expect(page.has_content?('Example Proposal')).to be true click_link "delete_proposal_#{@event.id}" expect(flash).to eq('Proposal was successfully withdrawn.') diff --git a/spec/features/versions_spec.rb b/spec/features/versions_spec.rb index 992061c7..cfa71c77 100644 --- a/spec/features/versions_spec.rb +++ b/spec/features/versions_spec.rb @@ -179,14 +179,14 @@ feature 'Version' do click_button 'New' click_link 'Reject event' - visit conference_program_proposal_index_path(conference_id: conference.short_title) + visit conference_program_proposals_path(conference_id: conference.short_title) click_link 'Re-Submit' visit admin_conference_program_events_path(conference.short_title) click_button 'New' click_link 'Accept event' - visit conference_program_proposal_index_path(conference_id: conference.short_title) + visit conference_program_proposals_path(conference_id: conference.short_title) click_link 'Confirm' visit admin_conference_program_events_path(conference.short_title) diff --git a/spec/models/email_settings_spec.rb b/spec/models/email_settings_spec.rb index 8392d056..c66e3421 100644 --- a/spec/models/email_settings_spec.rb +++ b/spec/models/email_settings_spec.rb @@ -12,9 +12,9 @@ describe EmailSettings do 'conference' => conference.title, 'conference_start_date' => Date.new(2014, 05, 01), 'conference_end_date' => Date.new(2014, 05, 06), - 'registrationlink' => 'http://localhost:3000/conference/goto/register', - 'conference_splash_link' => 'http://localhost:3000/conference/goto', - 'schedule_link' => 'http://localhost:3000/conference/goto/schedule', + 'registrationlink' => 'http://localhost:3000/conferences/goto/register', + 'conference_splash_link' => 'http://localhost:3000/conferences/goto', + 'schedule_link' => 'http://localhost:3000/conferences/goto/schedule', 'cfp_end_date' => 'Unknown', 'cfp_start_date' => 'Unknown', 'venue' => 'Unknown', @@ -87,7 +87,7 @@ describe EmailSettings do context 'conference has event' do before do - event_hash = { 'eventtitle' => 'Talk about talks', 'proposalslink' => 'http://localhost:3000/conference/goto/program/proposal' } + event_hash = { 'eventtitle' => 'Talk about talks', 'proposalslink' => 'http://localhost:3000/conferences/goto/program/proposals' } expected_hash.merge!(event_hash) end diff --git a/spec/support/sidebar.rb b/spec/support/sidebar.rb index cfa0285e..5d90ee42 100644 --- a/spec/support/sidebar.rb +++ b/spec/support/sidebar.rb @@ -3,6 +3,6 @@ module Sidebar @conference = create(:conference) assign :conference, @conference render - expect(view).to render_template('admin/conference/_sidebar') + expect(view).to render_template('admin/conferences/_sidebar') end end diff --git a/spec/views/admin/conference/edit.html.haml_spec.rb b/spec/views/admin/conferences/edit.html.haml_spec.rb similarity index 72% rename from spec/views/admin/conference/edit.html.haml_spec.rb rename to spec/views/admin/conferences/edit.html.haml_spec.rb index a80e1f29..7964ec27 100644 --- a/spec/views/admin/conference/edit.html.haml_spec.rb +++ b/spec/views/admin/conferences/edit.html.haml_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -describe 'admin/conference/edit' do +describe 'admin/conferences/edit' do it 'renders conference details which are editable' do @conference = create(:conference, title: 'openSUSE') assign :conference, @conference - render template: 'admin/conference/edit.html.haml' + render template: 'admin/conferences/edit.html.haml' expect(rendered).to have_selector("input[value='openSUSE']") end end diff --git a/spec/views/admin/conference/index.html.haml_spec.rb b/spec/views/admin/conferences/index.html.haml_spec.rb similarity index 80% rename from spec/views/admin/conference/index.html.haml_spec.rb rename to spec/views/admin/conferences/index.html.haml_spec.rb index d1f2eef1..4c837ed0 100644 --- a/spec/views/admin/conference/index.html.haml_spec.rb +++ b/spec/views/admin/conferences/index.html.haml_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' -describe 'admin/conference/index' do +describe 'admin/conferences/index' do let(:conference) { create(:conference, title: 'openSUSE Conference 2016') } let(:second_conference) { create(:conference) } it 'renders all conference names with links' do assign(:conferences, [conference, second_conference]) - render + render template: 'admin/conferences/index.html.haml' expect(rendered).to include('openSUSE Conference 2016') expect(rendered).to include(CGI.escapeHTML(second_conference.title)) end diff --git a/spec/views/admin/conference/new.html.haml_spec.rb b/spec/views/admin/conferences/new.html.haml_spec.rb similarity index 78% rename from spec/views/admin/conference/new.html.haml_spec.rb rename to spec/views/admin/conferences/new.html.haml_spec.rb index 983526f8..c1b24bff 100644 --- a/spec/views/admin/conference/new.html.haml_spec.rb +++ b/spec/views/admin/conferences/new.html.haml_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -describe 'admin/conference/new' do +describe 'admin/conferences/new' do let(:conference) { build(:conference) } it 'renders the new template for the conference' do assign(:conference, Conference.new) - render + render template: 'admin/conferences/new.html.haml' expect(rendered).to include('Basic Information') assign(:conference, conference) render diff --git a/spec/views/admin/conference/show.html.haml_spec.rb b/spec/views/admin/conferences/show.html.haml_spec.rb similarity index 77% rename from spec/views/admin/conference/show.html.haml_spec.rb rename to spec/views/admin/conferences/show.html.haml_spec.rb index 18a2efd3..e5a38e92 100644 --- a/spec/views/admin/conference/show.html.haml_spec.rb +++ b/spec/views/admin/conferences/show.html.haml_spec.rb @@ -1,13 +1,13 @@ require 'spec_helper' -describe 'admin/conference/show' do +describe 'admin/conferences/show' do it 'renders conference dashboard' do conference = create(:conference, title: 'openSUSE') assign :conference, conference assign :program, conference.program assign :conference_progress, conference.get_status - render + render template: 'admin/conferences/show.html.haml' expect(rendered).to include("Dashboard for #{conference.title}") end end diff --git a/spec/views/conference/index.html.haml_spec.rb b/spec/views/conferences/index.html.haml_spec.rb similarity index 90% rename from spec/views/conference/index.html.haml_spec.rb rename to spec/views/conferences/index.html.haml_spec.rb index a08f664e..c4ff3aa2 100644 --- a/spec/views/conference/index.html.haml_spec.rb +++ b/spec/views/conferences/index.html.haml_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'conference/index' do +describe 'conferences/index' do it 'renders _conference partial for each conference' do allow(view).to receive(:date_string).and_return('January 17 - 21 2014') assign(:current, [create(:conference), create(:conference)]) diff --git a/spec/views/conference/show.html.haml_spec.rb b/spec/views/conferences/show.html.haml_spec.rb similarity index 79% rename from spec/views/conference/show.html.haml_spec.rb rename to spec/views/conferences/show.html.haml_spec.rb index 80f6c85b..72e68c4f 100644 --- a/spec/views/conference/show.html.haml_spec.rb +++ b/spec/views/conferences/show.html.haml_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' -describe 'conference/show.html.haml' do +describe 'conferences/show.html.haml' do let!(:conference) { create(:full_conference) } before(:each) do @@ -13,11 +13,11 @@ describe 'conference/show.html.haml' do end it 'renders program partial' do - expect(view).to render_template(partial: 'conference/_schedule_splashpage') + expect(view).to render_template(partial: 'conferences/_schedule_splashpage') end it 'renders registration partial' do - expect(view).to render_template(partial: 'conference/_registration') + expect(view).to render_template(partial: 'conferences/_registration') end it 'renders call_for_paper partial' do @@ -25,7 +25,7 @@ describe 'conference/show.html.haml' do end it 'renders sponsors partial' do - expect(view).to render_template(partial: 'conference/_sponsors') + expect(view).to render_template(partial: 'conferences/_sponsors') expect(rendered).to match(conference.contact.email) expect(rendered).to match(conference.sponsors.first.website_url) expect(rendered).to match(CGI.escapeHTML(conference.sponsors.first.description)) @@ -33,7 +33,7 @@ describe 'conference/show.html.haml' do end it 'renders social media partial' do - expect(view).to render_template('conference/_social_media') + expect(view).to render_template('conferences/_social_media') expect(rendered).to match(conference.contact.facebook) expect(rendered).to match(conference.contact.googleplus) expect(rendered).to match(conference.contact.instagram) @@ -41,7 +41,7 @@ describe 'conference/show.html.haml' do end it 'renders venue partial' do - expect(view).to render_template(partial: 'conference/_venue') + expect(view).to render_template(partial: 'conferences/_venue') expect(rendered).to match(CGI.escapeHTML(conference.venue.name)) expect(rendered).to match(conference.venue.street) expect(rendered).to match(conference.venue.website) @@ -49,7 +49,7 @@ describe 'conference/show.html.haml' do end it 'renders lodging partial' do - expect(view).to render_template(partial: 'conference/_lodging') + expect(view).to render_template(partial: 'conferences/_lodging') expect(rendered).to match(CGI.escapeHTML(conference.lodgings.first.name)) expect(rendered).to match(CGI.escapeHTML(conference.lodgings.first.description)) # FIXME: Lodging without image doesn't show link