diff --git a/admin/app/admin/event.rb b/admin/app/admin/event.rb new file mode 100644 index 000000000..186592d30 --- /dev/null +++ b/admin/app/admin/event.rb @@ -0,0 +1,3 @@ +ActiveAdmin.register JamRuby::Event, :as => 'Event' do + menu :parent => 'Events' +end diff --git a/admin/app/admin/event_session.rb b/admin/app/admin/event_session.rb new file mode 100644 index 000000000..df540716d --- /dev/null +++ b/admin/app/admin/event_session.rb @@ -0,0 +1,3 @@ +ActiveAdmin.register JamRuby::EventSession, :as => 'Event Session' do + menu :parent => 'Events' +end diff --git a/db/manifest b/db/manifest index 20a1a3da6..243cb4fc0 100755 --- a/db/manifest +++ b/db/manifest @@ -133,3 +133,4 @@ plays_refactor.sql fix_max_mind_isp_and_geo.sql update_get_work_for_client_type.sql bands_did_session.sql +events.sql diff --git a/db/up/events.sql b/db/up/events.sql new file mode 100644 index 000000000..c2992c07b --- /dev/null +++ b/db/up/events.sql @@ -0,0 +1,24 @@ +CREATE TABLE events ( + id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(), + slug VARCHAR(512) NOT NULL UNIQUE, + title TEXT, + description TEXT, + show_sponser BOOLEAN NOT NULL DEFAULT false, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE event_sessions ( + id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(), + starts_at TIMESTAMP, + ends_at TIMESTAMP, + pinned_state VARCHAR(255), + img_url VARCHAR(1024), + img_width INTEGER, + img_height INTEGER, + event_id VARCHAR(64) REFERENCES events(id) ON DELETE CASCADE, + user_id VARCHAR(64) REFERENCES users(id) ON DELETE SET NULL, + band_id VARCHAR(64) REFERENCES bands(id) ON DELETE SET NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); \ No newline at end of file diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index 9d2c59552..debb6925a 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -100,6 +100,8 @@ require "jam_ruby/models/claimed_recording" require "jam_ruby/models/crash_dump" require "jam_ruby/models/isp_score_batch" require "jam_ruby/models/promotional" +require "jam_ruby/models/event" +require "jam_ruby/models/event_session" require "jam_ruby/models/icecast_admin_authentication" require "jam_ruby/models/icecast_directory" require "jam_ruby/models/icecast_limit" diff --git a/ruby/lib/jam_ruby/models/band.rb b/ruby/lib/jam_ruby/models/band.rb index 214491eef..210753784 100644 --- a/ruby/lib/jam_ruby/models/band.rb +++ b/ruby/lib/jam_ruby/models/band.rb @@ -47,6 +47,9 @@ module JamRuby has_many :music_sessions, :class_name => "JamRuby::MusicSession", :foreign_key => "band_id" has_many :music_session_history, :class_name => "JamRuby::MusicSessionHistory", :foreign_key => "band_id", :inverse_of => :band + # events + has_many :event_sessions, :class_name => "JamRuby::EventSession" + include Geokit::ActsAsMappable::Glue unless defined?(acts_as_mappable) acts_as_mappable diff --git a/ruby/lib/jam_ruby/models/event.rb b/ruby/lib/jam_ruby/models/event.rb new file mode 100644 index 000000000..c21e655ab --- /dev/null +++ b/ruby/lib/jam_ruby/models/event.rb @@ -0,0 +1,9 @@ +class JamRuby::Event < ActiveRecord::Base + + attr_accessible :slug, :title, :description, :show_sponser, as: :admin + + validates :slug, uniqueness: true, presence: true + validates :show_sponser, :inclusion => {:in => [true, false]} + + has_many :event_sessions, class_name: 'JamRuby::EventSession' +end diff --git a/ruby/lib/jam_ruby/models/event_session.rb b/ruby/lib/jam_ruby/models/event_session.rb new file mode 100644 index 000000000..7385de68d --- /dev/null +++ b/ruby/lib/jam_ruby/models/event_session.rb @@ -0,0 +1,28 @@ +class JamRuby::EventSession < ActiveRecord::Base + + attr_accessible :event_id, :user_id, :band_id, :starts_at, :ends_at, :pinned_state, :position, :img_url, :img_width, :img_height, as: :admin + + belongs_to :user, class_name: 'JamRuby::User' + belongs_to :band, class_name: 'JamRuby::Band' + belongs_to :event + + + validates :event, presence: true + validates :pinned_state, :inclusion => {:in => [nil, 'not_started', 'over']} + validate :one_of_user_band + + before_validation :sanitize_active_admin + + def sanitize_active_admin + self.img_url = nil if self.img_url == '' + self.user_id = nil if self.user_id == '' + self.band_id = nil if self.band_id == '' + self.pinned_state = nil if self.pinned_state == '' + end + + def one_of_user_band + if band && user + errors.add(:user, 'specify band, or user. not both') + end + end +end diff --git a/ruby/lib/jam_ruby/models/jam_isp.rb b/ruby/lib/jam_ruby/models/jam_isp.rb index e4e77b9e0..dd0de86f3 100644 --- a/ruby/lib/jam_ruby/models/jam_isp.rb +++ b/ruby/lib/jam_ruby/models/jam_isp.rb @@ -45,7 +45,7 @@ module JamRuby # startIpNum,endIpNum,isp self.transaction do - GeoIpIsp.delete_all + self.connection.execute "delete from #{GEOIPISP_TABLE}" File.open(file, 'r:ISO-8859-1') do |io| #s = io.gets.strip # eat the copyright line. gah, why do they have that in their file?? #unless s.eql? 'Copyright (c) 2012 MaxMind LLC. All Rights Reserved.' diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index a619f864a..17e4ed46b 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -94,6 +94,9 @@ module JamRuby # crash dumps has_many :crash_dumps, :foreign_key => "user_id", :class_name => "JamRuby::CrashDump" + # events + has_many :event_sessions, :class_name => "JamRuby::EventSession" + # This causes the authenticate method to be generated (among other stuff) #has_secure_password diff --git a/ruby/spec/factories.rb b/ruby/spec/factories.rb index 4a9b70b8e..0db11878c 100644 --- a/ruby/spec/factories.rb +++ b/ruby/spec/factories.rb @@ -415,4 +415,13 @@ FactoryGirl.define do factory :music_session_like, :class => JamRuby::MusicSessionLiker do end + + factory :event, :class => JamRuby::Event do + sequence(:slug) { |n| "slug-#{n}" } + title 'event title' + description 'event description' + end + + factory :event_session, :class => JamRuby::EventSession do + end end diff --git a/ruby/spec/jam_ruby/models/event_session_spec.rb b/ruby/spec/jam_ruby/models/event_session_spec.rb new file mode 100644 index 000000000..947370e86 --- /dev/null +++ b/ruby/spec/jam_ruby/models/event_session_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe EventSession do + + it "should be creatable" do + event = FactoryGirl.create(:event) + event_session = FactoryGirl.create(:event_session, event: event) + end + + it "requires a parent event" do + event_session = FactoryGirl.build(:event_session) + event_session.save.should be_false + event_session.errors[:event].should == ["can't be blank"] + end + + it "can't specify both band and user" do + user = FactoryGirl.create(:user) + band = FactoryGirl.create(:band) + event = FactoryGirl.create(:event) + event_session = FactoryGirl.build(:event_session, event: event, user: user, band:band) + event_session.save.should be_false + event_session.errors[:user].should == ["specify band, or user. not both"] + end + +end + diff --git a/ruby/spec/jam_ruby/models/event_spec.rb b/ruby/spec/jam_ruby/models/event_spec.rb new file mode 100644 index 000000000..93a8629a2 --- /dev/null +++ b/ruby/spec/jam_ruby/models/event_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe Event do + + it "should be creatable" do + FactoryGirl.create(:event) + end + + it "should not have duplicate slugs" do + event1 = FactoryGirl.create(:event) + dup = FactoryGirl.build(:event, slug: event1.slug) + dup.save.should be_false + dup.errors[:slug].should == ["has already been taken"] + end + + it "can have associated event session, then destroy it by destroying event" do + event = FactoryGirl.create(:event) + event_session = FactoryGirl.create(:event_session, event: event) + event.reload + event.event_sessions.length.should == 1 + event_session.event.should == event + event.destroy + EventSession.find_by_id(event_session.id).should be_nil + end +end diff --git a/ruby/spec/jam_ruby/models/feed_spec.rb b/ruby/spec/jam_ruby/models/feed_spec.rb index b61596fc9..750cbd2f4 100644 --- a/ruby/spec/jam_ruby/models/feed_spec.rb +++ b/ruby/spec/jam_ruby/models/feed_spec.rb @@ -158,8 +158,8 @@ describe Feed do # creates both recording and history record in feed claimed_recording1 = FactoryGirl.create(:claimed_recording) - # move the feed entry created for the recording back more than a months ago - claimed_recording1.recording.feed.created_at = 25.hours.ago + # move the feed entry created for the recording back more than a day ago + claimed_recording1.recording.feed.created_at = 48.hours.ago claimed_recording1.recording.feed.save! feeds, start = Feed.index(user1, :type => 'recording', time_range: 'today') diff --git a/web/app/assets/images/content/logo_centurylink.png b/web/app/assets/images/content/logo_centurylink.png new file mode 100644 index 000000000..57f2deb03 Binary files /dev/null and b/web/app/assets/images/content/logo_centurylink.png differ diff --git a/web/app/assets/images/event/landing_band_amycook.png b/web/app/assets/images/event/landing_band_amycook.png new file mode 100644 index 000000000..cc4a57e2c Binary files /dev/null and b/web/app/assets/images/event/landing_band_amycook.png differ diff --git a/web/app/assets/images/event/landing_band_ginachavez.png b/web/app/assets/images/event/landing_band_ginachavez.png new file mode 100644 index 000000000..943c51094 Binary files /dev/null and b/web/app/assets/images/event/landing_band_ginachavez.png differ diff --git a/web/app/assets/images/event/landing_band_jgreene.png b/web/app/assets/images/event/landing_band_jgreene.png new file mode 100644 index 000000000..ff76418c0 Binary files /dev/null and b/web/app/assets/images/event/landing_band_jgreene.png differ diff --git a/web/app/assets/images/event/landing_band_jonnytwobags.png b/web/app/assets/images/event/landing_band_jonnytwobags.png new file mode 100644 index 000000000..9112866f2 Binary files /dev/null and b/web/app/assets/images/event/landing_band_jonnytwobags.png differ diff --git a/web/app/assets/images/event/landing_band_mingofishtrap.png b/web/app/assets/images/event/landing_band_mingofishtrap.png new file mode 100644 index 000000000..fc4e117c6 Binary files /dev/null and b/web/app/assets/images/event/landing_band_mingofishtrap.png differ diff --git a/web/app/assets/images/event/landing_band_residualkid.png b/web/app/assets/images/event/landing_band_residualkid.png new file mode 100644 index 000000000..c295fa07c Binary files /dev/null and b/web/app/assets/images/event/landing_band_residualkid.png differ diff --git a/web/app/assets/javascripts/feed.js b/web/app/assets/javascripts/feed.js new file mode 100644 index 000000000..8baa2b36f --- /dev/null +++ b/web/app/assets/javascripts/feed.js @@ -0,0 +1,32 @@ +(function(context,$) { + + "use strict"; + context.JK = context.JK || {}; + context.JK.FeedScreen = function(app) { + + var logger = context.JK.logger; + var rest = context.JK.Rest(); + + function beforeShow(data) { + + } + + function afterShow(data) { + + } + + + function initialize() { + var screenBindings = { + 'beforeShow': beforeShow, + 'afterShow': afterShow + }; + app.bindScreen('feed', screenBindings); + + } + + this.initialize = initialize; + + return this; + } +})(window,jQuery); \ No newline at end of file diff --git a/web/app/assets/javascripts/shareDialog.js b/web/app/assets/javascripts/shareDialog.js index 7ef6e2978..aacf3ae6d 100644 --- a/web/app/assets/javascripts/shareDialog.js +++ b/web/app/assets/javascripts/shareDialog.js @@ -106,7 +106,8 @@ description: data.description, caption: data.caption, name: data.title, - picture: data.photo_url + picture: data.photo_url, + link: data.url }) .done(function(response) { checkShareCheckbox('facebook', false); @@ -163,7 +164,8 @@ description: data.description, caption: data.caption, name: data.title, - picture: data.photo_url + picture: data.photo_url, + link: data.url }) .done(function(response) { checkShareCheckbox('facebook', false); diff --git a/web/app/assets/javascripts/tickDuration.js b/web/app/assets/javascripts/tickDuration.js index 5d267f77b..107336220 100644 --- a/web/app/assets/javascripts/tickDuration.js +++ b/web/app/assets/javascripts/tickDuration.js @@ -8,7 +8,7 @@ $.each($(customSelector ? customSelector : '.inprogress .tick-duration'), function(index, item) { var $duration = $(item); var createdAt = new Date(Number($duration.attr('data-created-at')) * 1000) - var millisElapsed = (new Date()).getTime() - createdAt.getTime(); + var millisElapsed = (context.JK.nowUTC().getTime() - createdAt.getTime()); $duration.text(context.JK.prettyPrintSeconds( parseInt(millisElapsed / 1000))); }); }, 333); diff --git a/web/app/assets/javascripts/utils.js b/web/app/assets/javascripts/utils.js index 306f54249..1c358145d 100644 --- a/web/app/assets/javascripts/utils.js +++ b/web/app/assets/javascripts/utils.js @@ -718,6 +718,10 @@ return deviceId; } + context.JK.nowUTC = function() { + var d = new Date(); + return new Date( d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds() ); + } /* * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message * Digest Algorithm, as defined in RFC 1321. diff --git a/web/app/assets/javascripts/web/videoDialog.js b/web/app/assets/javascripts/web/videoDialog.js index 3a11c7479..9f59fa8bc 100644 --- a/web/app/assets/javascripts/web/videoDialog.js +++ b/web/app/assets/javascripts/web/videoDialog.js @@ -9,27 +9,27 @@ var rest = context.JK.Rest(); var dialogId = '#video-dialog'; + function videoClick(e) { + var $self = $(this); + if (!context.jamClient || !context.jamClient.IsNativeClient()) { + + $('#video-dialog-header').html($self.data('video-header') || $self.attr('data-video-header')); + $('#video-dialog-iframe').attr('src', $self.data('video-url') || $self.atr('data-video-url')); + app.layout.showDialog('video-dialog'); + e.stopPropagation(); + e.preventDefault(); + return false; + } + else { + var videoUrl = $.param.querystring(window.location.href, 'showVideo=' + encodeURIComponent($self.data('video-url'))); + console.log("videoUrl: ", videoUrl); + context.jamClient.OpenSystemBrowser(videoUrl); + } + } + function events() { - $('.carousel .slides').on('click', '.slideItem', function (e) { - - var $self = $(this); - if (!context.jamClient || !context.jamClient.IsNativeClient()) { - - $('#video-dialog-header').html($self.data('video-header')); - $('#video-dialog-iframe').attr('src', $self.data('video-url')); - app.layout.showDialog('video-dialog'); - e.stopPropagation(); - e.preventDefault(); - return false; - } - else { - - - var videoUrl = $.param.querystring(window.location.href, 'showVideo=' + encodeURIComponent($self.data('video-url'))); - console.log("videoUrl: ", videoUrl); - context.jamClient.OpenSystemBrowser(videoUrl); - } - }) + $('.carousel .slides').on('click', '.slideItem', videoClick); + $('.video-slide').on('click', videoClick); $(dialogId + '-close').click(function (e) { app.layout.closeDialog('video-dialog'); diff --git a/web/app/assets/stylesheets/client/jamkazam.css.scss b/web/app/assets/stylesheets/client/jamkazam.css.scss index 1eadb6116..4dfd51558 100644 --- a/web/app/assets/stylesheets/client/jamkazam.css.scss +++ b/web/app/assets/stylesheets/client/jamkazam.css.scss @@ -518,3 +518,10 @@ div[layout-id=session], div[layout-id=ftue], .no-selection-range { margin:0 10px 0 3px; } } + +hr { + background-color: #999999; + border: 0 none; + height: 1px; + margin: 10px 0; +} diff --git a/web/app/assets/stylesheets/corp/corporate.css.scss.erb b/web/app/assets/stylesheets/corp/corporate.css.scss.erb index c4f69802d..a492f717c 100644 --- a/web/app/assets/stylesheets/corp/corporate.css.scss.erb +++ b/web/app/assets/stylesheets/corp/corporate.css.scss.erb @@ -16,8 +16,12 @@ float:left; } -span.testimonial-user-desc { - font-style: italic !important; + +ul.quote { + li { + font-style: italic !important; + color: white !important; + } } span.press-date { @@ -113,6 +117,10 @@ body.corporate ul { padding-left:20px; margin-bottom:20px; list-style:disc outside none; + + li { + padding-bottom: 10px; + } } .wrapper { diff --git a/web/app/assets/stylesheets/web/events.css.scss b/web/app/assets/stylesheets/web/events.css.scss new file mode 100644 index 000000000..3f0ba5cbb --- /dev/null +++ b/web/app/assets/stylesheets/web/events.css.scss @@ -0,0 +1,25 @@ +.landing-band.event { + +} +.landing-details.event { + .time { + margin-bottom:30px; + } + + .bio { + line-height:16px; + margin-bottom:20px; + } + + .session-button { + img.listen-now-play { + vertical-align: top; + padding-right:7px; + } + } +} +.landing-sidebar { + .sponsor { + margin-bottom:50px; + } +} \ No newline at end of file diff --git a/web/app/assets/stylesheets/web/main.css.scss b/web/app/assets/stylesheets/web/main.css.scss index 0b4e29340..c680de296 100644 --- a/web/app/assets/stylesheets/web/main.css.scss +++ b/web/app/assets/stylesheets/web/main.css.scss @@ -52,6 +52,7 @@ body.web { color:#ed3718; font-size:26px; font-weight:300; + line-height:30px; } } @@ -68,18 +69,48 @@ body.web { width:100%; min-height: 366px; position:relative; - padding-top:15px; padding-bottom:30px; + p { + color:#CCC; + line-height:150%; + } + .welcome { padding-top: 30px; } + .wrapper h1 { + position:relative; + padding-top:15px; + color:#ed3718 !important; + font-weight:normal; + font-size:40px; + } + + .wrapper h2 { + font-weight:300; + } + h2 { font-size:24px; color:#ccc; font-weight:200; } + + .button-orange, .button-grey { + display:inline-block; + height: 20px; + line-height:20px; + margin-bottom:10px; + margin-right:0px; + } + + .button-grey:hover { + cursor:default; + background-color:#666; + color:#ccc; + } } .landing-sidebar { @@ -217,10 +248,17 @@ body.web { p, ul { color:#999; line-height:160%; - margin-bottom:20px; width:90%; white-space:normal; + } + + ul { font-size:16px; + margin-bottom:20px; + } + + p { + font-size:14px; } h2 { @@ -383,6 +421,14 @@ body.web { padding-left:40px; } } + + .congratulations { + padding-top:1px; + } + + .recordings-page, .sessions-page { + padding-top:15px; + } } diff --git a/web/app/assets/stylesheets/web/web.css b/web/app/assets/stylesheets/web/web.css index 67fb3c22a..d060ec21b 100644 --- a/web/app/assets/stylesheets/web/web.css +++ b/web/app/assets/stylesheets/web/web.css @@ -18,5 +18,6 @@ *= require web/recordings *= require web/welcome #= require web/sessions +*= require web/events *= require users/signinDialog */ \ No newline at end of file diff --git a/web/app/assets/stylesheets/web/welcome.css.scss b/web/app/assets/stylesheets/web/welcome.css.scss index 9f18a0e5c..80b10babf 100644 --- a/web/app/assets/stylesheets/web/welcome.css.scss +++ b/web/app/assets/stylesheets/web/welcome.css.scss @@ -81,7 +81,7 @@ Version: 1.1 { display:none; position :relative ; - margin :30px auto 0; + margin :15px auto 0; width :auto; height :auto; border :none; diff --git a/web/app/controllers/api_users_controller.rb b/web/app/controllers/api_users_controller.rb index 0a3bec6ec..36861a7b5 100644 --- a/web/app/controllers/api_users_controller.rb +++ b/web/app/controllers/api_users_controller.rb @@ -531,6 +531,7 @@ class ApiUsersController < ApiController description: view_context.description_for_music_session_history(history), title: view_context.title_for_music_session_history(history, current_user), photo_url: view_context.facebook_image_for_music_session_history(history), + url: share_token_url(history.share_token.token), caption: 'www.jamkazam.com' }, status: 200 @@ -557,6 +558,7 @@ class ApiUsersController < ApiController description: view_context.description_for_claimed_recording(claimed_recording), title: view_context.title_for_claimed_recording(claimed_recording, current_user), photo_url: view_context.facebook_image_for_claimed_recording(claimed_recording), + url: share_token_url(claimed_recording.share_token.token), caption: 'www.jamkazam.com' }, status: 200 diff --git a/web/app/controllers/events_controller.rb b/web/app/controllers/events_controller.rb new file mode 100644 index 000000000..71b5288fb --- /dev/null +++ b/web/app/controllers/events_controller.rb @@ -0,0 +1,10 @@ +class EventsController < ApplicationController + + respond_to :html + + def show + @event = Event.find_by_slug!(params[:slug]) + render 'event', :layout => "web" + end + +end \ No newline at end of file diff --git a/web/app/controllers/users_controller.rb b/web/app/controllers/users_controller.rb index 33b4ace7f..92aa2c9b0 100644 --- a/web/app/controllers/users_controller.rb +++ b/web/app/controllers/users_controller.rb @@ -198,10 +198,10 @@ class UsersController < ApplicationController def welcome @slides = [ - Slide.new("JamKazam Overview", "web/carousel_musicians.jpg", "http://www.youtube.com/embed/eaYNM7p6Z5s"), + Slide.new("JamKazam Overview", "web/carousel_musicians.jpg", "http://www.youtube.com/embed/ylYcvTY9CVo?autoplay=1"), Slide.new("Getting Started", "web/carousel_fans.jpg", "http://www.youtube.com/embed/eaYNM7p6Z5s"), Slide.new("Playing in a Session", "web/carousel_bands.jpg", "http://www.youtube.com/embed/eaYNM7p6Z5s"), - Slide.new("JamKazam Overview", "web/carousel_musicians.jpg", "http://www.youtube.com/embed/eaYNM7p6Z5s"), + Slide.new("JamKazam Overview", "web/carousel_musicians.jpg", "http://www.youtube.com/embed/ylYcvTY9CVo?autoplay=1"), Slide.new("Getting Started", "web/carousel_fans.jpg", "http://www.youtube.com/embed/eaYNM7p6Z5s"), Slide.new("Playing in a Session", "web/carousel_bands.jpg", "http://www.youtube.com/embed/eaYNM7p6Z5s") ] diff --git a/web/app/helpers/avatar_helper.rb b/web/app/helpers/avatar_helper.rb index 13107ca17..ce7a7632b 100644 --- a/web/app/helpers/avatar_helper.rb +++ b/web/app/helpers/avatar_helper.rb @@ -22,11 +22,15 @@ module AvatarHelper end end - def resolve_avatarables(*avatarables) + def resolve_avatarables(*avatarables, allow_none: false) avatarables.each do |avatarable| return resolve_avatarable(avatarable) if avatarable end - raise "at least one avatarable must be specified" + if allow_none + nil + else + raise "at least one avatarable must be specified" + end end end \ No newline at end of file diff --git a/web/app/helpers/event_session_helper.rb b/web/app/helpers/event_session_helper.rb new file mode 100644 index 000000000..2e9fb3f1d --- /dev/null +++ b/web/app/helpers/event_session_helper.rb @@ -0,0 +1,101 @@ +module EventSessionHelper + + def event_session_img(event_session) + + # need to figure out img, width, height + + # prefer the session URL if specified; otherwise use the band/user + url = nil + width = nil + height = nil + + if event_session.img_url + url = image_path(event_session.img_url) + else + url = resolve_avatarables(event_session.band, event_session.user, allow_none: true) + url = image_path(url) if url + end + + if url + width = event_session.img_width + height = event_session.img_height + else + url = image_path('web/logo-256.png') + width = 115 + end + + content_tag(:img, nil, src: url, width: width, height: height) + end + + def event_session_title(event_session) + return event_session.band.name if event_session.band + return event_session.user.name if event_session.user + 'TBD' + end + + def event_session_start_hour(event_session) + return 'TBD' unless event_session.starts_at + timezone = ActiveSupport::TimeZone.new('Central Time (US & Canada)') + timezone.at(event_session.starts_at.to_i).strftime('%l:%M %P') + end + + def fetch_last_session(event_session) + # if no pinned state, then we try to find if there is a session currently on going during the specified time range + # if so, then we are playing. + # if there has been none, we say it's still coming, + # if there has been at least one, and it's over, we say session over + query = MusicSessionHistory.where(fan_access: true).where(created_at: (event_session.starts_at - 12.hours)..(event_session.ends_at + 12.hours)) + if event_session.user_id + query = query.where(user_id: event_session.user_id) + elsif event_session.band_id + query = query.where(band_id: event_session.band_id) + else + raise 'invalid state in event_session_button' + end + + query.order('created_at DESC').first + end + + def event_session_button(event_session) + + state = nil # can be :not_started, :over, :playing + state = event_session.pinned_state if event_session.pinned_state + if state + + music_session_history = fetch_last_session(event_session) + + elsif !state && (event_session.starts_at && event_session.ends_at && (event_session.user_id || event_session.band_id)) + + music_session_history = fetch_last_session(event_session) + + if music_session_history + if music_session_history.session_removed_at + state = 'over' + else + state = 'playing' + end + else + state = 'not_started' + end + end + + if state == 'over' + content_tag(:a, 'SESSION ENDED', href: music_session_history.nil? ? '#' : music_session_detail_path(music_session_history.id), class: 'button-grey') + elsif state == 'playing' + content_tag(:a, '', href: music_session_detail_path(music_session_history.id), class: 'button-orange') do + content_tag(:span, image_tag('content/icon_playbutton.png', :width => 20, height: 20, align: 'absmiddle', class:'listen-now-play') + 'LISTEN NOW') + end + elsif state == 'not_started' + nil + else + nil + end + + end + + def event_session_description(event_session) + return event_session.band.biography if event_session.band + return event_session.user.biography if event_session.user + '' + end +end diff --git a/web/app/views/clients/_feed.html.erb b/web/app/views/clients/_feed.html.erb deleted file mode 100644 index 329be60dc..000000000 --- a/web/app/views/clients/_feed.html.erb +++ /dev/null @@ -1,49 +0,0 @@ - -<%= content_tag(:div, :layout => 'screen', 'layout-id' => 'feed', :class => "screen secondary") do -%> - <%= content_tag(:div, :class => :content) do -%> - <%= content_tag(:div, :class => 'content-head') do -%> - <%= content_tag(:div, image_tag("content/icon_feed.png", {:height => 19, :width => 19}), :class => 'content-icon') %> - <%= content_tag(:h1, 'feed') %> - <%= render "screen_navigation" %> - <% end -%> - <%= content_tag(:div, :class => 'content-body') do -%> - <%= form_tag('', {:id => 'find-session-form', :class => 'inner-content'}) do -%> - <%= render(:partial => "web_filter", :locals => {:search_type => Search::PARAM_FEED}) %> - <%= content_tag(:div, :class => 'filter-body') do %> - <%= content_tag(:div, :class => 'content-body-scroller') do -%> -

This feature not yet implemented

- <%= content_tag(:div, content_tag(:div, '', :id => 'session-filter-results', :class => 'filter-results'), :class => 'content-wrapper') %> - <% end -%> - <% end -%> - <% end -%> - <% end -%> - <% end -%> -<% end -%> - - - diff --git a/web/app/views/clients/_feed.html.haml b/web/app/views/clients/_feed.html.haml new file mode 100644 index 000000000..002770ef3 --- /dev/null +++ b/web/app/views/clients/_feed.html.haml @@ -0,0 +1,13 @@ +%div{ layout: 'screen', :'layout-id' => 'feed', :class => 'screen secondary'} + .content + .content-head + .content-icon= image_tag("content/icon_feed.png", {:height => 19, :width => 19}) + %h1 feed + = render "screen_navigation" + .content-body + = form_tag('', {:id => 'find-session-form', :class => 'inner-content'}) do + = render(:partial => "web_filter", :locals => {:search_type => Search::PARAM_FEED}) + .filter-body + .content-body-scroller + %p This feature not yet implemented + .content-wrapper diff --git a/web/app/views/clients/index.html.erb b/web/app/views/clients/index.html.erb index 7bdc683e5..21e359063 100644 --- a/web/app/views/clients/index.html.erb +++ b/web/app/views/clients/index.html.erb @@ -184,6 +184,9 @@ var bandSetupPhotoScreen = new JK.BandSetupPhotoScreen(JK.app); bandSetupPhotoScreen.initialize(); + var feedScreen = new JK.FeedScreen(JK.app); + feedScreen.initialize(); + var findSessionScreen = new JK.FindSessionScreen(JK.app); var sessionLatency = null; if ("jamClient" in window) { diff --git a/web/app/views/corps/testimonials.html.erb b/web/app/views/corps/testimonials.html.erb index f6ecaf0ff..e0cb9caa1 100644 --- a/web/app/views/corps/testimonials.html.erb +++ b/web/app/views/corps/testimonials.html.erb @@ -3,13 +3,15 @@

Testimonials

+
+

JULIE BONK

- Julie is a well-respected and oft-recorded pianist and teacher in jazz and blues improvisation, composition, and theory, and has mentored students including Grammy winner Norah Jones.
-