created current scope in event_schedule model and conference info link name and path changed
This commit is contained in:
parent
e8d3177ec1
commit
e82a3e1727
17 changed files with 53 additions and 65 deletions
|
|
@ -15,7 +15,7 @@ $(document).ready(function() {
|
|||
// Makes an ajax call for fresh data
|
||||
function refreshCurrentEvents(){
|
||||
$.ajax({
|
||||
url: "conference_wide_screen.js"
|
||||
url: "conference_info.js"
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -173,16 +173,15 @@ module Admin
|
|||
end
|
||||
end
|
||||
|
||||
def conference_wide_screen
|
||||
def conference_info
|
||||
# To display sponsors in the conference wide information page
|
||||
@sponsors = @conference.sponsors
|
||||
@program = @conference.program
|
||||
@current_events = @conference.program.events.current
|
||||
@current_event_schedules = @program.selected_schedule.event_schedules.current
|
||||
@tweets = twitter_client.search_tweets(15, @conference.contact.social_tag)
|
||||
|
||||
respond_to do |format|
|
||||
format.html{render layout: 'conference_wide_screen'}
|
||||
format.js {render action: 'conference_wide_screen.js.haml'}
|
||||
format.html{render layout: 'conference_info'}
|
||||
format.js {render action: 'conference_info.js.haml'}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ class Event < ActiveRecord::Base
|
|||
scope :canceled, -> { where(state: 'canceled') }
|
||||
scope :withdrawn, -> { where(state: 'withdrawn') }
|
||||
scope :highlighted, -> { where(is_highlight: true) }
|
||||
scope :current, -> { joins(:event_type).where('start_time <= ? AND state = ?', Time.current, 'confirmed').map { |e| e if e.end_time > Time.current }.compact }
|
||||
|
||||
state_machine initial: :new do
|
||||
state :new
|
||||
|
|
@ -248,13 +247,6 @@ class Event < ActiveRecord::Base
|
|||
event_schedules.find_by(schedule_id: program.selected_schedule_id).try(:start_time)
|
||||
end
|
||||
|
||||
##
|
||||
# Returns end of the event
|
||||
#
|
||||
def end_time
|
||||
self.start_time + self.event_type.length.minutes
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
##
|
||||
|
|
@ -302,11 +294,4 @@ class Event < ActiveRecord::Base
|
|||
def conference_id
|
||||
program.conference_id
|
||||
end
|
||||
|
||||
##
|
||||
# Compares event start_time, end_with with current time to predict current events
|
||||
#
|
||||
def current?
|
||||
Time.current >= self.start_time && Time.current <= self.end_time
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class EventSchedule < ActiveRecord::Base
|
|||
scope :confirmed, -> { joins(:event).where('state = ?', 'confirmed') }
|
||||
scope :canceled, -> { joins(:event).where('state = ?', 'canceled') }
|
||||
scope :withdrawn, -> { joins(:event).where('state = ?', 'withdrawn') }
|
||||
scope :current, -> { where('start_time <= ?', Time.current).select{ |es| es.end_time >= Time.current }}
|
||||
|
||||
delegate :guid, to: :room, prefix: true
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
.row
|
||||
.col-md-12.text-center
|
||||
%h2 Current Events
|
||||
- @current_events.each do |event|
|
||||
- @current_event_schedules.each do |es|
|
||||
%div
|
||||
%h3
|
||||
= event.title
|
||||
= es.event.title
|
||||
%h4
|
||||
presented by
|
||||
= event.speaker_names
|
||||
= es.event.speaker_names
|
||||
in
|
||||
= event.room.name
|
||||
= es.event.room.name
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
- if @conference.description.present?
|
||||
%h3
|
||||
= @conference.description
|
||||
- if @current_events.present?
|
||||
- if @current_event_schedules.present?
|
||||
.row#current-events
|
||||
= render 'current_events'
|
||||
- if @conference.contact.social_tag.present? && @tweets.present?
|
||||
- if @conference.contact.social_tag.present? && @tweets.any?
|
||||
.row#conference-tweets
|
||||
= render 'conference_tweets'
|
||||
- if @sponsors.any?
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
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
|
||||
%li{:class=> active_nav_li(conference_info_admin_conference_path(@conference.short_title))}
|
||||
= link_to(conference_info_admin_conference_path(@conference.short_title)) do
|
||||
%span.fa.fa-expand
|
||||
Conference Wide Information
|
||||
Conference Info
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue