keynote type available only to admins. Able to mark as highlight. Highlights and Keynotes scoped.
This commit is contained in:
parent
5d444143ea
commit
2f6fccb912
5 changed files with 30 additions and 18 deletions
|
|
@ -113,6 +113,9 @@ module Admin
|
||||||
if params.has_key? :difficulty_level_id
|
if params.has_key? :difficulty_level_id
|
||||||
@event.update_attribute(:difficulty_level_id, params[:difficulty_level_id])
|
@event.update_attribute(:difficulty_level_id, params[:difficulty_level_id])
|
||||||
end
|
end
|
||||||
|
if params.has_key? :is_highlight
|
||||||
|
@event.update_attribute(:is_highlight, params[:is_highlight])
|
||||||
|
end
|
||||||
|
|
||||||
if @event.submitter.update_attributes!(params[:user]) && @event.
|
if @event.submitter.update_attributes!(params[:user]) && @event.
|
||||||
update_attributes!(params[:event])
|
update_attributes!(params[:event])
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,14 @@ class Conference < ActiveRecord::Base
|
||||||
def confirmed
|
def confirmed
|
||||||
where(state: :confirmed)
|
where(state: :confirmed)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def keynotes
|
||||||
|
where(state: :confirmed).select { |e| e.event_type.title == 'Keynote'}
|
||||||
|
end
|
||||||
|
|
||||||
|
def highlights
|
||||||
|
where(is_highlight: true)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
has_many :event_users, through: :events
|
has_many :event_users, through: :events
|
||||||
has_many :speakers, -> { distinct }, through: :event_users, source: :user do
|
has_many :speakers, -> { distinct }, through: :event_users, source: :user do
|
||||||
|
|
@ -558,18 +566,6 @@ class Conference < ActiveRecord::Base
|
||||||
email_settings.updated_conference_registration_dates_template
|
email_settings.updated_conference_registration_dates_template
|
||||||
end
|
end
|
||||||
|
|
||||||
def keynotes
|
|
||||||
events.where(state: 'confirmed').select { |e| e.event_type.title == 'Keynote'}
|
|
||||||
end
|
|
||||||
|
|
||||||
##
|
|
||||||
#
|
|
||||||
# ====Returns
|
|
||||||
# * +Array+ -> Events with attribute 'is_highlight'
|
|
||||||
def highlights
|
|
||||||
events.where(is_highlight: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
after_create do
|
after_create do
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,19 @@
|
||||||
- @event_types.each do |type|
|
- @event_types.each do |type|
|
||||||
%li= link_to type.title, admin_conference_event_path(@conference.short_title, @event, :event_type_id => type.id) ,
|
%li= link_to type.title, admin_conference_event_path(@conference.short_title, @event, :event_type_id => type.id) ,
|
||||||
:method => :put, :event_type_id => type.id
|
:method => :put, :event_type_id => type.id
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
%b Highlight
|
||||||
|
%td
|
||||||
|
= link_to "#{@event.is_highlight}".capitalize,
|
||||||
|
admin_conference_event_path(@conference.short_title,
|
||||||
|
@event,
|
||||||
|
is_highlight: !@event.is_highlight),
|
||||||
|
method: :put, is_highlight: !@event.is_highlight
|
||||||
|
- if @event.is_highlight
|
||||||
|
(the event is as a highlight and will appear in the splashpage)
|
||||||
|
- else
|
||||||
|
(mark as true to make the event a highlight that appears in the splashpage)
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
%b State
|
%b State
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,14 @@
|
||||||
= link_to(conference_schedule_path(@conference.short_title), class: 'btn btn-default btn-lg') do
|
= link_to(conference_schedule_path(@conference.short_title), class: 'btn btn-default btn-lg') do
|
||||||
Full Schedule
|
Full Schedule
|
||||||
|
|
||||||
- if @conference.keynotes.any?
|
- if @conference.events.keynotes.any?
|
||||||
.row
|
.row
|
||||||
.col-md12
|
.col-md12
|
||||||
%h3.text-center
|
%h3.text-center
|
||||||
Keynote Talks!
|
Keynote Talks!
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
- @conference.keynotes.each_slice(3) do |slice|
|
- @conference.events.keynotes.each_slice(3) do |slice|
|
||||||
.row.row-centered
|
.row.row-centered
|
||||||
- slice.each do |event|
|
- slice.each do |event|
|
||||||
.col-md-6.col-centered
|
.col-md-6.col-centered
|
||||||
|
|
@ -45,10 +45,10 @@
|
||||||
%h3.text-center
|
%h3.text-center
|
||||||
Don't miss out!
|
Don't miss out!
|
||||||
%br
|
%br
|
||||||
- if @conference.highlights.any?
|
- if @conference.events.highlights.any?
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
- @conference.highlights.each_slice(2) do |slice|
|
- @conference.events.highlights.each_slice(2) do |slice|
|
||||||
.row.row-centered
|
.row.row-centered
|
||||||
- slice.each do |event|
|
- slice.each do |event|
|
||||||
.col-md-6.col-centered.col-top.highlights
|
.col-md-6.col-centered.col-top.highlights
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@
|
||||||
%section#details
|
%section#details
|
||||||
- if can? :update, @event or can? :create, @event
|
- if can? :update, @event or can? :create, @event
|
||||||
= f.input :event_type_id, as: :select,
|
= f.input :event_type_id, as: :select,
|
||||||
collection: @conference.event_types.map {|x| ["#{x.title} - #{show_time(x.length)}", x.id,
|
collection: @conference.event_types.reject { |type| type.title == 'Keynote'}.map {|type| ["#{type.title} - #{show_time(type.length)}", type.id,
|
||||||
data: { min_words: x.minimum_abstract_length, max_words: x.maximum_abstract_length }]},
|
data: { min_words: type.minimum_abstract_length, max_words: type.maximum_abstract_length }]},
|
||||||
include_blank: false, label: 'Session Type'
|
include_blank: false, label: 'Session Type'
|
||||||
- else
|
- else
|
||||||
Event type: #{@event.event_type.title}
|
Event type: #{@event.event_type.title}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue