From 35afdcead4ce3cba726ca974f3208e1e2846b775 Mon Sep 17 00:00:00 2001 From: AnithaPal Date: Wed, 6 Jul 2016 15:30:39 -0400 Subject: [PATCH] added conference wide information page and linked to the admin sidebar --- .../admin/conferences_controller.rb | 6 +++++ .../conference_wide_screen.html.haml | 13 ++++++++++ app/views/layouts/_admin_sidebar.html.haml | 6 +++++ config/routes.rb | 5 +++- .../admin/conferences_controller_spec.rb | 25 +++++++++++++++++++ 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 app/views/admin/conference/conference_wide_screen.html.haml diff --git a/app/controllers/admin/conferences_controller.rb b/app/controllers/admin/conferences_controller.rb index b7063e6e..094d1f0b 100644 --- a/app/controllers/admin/conferences_controller.rb +++ b/app/controllers/admin/conferences_controller.rb @@ -173,6 +173,12 @@ module Admin end end + def conference_wide_screen + #To display sponsors in the conference wide information page + @conference = Conference.find_by(short_title: params[:id]) + @sponsors = @conference.sponsors + end + private def conference_params diff --git a/app/views/admin/conference/conference_wide_screen.html.haml b/app/views/admin/conference/conference_wide_screen.html.haml new file mode 100644 index 00000000..9ced72cb --- /dev/null +++ b/app/views/admin/conference/conference_wide_screen.html.haml @@ -0,0 +1,13 @@ +.container +- if @conference.present? + .row + .col-md-12.text-center + %h2 Upcoming Events + .row + .col-md-12.text-center + %h2 Tweets About Conference + .row + .col-md-12 + - if @sponsors.any? + %section#sponsors + = render 'conference/sponsors' diff --git a/app/views/layouts/_admin_sidebar.html.haml b/app/views/layouts/_admin_sidebar.html.haml index 62645e0c..f1b6cd10 100644 --- a/app/views/layouts/_admin_sidebar.html.haml +++ b/app/views/layouts/_admin_sidebar.html.haml @@ -136,3 +136,9 @@ = link_to(admin_conference_roles_path(@conference.short_title)) do %span.fa.fa-group Roles + + - if can? :show, @conference + %li{:class=> active_nav_li(conference_wide_screen_admin_conference_path(@conference.short_title))} + = link_to(conference_wide_screen_admin_conference_path(@conference.short_title)) do + %span.fa.fa-expand + Conference Wide Information diff --git a/config/routes.rb b/config/routes.rb index 7bd331d9..ac424004 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,6 +26,9 @@ Osem::Application.routes.draw do end resources :comments, only: [:index] resources :conferences do + member do + get :conference_wide_screen + end resource :contact, except: [:index, :new, :create, :show, :destroy] resources :schedules, only: [:index, :create, :show, :update, :destroy] resources :event_schedules, only: [:create, :update, :destroy] @@ -102,7 +105,7 @@ Osem::Application.routes.draw do get '/revision_history/:id/revert_attribute' => 'versions#revert_attribute', as: 'revision_history_revert_attribute' end - resources :conferences, only: [:index, :show] do + resources :conferences, only: [:index, :show ] do resource :program, only: [] do resources :proposals, except: :destroy do get 'commercials/render_commercial' => 'commercials#render_commercial' diff --git a/spec/controllers/admin/conferences_controller_spec.rb b/spec/controllers/admin/conferences_controller_spec.rb index eac4c68c..85c32c82 100644 --- a/spec/controllers/admin/conferences_controller_spec.rb +++ b/spec/controllers/admin/conferences_controller_spec.rb @@ -165,6 +165,18 @@ describe Admin::ConferencesController do end end + describe 'GET #conference_wide_screen' do + it 'assigns the requested conference to conference' do + get :show, id: conference.short_title + expect(assigns(:conference)).to eq conference + end + + it 'renders the conference_wide_screen page' do + get :conference_wide_screen, id: conference.short_title + expect(response).to render_template :conference_wide_screen + end + end + describe 'GET #index' do context 'with more than 0 conferences' do it 'populates an array with conferences' do @@ -280,8 +292,21 @@ describe Admin::ConferencesController do end end end + + describe 'GET #conference_wide_screen' do + it 'requires organizer privileges' do + get :conference_wide_screen, id: conference.short_title, + conference: attributes_for(:conference, + short_title: 'ExCon') + expect(response).to redirect_to(send(path)) + if message + expect(flash[:alert]).to match(/#{message}/) + end + end + end end + describe 'participant access' do before(:each) do sign_in(participant)