Splaspage: Add highlights. Fix cfp inclusion.

This commit is contained in:
Stella Rouzi 2014-11-27 20:40:26 +02:00
parent e9456be31a
commit ed8a71e554
13 changed files with 61 additions and 24 deletions

View file

@ -562,6 +562,14 @@ class Conference < ActiveRecord::Base
User.with_role(:keynote_speaker, self)
end
##
#
# ====Returns
# * +Array+ -> Events with attribute 'is_highlight'
def highlights
events.where(is_highlight: true)
end
private
after_create do

View file

@ -1,7 +1,7 @@
class Splashpage < ActiveRecord::Base
belongs_to :conference
attr_accessible :public,
:include_tracks, :include_program,
:include_tracks, :include_program, :include_cfp,
:include_venue, :include_registrations,
:include_tickets, :include_lodgings,
:include_sponsors, :include_social_media

View file

@ -7,7 +7,6 @@
= semantic_form_for(@call_for_paper, :url => admin_conference_call_for_paper_path(@conference.short_title),:html => {:multipart => true}) do |f|
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
= f.input :include_cfp_in_splash, label: "Show Call for Papers on the splash page"
= f.input :schedule_public, label: "Show Schedule on the home and splash page"
= f.input :schedule_changes, label: "Allow submitters to change their event after it is scheduled"
= f.input :rating, :hint => "Enter the number of different rating levels you want to have for voting on proposals. Enter 0 if you do not want to vote on proposals."

View file

@ -29,13 +29,6 @@
Tracks:
%dd
= tracks(@conference)
%dt
Public
%dd#cfp_in_splash
- if @call_for_paper.include_cfp_in_splash
True
- else
False
%dt
Public Schedule
%dd#schedule_public

View file

@ -8,6 +8,7 @@
= f.inputs name: 'Components' do
= f.input :include_tracks, label: 'Display tracks on the splashpage?'
= f.input :include_program, label: 'Display program on the splashpage?'
= f.input :include_cfp, label: 'Display CfP information on splashpage, while cfp is open?'
= f.input :include_venue, label: 'Display venue on the splashpage?'
= f.input :include_registrations, label: 'Display the registration period on the splashpage?'
= f.input :include_tickets, label: 'Display tickets on the splashpage?'

View file

@ -45,6 +45,13 @@
Yes
- else
No
%dt
Include CFP:
%dd
- if @splashpage.include_cfp
Yes
- else
No
%dt
Include Social Media:
%dd

View file

@ -25,8 +25,21 @@
Full Schedule
- #FIXME: Display keynotes https://github.com/openSUSE/osem/issues/544
- #FIXME: Display schedule highlights https://github.com/openSUSE/osem/issues/545
%h3.text-center
Don't miss out!
- if @conference.highlights.any?
.row
.col-md-12
- @conference.highlights.each_slice(2) do |slice|
.row.row-centered
- slice.each do |event|
.col-md-6.col-centered.col-top.highlights
%p.text-center
%b= event.title
%h5.text-center
= simple_format truncate(event.abstract, length: 500, separator: ' ')
= link_to "Read More", conference_proposal_path(@conference.short_title, event)
= content_for :splash_nav do
%li

View file

@ -33,7 +33,7 @@
%section#program
= render 'program'
- if @conference.cfp_open? and @conference.call_for_paper.include_cfp_in_splash?
- if @conference.cfp_open? and @conference.splashpage.include_cfp
%section#callforpapers
= render 'call_for_paper'
@ -53,7 +53,7 @@
%section#sponsors
= render 'sponsors'
- if @conference.splashpage.include_social_media and @conference.contact.has_social_media?
- if @conference.contact.has_social_media? and @conference.splashpage.include_social_media
%section#social-media
= render 'social_media'

View file

@ -0,0 +1,5 @@
class AddIsHighlightInEvents < ActiveRecord::Migration
def change
add_column :events, :is_highlight, :boolean, default: false
end
end

View file

@ -0,0 +1,5 @@
class RemoveColumnIncludeCfpInSplashFromCfp < ActiveRecord::Migration
def change
remove_column :call_for_papers, :include_cfp_in_splash, :boolean, default: false
end
end

View file

@ -0,0 +1,5 @@
class AddIncludeCfpInSplashpages < ActiveRecord::Migration
def change
add_column :splashpages, :include_cfp, :boolean, default: false
end
end

View file

@ -32,15 +32,14 @@ ActiveRecord::Schema.define(version: 20141130182139) do
end
create_table "call_for_papers", force: true do |t|
t.date "start_date", null: false
t.date "end_date", null: false
t.date "start_date", null: false
t.date "end_date", null: false
t.integer "conference_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "schedule_changes", default: false
t.integer "rating", default: 3
t.boolean "schedule_changes", default: false
t.integer "rating", default: 3
t.boolean "schedule_public"
t.boolean "include_cfp_in_splash", default: false
end
create_table "campaigns", force: true do |t|
@ -234,6 +233,7 @@ ActiveRecord::Schema.define(version: 20141130182139) do
t.boolean "require_registration"
t.integer "difficulty_level_id"
t.integer "week"
t.boolean "is_highlight", default: false
end
create_table "events_registrations", id: false, force: true do |t|
@ -334,11 +334,11 @@ ActiveRecord::Schema.define(version: 20141130182139) do
create_table "roles", force: true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.string "description"
t.integer "resource_id"
t.string "resource_type"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id"
@ -378,6 +378,7 @@ ActiveRecord::Schema.define(version: 20141130182139) do
t.boolean "include_lodgings"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "include_cfp", default: false
end
create_table "sponsors", force: true do |t|

View file

@ -12,7 +12,8 @@ describe 'conference/show.html.haml' do
include_tickets: true,
include_social_media: true,
include_venue: true,
include_lodgings: true)
include_lodgings: true,
include_cfp: true)
@conference.contact.update(sponsor_email: 'example@example.com',
facebook: 'http://facebook.com',
@ -24,8 +25,7 @@ describe 'conference/show.html.haml' do
start_date: Date.yesterday,
end_date: Date.tomorrow)
@conference.call_for_paper = create(:call_for_paper, conference: @conference,
include_cfp_in_splash: true)
@conference.call_for_paper = create(:call_for_paper, conference: @conference)
@conference.sponsorship_levels << create(:sponsorship_level, conference: @conference)
@sponsorship_level = @conference.sponsorship_levels.first