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
|
|
@ -8,6 +8,7 @@
|
|||
*= require osem-schedule-print
|
||||
*= require osem-dashboard
|
||||
*= require osem-splash
|
||||
*= require osem-conference-wide-screen
|
||||
*= require font-awesome
|
||||
*= require osem-fonts
|
||||
*= 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
|
||||
@program = @conference.program
|
||||
@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|
|
||||
format.html
|
||||
format.js {render :action=>"conference_wide_screen.js.haml"}
|
||||
format.html{render layout: "conference_wide_screen"}
|
||||
format.js {render :action=> "conference_wide_screen.js.haml"}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# To create a twitter client
|
||||
def twitter_client
|
||||
@twitter_client ||= TwitterWrapper.new
|
||||
end
|
||||
|
||||
def conference_params
|
||||
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
|
||||
%h2 Upcoming Events
|
||||
- @current_events.each do |event|
|
||||
%div
|
||||
%h3
|
||||
= link_to event.title, conference_program_proposal_path(@conference.short_title, event.id)
|
||||
%h4
|
||||
presented by
|
||||
= event.speaker_names
|
||||
.container
|
||||
.row
|
||||
.col-md-12.text-center
|
||||
%h2 Current Events
|
||||
- @current_events.each do |event|
|
||||
%div
|
||||
%h3
|
||||
= event.title
|
||||
%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
|
||||
- if @conference.present?
|
||||
.row
|
||||
.col-md-12
|
||||
- if @program.present?
|
||||
%section#program#current-events
|
||||
= render 'current_events'
|
||||
.row
|
||||
.col-md-12.text-center
|
||||
%h2 Tweets About Conference
|
||||
.row
|
||||
.col-md-12
|
||||
- if @sponsors.any?
|
||||
%section#sponsors
|
||||
= render 'conference/sponsors'
|
||||
#main-display
|
||||
- if @conference.present?
|
||||
%section#main-heading
|
||||
.container
|
||||
.row
|
||||
.col-md-12.text-center
|
||||
%h1
|
||||
= @conference.title
|
||||
- if @conference.description.present?
|
||||
%h3
|
||||
= @conference.description
|
||||
- if @program.present?
|
||||
%section#event-display
|
||||
= render 'current_events'
|
||||
- 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