Merge pull request #247 from gopesht/add_splash_dashboard

Adds Splash Checkbox in Conference Settings
This commit is contained in:
James Mason 2014-06-19 10:08:22 -07:00
commit 47777dbb4c
11 changed files with 55 additions and 16 deletions

View file

@ -72,4 +72,8 @@ class ApplicationController < ActionController::Base
redirect_to root_path, :alert => exception.message redirect_to root_path, :alert => exception.message
end end
helper_method :organizer_or_admin? helper_method :organizer_or_admin?
def not_found
raise ActionController::RoutingError.new('Not Found')
end
end end

View file

@ -1,5 +1,6 @@
class ConferenceController < ApplicationController class ConferenceController < ApplicationController
def show def show
@conference = Conference.find_by_short_title(params[:id]) @conference = Conference.find_by_short_title(params[:id])
not_found unless @conference.make_conference_public?
end end
end end

View file

@ -19,7 +19,8 @@ class Conference < ActiveRecord::Base
:lodging_description, :include_registrations_in_splash, :lodging_description, :include_registrations_in_splash,
:include_sponsors_in_splash, :include_tracks_in_splash, :include_sponsors_in_splash, :include_tracks_in_splash,
:include_tickets_in_splash, :include_social_media_in_splash, :include_tickets_in_splash, :include_social_media_in_splash,
:include_program_in_splash :include_program_in_splash, :make_conference_public
has_paper_trail has_paper_trail
@ -282,6 +283,7 @@ class Conference < ActiveRecord::Base
result['tracks'] = tracks_set? result['tracks'] = tracks_set?
result['event_types'] = event_types_set? result['event_types'] = event_types_set?
result['difficulty_levels'] = difficulty_levels_set? result['difficulty_levels'] = difficulty_levels_set?
result['make_conference_public'] = make_conference_public?
result['process'] = calculate_setup_progress(result) result['process'] = calculate_setup_progress(result)
result['short_title'] = short_title result['short_title'] = short_title
result result

View file

@ -27,3 +27,6 @@
%li{'class'=>class_for_todo(conference_progress['difficulty_levels'])} %li{'class'=>class_for_todo(conference_progress['difficulty_levels'])}
%span{'class'=>icon_for_todo(conference_progress['difficulty_levels'])} %span{'class'=>icon_for_todo(conference_progress['difficulty_levels'])}
= link_to 'Add difficulty levels', admin_conference_difficulty_levels_path(conference_progress['short_title']) = link_to 'Add difficulty levels', admin_conference_difficulty_levels_path(conference_progress['short_title'])
%li{class: class_for_todo(conference_progress['make_conference_public'])}
%span{'class'=>icon_for_todo(conference_progress['make_conference_public'])}
= link_to 'Make Splash Page Public for Visitors', edit_admin_conference_path(conference_progress['short_title'])

View file

@ -1,6 +1,8 @@
.row .row
.col-md-8 .col-md-8
= semantic_form_for(@conference, :url => admin_conference_path(@conference.short_title),:html => {:multipart => true}) do |f| = semantic_form_for(@conference, :url => admin_conference_path(@conference.short_title),:html => {:multipart => true}) do |f|
= f.input :make_conference_public, hint: 'This will enable the visitors to view the splash page(the "View Conference" button will be visible now on the home page), it is recommended to enable this after you have finished setting up all the components for display'
= f.input :include_program_in_splash, hint: 'On setting this true you will enable the program component to be displayed on the splash page.This component includes tracks, keynote speakers and the schedule' = f.input :include_program_in_splash, hint: 'On setting this true you will enable the program component to be displayed on the splash page.This component includes tracks, keynote speakers and the schedule'
= f.input :title, :hint => "The full name of the conference, such as 'OpenSUSE Conference 2013'" = f.input :title, :hint => "The full name of the conference, such as 'OpenSUSE Conference 2013'"
= f.input :short_title, :hint => "A short title, such as 'osc2013', to be used in URLs" = f.input :short_title, :hint => "A short title, such as 'osc2013', to be used in URLs"

View file

@ -21,6 +21,7 @@
.col-md-2 .col-md-2
.btn-group-vertical .btn-group-vertical
- if !@conference || @conference != conference - if !@conference || @conference != conference
- if conference.make_conference_public?
= link_to "View Conference", conference_path(conference.short_title), :class =>"btn btn-default" = link_to "View Conference", conference_path(conference.short_title), :class =>"btn btn-default"
- if conference.registration_open? - if conference.registration_open?
- if conference.user_registered?(current_user) - if conference.user_registered?(current_user)

View file

@ -0,0 +1,5 @@
class AddMakeConferencePublicToConference < ActiveRecord::Migration
def change
add_column :conferences, :make_conference_public, :boolean, default: false
end
end

View file

@ -94,6 +94,7 @@ ActiveRecord::Schema.define(version: 20140618062623) do
t.boolean "include_tickets_in_splash", default: false t.boolean "include_tickets_in_splash", default: false
t.boolean "include_social_media_in_splash", default: false t.boolean "include_social_media_in_splash", default: false
t.boolean "include_program_in_splash", default: false t.boolean "include_program_in_splash", default: false
t.boolean "make_conference_public", default: false
end end
create_table "conferences_questions", id: false, force: true do |t| create_table "conferences_questions", id: false, force: true do |t|

View file

@ -3,6 +3,7 @@ require 'spec_helper'
describe ConferenceController do describe ConferenceController do
let(:conference) { create(:conference) } let(:conference) { create(:conference) }
describe 'GET #show' do describe 'GET #show' do
context 'conference made public' do
it 'assigns the requested conference to conference' do it 'assigns the requested conference to conference' do
get :show, id: conference.short_title get :show, id: conference.short_title
expect(assigns(:conference)).to eq conference expect(assigns(:conference)).to eq conference
@ -13,4 +14,13 @@ describe ConferenceController do
expect(response).to render_template :show expect(response).to render_template :show
end end
end end
context 'conference is not public' do
it 'raises routing error' do
# rendered as 404 NOT FOUND in production environment
conference.update_attribute(:make_conference_public, false)
expect { get :show, id: conference.short_title }.
to raise_error(ActionController::RoutingError)
end
end
end
end end

View file

@ -9,6 +9,7 @@ FactoryGirl.define do
contact_email 'admin@example.com' contact_email 'admin@example.com'
start_date Date.today start_date Date.today
end_date Date.tomorrow end_date Date.tomorrow
make_conference_public true
venue venue
end end
end end

View file

@ -594,6 +594,7 @@ describe Conference do
@result['tracks'] = true @result['tracks'] = true
@result['event_types'] = true @result['event_types'] = true
@result['difficulty_levels'] = true @result['difficulty_levels'] = true
@result['make_conference_public'] = true
# Setup negative result hash # Setup negative result hash
@result_false = Hash.new @result_false = Hash.new
@ -613,6 +614,7 @@ describe Conference do
subject.tracks = [] subject.tracks = []
subject.event_types = [] subject.event_types = []
subject.difficulty_levels = [] subject.difficulty_levels = []
subject.make_conference_public = false
expect(subject.get_status).to eq(@result_false) expect(subject.get_status).to eq(@result_false)
end end
@ -625,9 +627,10 @@ describe Conference do
subject.tracks = [] subject.tracks = []
subject.event_types = [] subject.event_types = []
subject.difficulty_levels = [] subject.difficulty_levels = []
subject.make_conference_public = false
@result_false['registration'] = true @result_false['registration'] = true
@result_false['process'] = 14.to_s @result_false['process'] = 13.to_s
expect(subject.get_status).to eq(@result_false) expect(subject.get_status).to eq(@result_false)
end end
@ -640,10 +643,11 @@ describe Conference do
subject.tracks = [] subject.tracks = []
subject.event_types = [] subject.event_types = []
subject.difficulty_levels = [] subject.difficulty_levels = []
subject.make_conference_public = false
@result_false['cfp'] = true @result_false['cfp'] = true
@result_false['registration'] = true @result_false['registration'] = true
@result_false['process'] = 29.to_s @result_false['process'] = 25.to_s
expect(subject.get_status).to eq(@result_false) expect(subject.get_status).to eq(@result_false)
end end
@ -657,11 +661,12 @@ describe Conference do
subject.tracks = [] subject.tracks = []
subject.event_types = [] subject.event_types = []
subject.difficulty_levels = [] subject.difficulty_levels = []
subject.make_conference_public = false
@result_false['cfp'] = true @result_false['cfp'] = true
@result_false['registration'] = true @result_false['registration'] = true
@result_false['venue'] = true @result_false['venue'] = true
@result_false['process'] = 43.to_s @result_false['process'] = 38.to_s
expect(subject.get_status).to eq(@result_false) expect(subject.get_status).to eq(@result_false)
end end
@ -675,12 +680,13 @@ describe Conference do
subject.tracks = [] subject.tracks = []
subject.event_types = [] subject.event_types = []
subject.difficulty_levels = [] subject.difficulty_levels = []
subject.make_conference_public = false
@result_false['cfp'] = true @result_false['cfp'] = true
@result_false['registration'] = true @result_false['registration'] = true
@result_false['venue'] = true @result_false['venue'] = true
@result_false['rooms'] = true @result_false['rooms'] = true
@result_false['process'] = 57.to_s @result_false['process'] = 50.to_s
expect(subject.get_status).to eq(@result_false) expect(subject.get_status).to eq(@result_false)
end end
@ -694,13 +700,14 @@ describe Conference do
subject.venue = create(:venue) subject.venue = create(:venue)
subject.event_types = [] subject.event_types = []
subject.difficulty_levels = [] subject.difficulty_levels = []
subject.make_conference_public = false
@result_false['cfp'] = true @result_false['cfp'] = true
@result_false['registration'] = true @result_false['registration'] = true
@result_false['venue'] = true @result_false['venue'] = true
@result_false['rooms'] = true @result_false['rooms'] = true
@result_false['tracks'] = true @result_false['tracks'] = true
@result_false['process'] = 71.to_s @result_false['process'] = 63.to_s
expect(subject.get_status).to eq(@result_false) expect(subject.get_status).to eq(@result_false)
end end
@ -715,6 +722,7 @@ describe Conference do
subject.call_for_papers = create(:call_for_papers) subject.call_for_papers = create(:call_for_papers)
subject.venue = create(:venue) subject.venue = create(:venue)
subject.difficulty_levels = [] subject.difficulty_levels = []
subject.make_conference_public = false
@result_false['cfp'] = true @result_false['cfp'] = true
@result_false['registration'] = true @result_false['registration'] = true
@ -722,7 +730,7 @@ describe Conference do
@result_false['rooms'] = true @result_false['rooms'] = true
@result_false['tracks'] = true @result_false['tracks'] = true
@result_false['event_types'] = true @result_false['event_types'] = true
@result_false['process'] = 86.to_s @result_false['process'] = 75.to_s
expect(subject.get_status).to eq(@result_false) expect(subject.get_status).to eq(@result_false)
end end
@ -737,6 +745,7 @@ describe Conference do
subject.venue = create(:venue) subject.venue = create(:venue)
subject.call_for_papers = create(:call_for_papers) subject.call_for_papers = create(:call_for_papers)
subject.venue = create(:venue) subject.venue = create(:venue)
subject.make_conference_public = true
expect(subject.get_status).to eq(@result) expect(subject.get_status).to eq(@result)
end end