method added to autocycle through sponsors based on sponsor level and code added to inherit twitter env variables
This commit is contained in:
parent
881518f1f3
commit
e8d3177ec1
14 changed files with 89 additions and 163 deletions
|
|
@ -52,16 +52,15 @@ There are a couple of environment variables you can set to configure OSEM.
|
|||
| CLOUDINARY_URL | *string* | Configure your cloudinary.com cloud name and api key/secret
|
||||
| STRIPE_PUBLISHABLE_KEY | *string* | Publishable Key for Stripe Gateway
|
||||
| STRIPE_SECRET_KEY | *string* | Secret Key for Stripe Gateway
|
||||
| OSEM_TWITTER_CONSUMER_KEY | *string* | To embed tweets about the conference in the conference wide page
|
||||
| OSEM_TWITTER_CONSUMER_SECRET | *string* | To embed tweets about the conference in the conference wide page
|
||||
| OSEM_TWITTER_ACCESS_TOKEN | *string* | To embed tweets about the conference in the conference wide page
|
||||
| OSEM_TWITTER_ACCESS_TOKEN_SECRET | *string* | To embed tweets about the conference in the conference wide page
|
||||
|
||||
### Online Ticket Payments
|
||||
We use [Stripe](https://stripe.com) for accepting your ticket payments securely over the web.
|
||||
Our application uses iFrame for accepting your user's payment details without storing them, making the application PCI SAQ-A Compliant.
|
||||
Please refer to [PAYMENTS](PAYMENTS.md) documentation file for setting up your stripe account and start accepting payments from your users.
|
||||
| CLOUDINARY_URL | *string* | Configure your cloudinary.com cloud name and api key/secret
|
||||
| OSEM_TWITTER_CONSUMER_KEY | *string* | To embed tweets about the conference in the conference wide page
|
||||
| OSEM_TWITTER_CONSUMER_SECRET | *string* | To embed tweets about the conference in the conference wide page
|
||||
| OSEM_TWITTER_ACCESS_TOKEN | *string* | To embed tweets about the conference in the conference wide page
|
||||
| OSEM_TWITTER_ACCESS_TOKEN_SECRET | *string* | To embed tweets about the conference in the conference wide page
|
||||
|
||||
## Dependencies
|
||||
|
||||
|
|
|
|||
12
app.json
12
app.json
|
|
@ -59,6 +59,18 @@
|
|||
},
|
||||
"RAILS_ENV": {
|
||||
"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": {
|
||||
|
|
|
|||
|
|
@ -1,21 +1,32 @@
|
|||
$(document).ready(function() {
|
||||
// will call refreshCurrentEvents every 15 minutes
|
||||
setInterval(refreshCurrentEvents, 900000)
|
||||
// To cycle through tweets
|
||||
var tweets = $('div[id^="tweet"]').hide();
|
||||
var i = 0;
|
||||
setInterval(refreshCurrentEvents,900000);
|
||||
|
||||
(function cycle() {
|
||||
tweets.eq(i).show(0)
|
||||
.delay(5000)
|
||||
.hide(0, cycle);
|
||||
i = ++i % tweets.length;
|
||||
})();
|
||||
// Only show the first child of tweet and sponsor containers on page load
|
||||
$('#tweet-container').children().hide();
|
||||
$('#tweet-container').children().eq(0).show();
|
||||
$('#sponsor-container').children().hide();
|
||||
$('#sponsor-container').children().eq(0).show();
|
||||
|
||||
});
|
||||
setInterval(function(){ cycleVisibleElement($('#tweet-container'))}, 5000)
|
||||
setInterval(function(){ cycleVisibleElement($('#sponsor-container'))}, 10000)
|
||||
});
|
||||
|
||||
// Makes an ajax call for fresh data
|
||||
function refreshCurrentEvents(){
|
||||
$.ajax({
|
||||
url: "conference_wide_screen.js"
|
||||
});
|
||||
};
|
||||
|
||||
// Cycle through children in a container and toggles visibility
|
||||
function cycleVisibleElement(container){
|
||||
var childrens = $(container).children();
|
||||
for(var i = 0; i < childrens.length; i++ ){
|
||||
if(childrens.eq(i).is(":visible")){
|
||||
childrens.eq(i).hide();
|
||||
childrens.eq(++i % childrens.length).show();
|
||||
return
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
*= require osem-schedule-print
|
||||
*= require osem-dashboard
|
||||
*= require osem-splash
|
||||
*= require osem-conference-wide-screen
|
||||
*= require font-awesome
|
||||
*= require osem-fonts
|
||||
*= require bootstrap-markdown
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
@import "breakpoints.css.scss";
|
||||
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
/* Margin bottom by 2 times the footer height */
|
||||
// margin-bottom: 60px;
|
||||
/* Margin bottom by navbar height */
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
#main-display {
|
||||
// Counter the general padding for #content
|
||||
// margin-bottom: -60px;
|
||||
section {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#main-heading {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 120px;
|
||||
background-color: #abcdef;
|
||||
}
|
||||
|
||||
|
||||
#event-display{
|
||||
position: absolute;
|
||||
bottom:480px;
|
||||
width: 100%;
|
||||
top: 120px;
|
||||
background-color: #00FF00;
|
||||
}
|
||||
#tweets-display {
|
||||
position: absolute;
|
||||
height: 150px;
|
||||
bottom: 330px;
|
||||
width: 100%;
|
||||
background-color: #F63;
|
||||
}
|
||||
|
||||
#sponsor-display {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
max-height: 330px;
|
||||
background-color: #FF1493;
|
||||
.container {
|
||||
background-color: yellow;
|
||||
max-height: 310px;
|
||||
}
|
||||
|
||||
.img-sponsor {
|
||||
max-height: 50px;
|
||||
margin: 2% auto;
|
||||
}
|
||||
.img-sponsor-1 {
|
||||
max-height: 90px;
|
||||
}
|
||||
.img-sponsor-2 {
|
||||
max-height: 70px;
|
||||
}
|
||||
.img-sponsor-3 {
|
||||
max-height: 50px;
|
||||
}
|
||||
@include breakpoint(xs) {
|
||||
.img-sponsor, .img-sponsor-1, .img-sponsor-3, .img-sponsor-3{
|
||||
max-height: unset;
|
||||
max-width: 280px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -175,10 +175,9 @@ module Admin
|
|||
|
||||
def conference_wide_screen
|
||||
# To display sponsors in the conference wide information page
|
||||
@conference = Conference.find_by(short_title: params[:id])
|
||||
@sponsors = @conference.sponsors
|
||||
@program = @conference.program
|
||||
@current_events = @conference.program.events.confirmed.select(&:current?)
|
||||
@current_events = @conference.program.events.current
|
||||
@tweets = twitter_client.search_tweets(15, @conference.contact.social_tag)
|
||||
|
||||
respond_to do |format|
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ 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,10 +249,10 @@ class Event < ActiveRecord::Base
|
|||
end
|
||||
|
||||
##
|
||||
# Compares event start_time, end_with with current time to predict current events
|
||||
# Returns end of the event
|
||||
#
|
||||
def current?
|
||||
Time.current >= self.start_time && Time.current <= self.end_time
|
||||
def end_time
|
||||
self.start_time + self.event_type.length.minutes
|
||||
end
|
||||
|
||||
private
|
||||
|
|
@ -308,5 +309,4 @@ class Event < ActiveRecord::Base
|
|||
def current?
|
||||
Time.current >= self.start_time && Time.current <= self.end_time
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
.container
|
||||
.row
|
||||
.col-md-12.text-center
|
||||
%h2 Conference Tweets
|
||||
%h2
|
||||
= "#" + @conference.contact.social_tag + " Tweets"
|
||||
%div#tweet-container
|
||||
- @tweets.each do |tweet|
|
||||
%div#tweet
|
||||
= tweet.user.name
|
||||
%blockquote.twitter-tweet
|
||||
%p{:lang => "en"}
|
||||
= tweet.text
|
||||
= link_to "— @" + tweet.user.name, "http://www.twitter.com/#{tweet.user.name}", target: "_blank"
|
||||
= link_to tweet.url, tweet.url.to_s
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@
|
|||
.row
|
||||
.col-md-12.text-center
|
||||
%h2 Sponsors
|
||||
%div#sponsor-container
|
||||
- @conference.sponsorship_levels.each do |sponsorship_level|
|
||||
-if sponsorship_level.sponsors.any?
|
||||
- sponsorship_level.sponsors.each_slice(3) do |slice|
|
||||
.row.row-centered
|
||||
.row.row-centered#sponsor
|
||||
- slice.each do |sponsor|
|
||||
.col-md-4.col-sm-4.col-centered.col-top
|
||||
= image_tag get_logo(sponsor), class: "img-responsive img-sponsor img-sponsor-#{sponsorship_level.position}"
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
- if @conference.description.present?
|
||||
%h3
|
||||
= @conference.description
|
||||
- if @program.present?
|
||||
.row
|
||||
- if @current_events.present?
|
||||
.row#current-events
|
||||
= render 'current_events'
|
||||
- if @conference.contact.social_tag.present? && @tweets.present?
|
||||
.row
|
||||
.row#conference-tweets
|
||||
= render 'conference_tweets'
|
||||
- if @sponsors.any?
|
||||
= render 'sponsors'
|
||||
|
|
|
|||
|
|
@ -1 +1,4 @@
|
|||
$('#current-events').html("#{escape_javascript(render 'current_events', data: @current_events)}");
|
||||
$('#conference-tweets').html("#{escape_javascript(render 'conference_tweets', data: @tweets)}");
|
||||
$('#tweet-container').children().hide();
|
||||
$('#tweet-container').children().eq(0).show();
|
||||
|
|
|
|||
|
|
@ -165,18 +165,6 @@ describe Admin::ConferencesController do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'GET #conference_wide_screen' 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 conference_wide_screen page' do
|
||||
get :conference_wide_screen, id: conference.short_title
|
||||
expect(response).to render_template :conference_wide_screen
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #index' do
|
||||
context 'with more than 0 conferences' do
|
||||
it 'populates an array with conferences' do
|
||||
|
|
@ -292,18 +280,6 @@ describe Admin::ConferencesController do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #conference_wide_screen' do
|
||||
it 'requires organizer privileges' do
|
||||
get :conference_wide_screen, id: conference.short_title,
|
||||
conference: attributes_for(:conference,
|
||||
short_title: 'ExCon')
|
||||
expect(response).to redirect_to(send(path))
|
||||
if message
|
||||
expect(flash[:alert]).to match(/#{message}/)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'participant access' do
|
||||
|
|
|
|||
|
|
@ -33,6 +33,19 @@ FactoryGirl.define do
|
|||
event.event_schedules << build(:event_schedule, event: event)
|
||||
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
|
||||
|
|
|
|||
|
|
@ -114,6 +114,14 @@ describe Event do
|
|||
expect(conference.program.events.highlighted).to eq [my_event]
|
||||
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
|
||||
|
||||
describe '#scheduled?' do
|
||||
|
|
@ -327,28 +335,4 @@ describe Event do
|
|||
expect(other_event.week).to eq 48
|
||||
end
|
||||
end
|
||||
|
||||
describe 'current?' do
|
||||
let(:past_event) { create(:event, program: conference.program) }
|
||||
let(:future_event) { create(:event, program: conference.program) }
|
||||
|
||||
before do
|
||||
event.update_attributes(start_time: Time.current.to_s)
|
||||
past_event.update_attributes(start_time: (Time.current - 2.days).to_s)
|
||||
future_event.update_attributes(start_time: (Time.current + 2.days).to_s)
|
||||
end
|
||||
|
||||
it 'returns false for a completed event' do
|
||||
expect(past_event.current?).to be_falsey
|
||||
end
|
||||
|
||||
it 'returns false for a future event' do
|
||||
expect(future_event.current?).to be_falsey
|
||||
end
|
||||
|
||||
it 'returns true for a current event' do
|
||||
expect(event.current?).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue