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
end
helper_method :organizer_or_admin?
def not_found
raise ActionController::RoutingError.new('Not Found')
end
end

View file

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

View file

@ -19,7 +19,8 @@ class Conference < ActiveRecord::Base
:lodging_description, :include_registrations_in_splash,
:include_sponsors_in_splash, :include_tracks_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
@ -282,6 +283,7 @@ class Conference < ActiveRecord::Base
result['tracks'] = tracks_set?
result['event_types'] = event_types_set?
result['difficulty_levels'] = difficulty_levels_set?
result['make_conference_public'] = make_conference_public?
result['process'] = calculate_setup_progress(result)
result['short_title'] = short_title
result

View file

@ -27,3 +27,6 @@
%li{'class'=>class_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'])
%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
.col-md-8
= 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 :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"

View file

@ -21,7 +21,8 @@
.col-md-2
.btn-group-vertical
- if !@conference || @conference != conference
= link_to "View Conference", conference_path(conference.short_title), :class =>"btn btn-default"
- if conference.make_conference_public?
= link_to "View Conference", conference_path(conference.short_title), :class =>"btn btn-default"
- if conference.registration_open?
- if conference.user_registered?(current_user)
= link_to "Modify Registration", register_conference_path(conference.short_title), :class =>"btn btn-default"
@ -31,4 +32,4 @@
- if !current_user.nil? && current_user.person.proposal_count(conference) > 0
= link_to "View My Proposals", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default"
- elsif conference.cfp_open?
= link_to "Submit Proposal", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default"
= link_to "Submit Proposal", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default"

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_social_media_in_splash", default: false
t.boolean "include_program_in_splash", default: false
t.boolean "make_conference_public", default: false
end
create_table "conferences_questions", id: false, force: true do |t|

View file

@ -3,14 +3,24 @@ require 'spec_helper'
describe ConferenceController do
let(:conference) { create(:conference) }
describe 'GET #show' do
it 'assigns the requested conference to conference' do
get :show, id: conference.short_title
expect(assigns(:conference)).to eq conference
end
context 'conference made public' 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 show template' do
get :show, id: conference.short_title
expect(response).to render_template :show
it 'renders the show template' do
get :show, id: conference.short_title
expect(response).to render_template :show
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

View file

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

View file

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