twitter gem and a partial added to embed tweets about a conference and new layout added for conference info screen
This commit is contained in:
parent
febd3451ad
commit
f29a15b8e4
11 changed files with 216 additions and 28 deletions
3
Gemfile
3
Gemfile
|
|
@ -183,9 +183,10 @@ gem 'dotenv-rails'
|
||||||
gem 'faker'
|
gem 'faker'
|
||||||
# for seeds
|
# for seeds
|
||||||
gem 'factory_girl_rails'
|
gem 'factory_girl_rails'
|
||||||
|
|
||||||
# for integrating Stripe payment gateway
|
# for integrating Stripe payment gateway
|
||||||
gem 'stripe'
|
gem 'stripe'
|
||||||
|
#For embedding tweets
|
||||||
|
gem 'twitter'
|
||||||
|
|
||||||
# Use guard and spring for testing in development
|
# Use guard and spring for testing in development
|
||||||
group :development do
|
group :development do
|
||||||
|
|
|
||||||
25
Gemfile.lock
25
Gemfile.lock
|
|
@ -82,6 +82,7 @@ GEM
|
||||||
bootstrap3-datetimepicker-rails (3.0.3)
|
bootstrap3-datetimepicker-rails (3.0.3)
|
||||||
momentjs-rails (>= 2.8.1)
|
momentjs-rails (>= 2.8.1)
|
||||||
browser (0.6.0)
|
browser (0.6.0)
|
||||||
|
buftok (0.2.0)
|
||||||
builder (3.2.2)
|
builder (3.2.2)
|
||||||
byebug (3.1.2)
|
byebug (3.1.2)
|
||||||
columnize (~> 0.8)
|
columnize (~> 0.8)
|
||||||
|
|
@ -167,6 +168,7 @@ GEM
|
||||||
dotenv-rails (2.1.1)
|
dotenv-rails (2.1.1)
|
||||||
dotenv (= 2.1.1)
|
dotenv (= 2.1.1)
|
||||||
railties (>= 4.0, < 5.1)
|
railties (>= 4.0, < 5.1)
|
||||||
|
equalizer (0.0.10)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (2.6.0)
|
execjs (2.6.0)
|
||||||
factory_girl (4.5.0)
|
factory_girl (4.5.0)
|
||||||
|
|
@ -214,8 +216,15 @@ GEM
|
||||||
activesupport
|
activesupport
|
||||||
builder
|
builder
|
||||||
htmlentities (4.3.4)
|
htmlentities (4.3.4)
|
||||||
|
http (1.0.4)
|
||||||
|
addressable (~> 2.3)
|
||||||
|
http-cookie (~> 1.0)
|
||||||
|
http-form_data (~> 1.0.1)
|
||||||
|
http_parser.rb (~> 0.6.0)
|
||||||
http-cookie (1.0.2)
|
http-cookie (1.0.2)
|
||||||
domain_name (~> 0.5)
|
domain_name (~> 0.5)
|
||||||
|
http-form_data (1.0.1)
|
||||||
|
http_parser.rb (0.6.0)
|
||||||
i18n (0.7.0)
|
i18n (0.7.0)
|
||||||
i18n_data (0.7.0)
|
i18n_data (0.7.0)
|
||||||
inversion (0.12.3)
|
inversion (0.12.3)
|
||||||
|
|
@ -253,6 +262,8 @@ GEM
|
||||||
lumberjack (1.0.5)
|
lumberjack (1.0.5)
|
||||||
mail (2.6.3)
|
mail (2.6.3)
|
||||||
mime-types (>= 1.16, < 3)
|
mime-types (>= 1.16, < 3)
|
||||||
|
memoizable (0.4.2)
|
||||||
|
thread_safe (~> 0.3, >= 0.3.1)
|
||||||
method_source (0.8.2)
|
method_source (0.8.2)
|
||||||
mime-types (2.99.1)
|
mime-types (2.99.1)
|
||||||
mina (0.3.8)
|
mina (0.3.8)
|
||||||
|
|
@ -277,6 +288,7 @@ GEM
|
||||||
multi_xml (0.5.5)
|
multi_xml (0.5.5)
|
||||||
multipart-post (2.0.0)
|
multipart-post (2.0.0)
|
||||||
mysql2 (0.4.2)
|
mysql2 (0.4.2)
|
||||||
|
naught (1.1.0)
|
||||||
netrc (0.11.0)
|
netrc (0.11.0)
|
||||||
nio4r (1.2.1)
|
nio4r (1.2.1)
|
||||||
nokogiri (1.6.8)
|
nokogiri (1.6.8)
|
||||||
|
|
@ -462,6 +474,7 @@ GEM
|
||||||
sprockets-rails (~> 2.0)
|
sprockets-rails (~> 2.0)
|
||||||
shoulda-matchers (2.6.1)
|
shoulda-matchers (2.6.1)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
|
simple_oauth (0.3.1)
|
||||||
simplecov (0.11.2)
|
simplecov (0.11.2)
|
||||||
docile (~> 1.1.0)
|
docile (~> 1.1.0)
|
||||||
json (~> 1.8)
|
json (~> 1.8)
|
||||||
|
|
@ -502,6 +515,17 @@ GEM
|
||||||
ttfunk (1.1.1)
|
ttfunk (1.1.1)
|
||||||
turbolinks (2.5.3)
|
turbolinks (2.5.3)
|
||||||
coffee-rails
|
coffee-rails
|
||||||
|
twitter (5.16.0)
|
||||||
|
addressable (~> 2.3)
|
||||||
|
buftok (~> 0.2.0)
|
||||||
|
equalizer (= 0.0.10)
|
||||||
|
faraday (~> 0.9.0)
|
||||||
|
http (~> 1.0)
|
||||||
|
http_parser.rb (~> 0.6.0)
|
||||||
|
json (~> 1.8)
|
||||||
|
memoizable (~> 0.4.0)
|
||||||
|
naught (~> 1.0)
|
||||||
|
simple_oauth (~> 0.3.0)
|
||||||
tzinfo (1.2.2)
|
tzinfo (1.2.2)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
uglifier (3.0.0)
|
uglifier (3.0.0)
|
||||||
|
|
@ -630,6 +654,7 @@ DEPENDENCIES
|
||||||
timecop
|
timecop
|
||||||
transitions
|
transitions
|
||||||
turbolinks
|
turbolinks
|
||||||
|
twitter
|
||||||
uglifier (>= 1.3.0)
|
uglifier (>= 1.3.0)
|
||||||
unobtrusive_flash (>= 3)
|
unobtrusive_flash (>= 3)
|
||||||
web-console (~> 2.0)
|
web-console (~> 2.0)
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
*= require osem-schedule-print
|
*= require osem-schedule-print
|
||||||
*= require osem-dashboard
|
*= require osem-dashboard
|
||||||
*= require osem-splash
|
*= require osem-splash
|
||||||
|
*= require osem-conference-wide-screen
|
||||||
*= require font-awesome
|
*= require font-awesome
|
||||||
*= require osem-fonts
|
*= require osem-fonts
|
||||||
*= require bootstrap-markdown
|
*= require bootstrap-markdown
|
||||||
|
|
|
||||||
77
app/assets/stylesheets/osem-conference-wide-screen.css.scss
Normal file
77
app/assets/stylesheets/osem-conference-wide-screen.css.scss
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -179,14 +179,19 @@ module Admin
|
||||||
@sponsors = @conference.sponsors
|
@sponsors = @conference.sponsors
|
||||||
@program = @conference.program
|
@program = @conference.program
|
||||||
@current_events = @conference.program.events.confirmed.select{ |event| event.is_current?}
|
@current_events = @conference.program.events.confirmed.select{ |event| event.is_current?}
|
||||||
|
@tweets = twitter_client.search_tweets(3, @conference.contact.social_tag)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html{render layout: "conference_wide_screen"}
|
||||||
format.js {render :action=>"conference_wide_screen.js.haml"}
|
format.js {render :action=> "conference_wide_screen.js.haml"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
# To create a twitter client
|
||||||
|
def twitter_client
|
||||||
|
@twitter_client ||= TwitterWrapper.new
|
||||||
|
end
|
||||||
|
|
||||||
def conference_params
|
def conference_params
|
||||||
params.require(:conference).permit(:title, :short_title, :description, :timezone,
|
params.require(:conference).permit(:title, :short_title, :description, :timezone,
|
||||||
|
|
|
||||||
25
app/models/twitter_wrapper.rb
Normal file
25
app/models/twitter_wrapper.rb
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
class TwitterWrapper
|
||||||
|
attr_accessor :client
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
@client = Twitter::REST::Client.new do |config|
|
||||||
|
config.consumer_key = ENV["OSEM_TWITTER_CONSUMER_KEY"]
|
||||||
|
config.consumer_secret = ENV["OSEM_TWITTER_CONSUMER_SECRET"]
|
||||||
|
config.access_token = ENV["OSEM_TWITTER_ACCESS_TOKEN"]
|
||||||
|
config.access_token_secret = ENV["OSEM_TWITTER_ACCESS_TOKEN_SECRET"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
#Fetches tweets from twitter api based on search_term and no_of_tweets
|
||||||
|
#
|
||||||
|
def search_tweets(no_of_tweets, search_term)
|
||||||
|
begin
|
||||||
|
@client.search(search_term, result_type: "recent").take(no_of_tweets).collect
|
||||||
|
rescue Twitter::Error::TooManyRequests => error
|
||||||
|
sleep error.rate_limit.reset_in + 1
|
||||||
|
retry
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
8
app/views/admin/conference/_conference_tweets.html.haml
Normal file
8
app/views/admin/conference/_conference_tweets.html.haml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
.container
|
||||||
|
.row
|
||||||
|
.col-md-12.text-center
|
||||||
|
%h2 Conference Tweets
|
||||||
|
- @tweets.each do |tweet|
|
||||||
|
%div#tweet
|
||||||
|
= tweet.user.name
|
||||||
|
= tweet.text
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
.text-center
|
.container
|
||||||
%h2 Upcoming Events
|
.row
|
||||||
- @current_events.each do |event|
|
.col-md-12.text-center
|
||||||
%div
|
%h2 Current Events
|
||||||
%h3
|
- @current_events.each do |event|
|
||||||
= link_to event.title, conference_program_proposal_path(@conference.short_title, event.id)
|
%div
|
||||||
%h4
|
%h3
|
||||||
presented by
|
= event.title
|
||||||
= event.speaker_names
|
%h4
|
||||||
|
presented by
|
||||||
|
= event.speaker_names
|
||||||
|
in
|
||||||
|
= event.room.name
|
||||||
|
|
|
||||||
11
app/views/admin/conference/_sponsors.html.haml
Normal file
11
app/views/admin/conference/_sponsors.html.haml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
.container
|
||||||
|
.row
|
||||||
|
.col-md-12.text-center
|
||||||
|
%h2 Sponsors
|
||||||
|
- @conference.sponsorship_levels.each do |sponsorship_level|
|
||||||
|
-if sponsorship_level.sponsors.any?
|
||||||
|
- sponsorship_level.sponsors.each_slice(3) do |slice|
|
||||||
|
.row.row-centered
|
||||||
|
- 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}"
|
||||||
|
|
@ -1,15 +1,21 @@
|
||||||
.container
|
#main-display
|
||||||
- if @conference.present?
|
- if @conference.present?
|
||||||
.row
|
%section#main-heading
|
||||||
.col-md-12
|
.container
|
||||||
- if @program.present?
|
.row
|
||||||
%section#program#current-events
|
.col-md-12.text-center
|
||||||
= render 'current_events'
|
%h1
|
||||||
.row
|
= @conference.title
|
||||||
.col-md-12.text-center
|
- if @conference.description.present?
|
||||||
%h2 Tweets About Conference
|
%h3
|
||||||
.row
|
= @conference.description
|
||||||
.col-md-12
|
- if @program.present?
|
||||||
- if @sponsors.any?
|
%section#event-display
|
||||||
%section#sponsors
|
= render 'current_events'
|
||||||
= render 'conference/sponsors'
|
- if @conference.contact.social_tag.present?
|
||||||
|
%section#tweets-display
|
||||||
|
- if @tweets.present?
|
||||||
|
= render 'conference_tweets'
|
||||||
|
- if @sponsors.any?
|
||||||
|
%section#sponsor-display
|
||||||
|
= render 'sponsors'
|
||||||
|
|
|
||||||
25
app/views/layouts/conference_wide_screen.html.haml
Normal file
25
app/views/layouts/conference_wide_screen.html.haml
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
%html{:xmlns => "http://www.w3.org/1999/html"}
|
||||||
|
%head
|
||||||
|
%meta{:charset => "utf-8"}
|
||||||
|
%meta{:name => "viewport", :content => "width=device-width, initial-scale=1, maximum-scale=1"}
|
||||||
|
%title= content_for?(:title) ? yield(:title) : (ENV['OSEM_NAME'] || 'OSEM')
|
||||||
|
%meta{:content => "", :name => "description"}
|
||||||
|
%meta{:content => "", :name => "author"}
|
||||||
|
= stylesheet_link_tag "application", :media => "all"
|
||||||
|
= javascript_include_tag "application"
|
||||||
|
|
||||||
|
= csrf_meta_tags
|
||||||
|
:javascript
|
||||||
|
window.liveSettings = {
|
||||||
|
api_key: "#{ENV['OSEM_TRANSIFEX_APIKEY']}",
|
||||||
|
picker: "bottom-right",
|
||||||
|
detectlang: true,
|
||||||
|
autocollect: true
|
||||||
|
};
|
||||||
|
= content_for(:script_head)
|
||||||
|
= javascript_include_tag "//cdn.transifex.com/live.js"
|
||||||
|
|
||||||
|
= yield(:head)
|
||||||
|
%body
|
||||||
|
.container
|
||||||
|
= yield
|
||||||
Loading…
Add table
Add a link
Reference in a new issue