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
|
|
@ -75,6 +75,14 @@ $ bundle exec rake logo:reprocess
|
||||||
### openID
|
### openID
|
||||||
In order to use [openID](http://openid.net/) logins for your OSEM installation you need to register your application with the providers ([Google](https://code.google.com/apis/console#:access), [GitHub](https://github.com/settings/applications/new) or [Facebook](https://developers.facebook.com/)) and enter their API keys in `config/secrets.yml` file, changing the existing sample values.
|
In order to use [openID](http://openid.net/) logins for your OSEM installation you need to register your application with the providers ([Google](https://code.google.com/apis/console#:access), [GitHub](https://github.com/settings/applications/new) or [Facebook](https://developers.facebook.com/)) and enter their API keys in `config/secrets.yml` file, changing the existing sample values.
|
||||||
|
|
||||||
|
### Twitter
|
||||||
|
In order to embed conference tweets in the application you need to register your application here [twitter](https://apps.twitter.com/) and get twitter consumer and access keys.
|
||||||
|
Add your Twitter API keys in `.env` file into these variables:
|
||||||
|
OSEM_TWITTER_CONSUMER_KEY=""
|
||||||
|
OSEM_TWITTER_CONSUMER_SECRET=""
|
||||||
|
OSEM_TWITTER_ACCESS_TOKEN=""
|
||||||
|
OSEM_TWITTER_ACCESS_TOKEN_SECRET=""
|
||||||
|
|
||||||
## Recurring Jobs
|
## Recurring Jobs
|
||||||
=======
|
=======
|
||||||
Open a separate terminal and go into the directory where the rails app is present, and type the following to start the delayed_jobs worker for sending email notifications.
|
Open a separate terminal and go into the directory where the rails app is present, and type the following to start the delayed_jobs worker for sending email notifications.
|
||||||
|
|
|
||||||
12
app.json
12
app.json
|
|
@ -59,18 +59,6 @@
|
||||||
},
|
},
|
||||||
"RAILS_ENV": {
|
"RAILS_ENV": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
|
||||||
"OSEM_TWITTER_CONSUMER_KEY": {
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"OSEM_TWITTER_CONSUMER_SECRET": {
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"OSEM_TWITTER_ACCESS_TOKEN": {
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"OSEM_TWITTER_ACCESS_TOKEN_SECRET": {
|
|
||||||
"required": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ $(document).ready(function() {
|
||||||
// Makes an ajax call for fresh data
|
// Makes an ajax call for fresh data
|
||||||
function refreshCurrentEvents(){
|
function refreshCurrentEvents(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "conference_wide_screen.js"
|
url: "conference_info.js"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,16 +173,15 @@ module Admin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def conference_wide_screen
|
def conference_info
|
||||||
# To display sponsors in the conference wide information page
|
# To display sponsors in the conference wide information page
|
||||||
@sponsors = @conference.sponsors
|
@sponsors = @conference.sponsors
|
||||||
@program = @conference.program
|
@current_event_schedules = @program.selected_schedule.event_schedules.current
|
||||||
@current_events = @conference.program.events.current
|
|
||||||
@tweets = twitter_client.search_tweets(15, @conference.contact.social_tag)
|
@tweets = twitter_client.search_tweets(15, @conference.contact.social_tag)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html{render layout: 'conference_wide_screen'}
|
format.html{render layout: 'conference_info'}
|
||||||
format.js {render action: 'conference_wide_screen.js.haml'}
|
format.js {render action: 'conference_info.js.haml'}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ class Event < ActiveRecord::Base
|
||||||
scope :canceled, -> { where(state: 'canceled') }
|
scope :canceled, -> { where(state: 'canceled') }
|
||||||
scope :withdrawn, -> { where(state: 'withdrawn') }
|
scope :withdrawn, -> { where(state: 'withdrawn') }
|
||||||
scope :highlighted, -> { where(is_highlight: true) }
|
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_machine initial: :new do
|
||||||
state :new
|
state :new
|
||||||
|
|
@ -248,13 +247,6 @@ class Event < ActiveRecord::Base
|
||||||
event_schedules.find_by(schedule_id: program.selected_schedule_id).try(:start_time)
|
event_schedules.find_by(schedule_id: program.selected_schedule_id).try(:start_time)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
|
||||||
# Returns end of the event
|
|
||||||
#
|
|
||||||
def end_time
|
|
||||||
self.start_time + self.event_type.length.minutes
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -302,11 +294,4 @@ class Event < ActiveRecord::Base
|
||||||
def conference_id
|
def conference_id
|
||||||
program.conference_id
|
program.conference_id
|
||||||
end
|
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
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ class EventSchedule < ActiveRecord::Base
|
||||||
scope :confirmed, -> { joins(:event).where('state = ?', 'confirmed') }
|
scope :confirmed, -> { joins(:event).where('state = ?', 'confirmed') }
|
||||||
scope :canceled, -> { joins(:event).where('state = ?', 'canceled') }
|
scope :canceled, -> { joins(:event).where('state = ?', 'canceled') }
|
||||||
scope :withdrawn, -> { joins(:event).where('state = ?', 'withdrawn') }
|
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
|
delegate :guid, to: :room, prefix: true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
.row
|
.row
|
||||||
.col-md-12.text-center
|
.col-md-12.text-center
|
||||||
%h2 Current Events
|
%h2 Current Events
|
||||||
- @current_events.each do |event|
|
- @current_event_schedules.each do |es|
|
||||||
%div
|
%div
|
||||||
%h3
|
%h3
|
||||||
= event.title
|
= es.event.title
|
||||||
%h4
|
%h4
|
||||||
presented by
|
presented by
|
||||||
= event.speaker_names
|
= es.event.speaker_names
|
||||||
in
|
in
|
||||||
= event.room.name
|
= es.event.room.name
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
- if @conference.description.present?
|
- if @conference.description.present?
|
||||||
%h3
|
%h3
|
||||||
= @conference.description
|
= @conference.description
|
||||||
- if @current_events.present?
|
- if @current_event_schedules.present?
|
||||||
.row#current-events
|
.row#current-events
|
||||||
= render 'current_events'
|
= render 'current_events'
|
||||||
- if @conference.contact.social_tag.present? && @tweets.present?
|
- if @conference.contact.social_tag.present? && @tweets.any?
|
||||||
.row#conference-tweets
|
.row#conference-tweets
|
||||||
= render 'conference_tweets'
|
= render 'conference_tweets'
|
||||||
- if @sponsors.any?
|
- if @sponsors.any?
|
||||||
|
|
@ -138,7 +138,7 @@
|
||||||
Roles
|
Roles
|
||||||
|
|
||||||
- if can? :show, @conference
|
- if can? :show, @conference
|
||||||
%li{:class=> active_nav_li(conference_wide_screen_admin_conference_path(@conference.short_title))}
|
%li{:class=> active_nav_li(conference_info_admin_conference_path(@conference.short_title))}
|
||||||
= link_to(conference_wide_screen_admin_conference_path(@conference.short_title)) do
|
= link_to(conference_info_admin_conference_path(@conference.short_title)) do
|
||||||
%span.fa.fa-expand
|
%span.fa.fa-expand
|
||||||
Conference Wide Information
|
Conference Info
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ Osem::Application.routes.draw do
|
||||||
resources :comments, only: [:index]
|
resources :comments, only: [:index]
|
||||||
resources :conferences do
|
resources :conferences do
|
||||||
member do
|
member do
|
||||||
get :conference_wide_screen
|
get :conference_info
|
||||||
end
|
end
|
||||||
resource :contact, except: [:index, :new, :create, :show, :destroy]
|
resource :contact, except: [:index, :new, :create, :show, :destroy]
|
||||||
resources :schedules, only: [:index, :create, :show, :update, :destroy]
|
resources :schedules, only: [:index, :create, :show, :update, :destroy]
|
||||||
|
|
|
||||||
|
|
@ -20,5 +20,20 @@ FactoryGirl.define do
|
||||||
event_schedule.schedule = program.selected_schedule
|
event_schedule.schedule = program.selected_schedule
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
factory :current_event_schedule do
|
||||||
|
after(:build) do |event_schedule|
|
||||||
|
event_schedule.start_time = DateTime.current
|
||||||
|
end
|
||||||
|
end
|
||||||
|
factory :past_event_schedule do
|
||||||
|
after(:build) do |event_schedule|
|
||||||
|
event_schedule.start_time = (DateTime.current - 2.days).to_s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
factory :future_event_schedule do
|
||||||
|
after(:build) do |event_schedule|
|
||||||
|
event_schedule.start_time = (DateTime.current + 2.days).to_s
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -33,19 +33,6 @@ FactoryGirl.define do
|
||||||
event.event_schedules << build(:event_schedule, event: event)
|
event.event_schedules << build(:event_schedule, event: event)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :past_event do
|
|
||||||
after(:build) do |event|
|
|
||||||
event.start_time = (DateTime.current - 2.days).to_s
|
|
||||||
event.state = 'confirmed'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
factory :future_event do
|
|
||||||
after(:build) do |event|
|
|
||||||
event.start_time = (DateTime.current + 2.days).to_s
|
|
||||||
event.state = 'confirmed'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe EventSchedule do
|
describe EventSchedule do
|
||||||
|
subject { create(:event_schedule) }
|
||||||
|
let(:schedule) { create(:schedule) }
|
||||||
|
let(:program) { create(:program, selected_schedule: schedule) }
|
||||||
|
let!(:current_event_schedule) { create(:current_event_schedule, schedule: program.selected_schedule) }
|
||||||
|
let!(:past_event_schedule) { create(:past_event_schedule) }
|
||||||
|
let!(:future_event_schedule) { create(:future_event_schedule) }
|
||||||
|
|
||||||
describe 'association' do
|
describe 'association' do
|
||||||
it { should belong_to(:schedule) }
|
it { should belong_to(:schedule) }
|
||||||
|
|
@ -18,4 +24,12 @@ describe EventSchedule do
|
||||||
it { is_expected.to validate_presence_of(:room) }
|
it { is_expected.to validate_presence_of(:room) }
|
||||||
it { is_expected.to validate_presence_of(:start_time) }
|
it { is_expected.to validate_presence_of(:start_time) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'scope' do
|
||||||
|
context 'current' do
|
||||||
|
it 'returns only current events' do
|
||||||
|
expect(program.selected_schedule.event_schedules.current).to match_array([current_event_schedule])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -114,14 +114,6 @@ describe Event do
|
||||||
expect(conference.program.events.highlighted).to eq [my_event]
|
expect(conference.program.events.highlighted).to eq [my_event]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
context 'current' do
|
|
||||||
it 'returns only current events' do
|
|
||||||
current_event = create(:event, start_time: Time.current.to_s, state: 'confirmed', program: conference.program)
|
|
||||||
create(:past_event, program: conference.program)
|
|
||||||
create(:future_event, program: conference.program)
|
|
||||||
expect(conference.program.events.current).to match_array([current_event])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#scheduled?' do
|
describe '#scheduled?' do
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Schedule do
|
describe Schedule do
|
||||||
|
|
||||||
describe 'association' do
|
describe 'association' do
|
||||||
it { should belong_to(:program) }
|
it { should belong_to(:program) }
|
||||||
it { should have_many(:event_schedules).dependent(:destroy) }
|
it { should have_many(:event_schedules).dependent(:destroy) }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue