* Event page 'chrome' is setup and pulling from database--now to add band logic

This commit is contained in:
Seth Call 2014-03-09 22:58:57 +00:00
parent 23e5906e55
commit 3c5a14312a
19 changed files with 181 additions and 76 deletions

3
admin/app/admin/event.rb Normal file
View File

@ -0,0 +1,3 @@
ActiveAdmin.register JamRuby::Event, :as => 'Event' do
menu :parent => 'Events'
end

View File

@ -131,3 +131,4 @@ connection_client_type.sql
add_countries_regions_and_cities.sql
plays_refactor.sql
fix_max_mind_isp_and_geo.sql
events.sql

10
db/up/events.sql Normal file
View File

@ -0,0 +1,10 @@
CREATE TABLE events (
id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
slug VARCHAR(512) NOT NULL UNIQUE,
starts_at TIMESTAMP,
ends_at TIMESTAMP,
title TEXT,
description TEXT,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

View File

@ -99,6 +99,7 @@ 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/icecast_admin_authentication"
require "jam_ruby/models/icecast_directory"
require "jam_ruby/models/icecast_limit"

View File

@ -0,0 +1,11 @@
class JamRuby::Event < ActiveRecord::Base
attr_accessible :slug, :starts_at, :ends_at,
:'starts_at(1i)', :'starts_at(2i)', :'starts_at(3i)', :'starts_at(4i)', :'starts_at(5i)',
:'ends_at(1i)', :'ends_at(2i)', :'ends_at(3i)', :'ends_at(4i)', :'ends_at(5i)',
:title,
:description, as: :admin
validates :slug, uniqueness: true, presence: true
end

View File

@ -415,4 +415,11 @@ FactoryGirl.define do
factory :music_session_like, :class => JamRuby::MusicSessionLiker do
end
end
factory :event, :class => JamRuby::Event do
sequence(:slug) { |n| "slug-#{n}" }
title 'event title'
description 'event description'
end
end

View File

@ -0,0 +1,18 @@
require 'spec_helper'
describe Event do
before do
end
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
end

View File

@ -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');

View File

@ -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;
}
}

View File

@ -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;

View File

@ -0,0 +1,10 @@
class EventsController < ApplicationController
respond_to :html
def show
@event = Event.find_by_slug!(params[:slug])
render :layout => "web"
end
end

View File

@ -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")
]

View File

@ -0,0 +1,31 @@
- provide(:title, @event.title)
.landing-content
%h1 Virtual Jam Fest 2014
%p.w60
= @event.description
%br
%br
%h2 ARTIST LINEUP
%br
%br{clear:'all'}
.landing-sidebar
%br
%br
%div{align:'center'}
%span SPONSORED BY:
= image_tag 'content/logo_centurylink.png', width:320, height:80, class:'play-icon', alt:'CenturyLink logo'
%br
%br
%br
%br
%div{align: 'center'} LEARN ABOUT JAMKAZAM</div>
%br
= image_tag 'web/carousel_musicians.jpg', width:350, alt:'JamKazam Overview', class: 'video-slide',
:'data-video-header' => 'JamKazam Overview', :'data-video-url' => 'http://www.youtube.com/embed/ylYcvTY9CVo?autoplay=1'
%br{clear:'all'}

View File

@ -16,6 +16,7 @@
<meta name="twitter:description" content="<%= description_for_music_session_history(@music_session) %>" />
<% end %>
<div class="sessions-page">
<div class="landing-band">
<% unless @music_session.band.nil? %>
<div class="landing-avatar">
@ -79,6 +80,7 @@
<%= render :partial => "shared/track_details", :locals => {:tracks => @music_session.grouped_tracks} %>
</div>
<br clear="all" />
</div>
<% if signed_in? %>
<% unless @music_session.band.nil? %>

View File

@ -17,6 +17,7 @@
<meta name="twitter:description" content="<%= description_for_claimed_recording(@claimed_recording) %>" />
<% end %>
<div class="recordings-page">
<div class="landing-band">
<% unless @claimed_recording.recording.band.blank? %>
<div class="landing-avatar">
@ -89,7 +90,7 @@
<%= render :partial => "shared/track_details", :locals => {:tracks => @claimed_recording.recording.grouped_tracks} %>
</div>
<br clear="all" />
</div>
<% if signed_in? %>
<% unless @claimed_recording.recording.band.nil? %>
<%= render :partial => "shared/landing_sidebar", :locals => {:user => @claimed_recording.recording.band, :recent_history => @claimed_recording.recording.band.recent_history} %>
@ -114,47 +115,6 @@
$(function () {
var showRecording = new JK.ShowRecording(JK.app);
showRecording.initialize("<%= @claimed_recording.id %>", "<%= @claimed_recording.recording_id %>");
$("#recordingDuration").html(formatTime("<%= @claimed_recording.recording.duration %>"));
// remainder of this code is related to playing/pausing the recording
var htmlAudio = $(".recording-controls").find('audio').get(0);
var $imgPlayPauseSelector = $("#imgPlayPause");
var playButtonPath = '/assets/content/icon_playbutton.png';
var pauseButtonPath = '/assets/content/icon_pausebutton.png';
var durationInitialized = false;
function formatTime(time) {
var minutes = Math.floor(time / 60);
var seconds = Math.floor(time % 60);
return minutes.toString() + ":" + (seconds > 9 ? seconds.toString() : '0' + seconds.toString());
}
// this sets the slider to the appropriate position and updates the current play time
$(htmlAudio).on('timeupdate', function() {
var percentComplete = (htmlAudio.currentTime / htmlAudio.duration) * 100;
$(".recording-slider").css({'left': percentComplete + '%'});
$(".recording-current").html(formatTime(htmlAudio.currentTime));
// reset icon to play and slider to far left when done
if (percentComplete === 100) {
$imgPlayPauseSelector.attr('src', playButtonPath);
$(".recording-slider").css({'left': 0 + '%'});
$(".recording-current").html("0:00");
}
});
$("#btnPlayPause").click(function() {
if (htmlAudio.paused) {
htmlAudio.play();
$imgPlayPauseSelector.attr('src', pauseButtonPath);
}
else {
htmlAudio.pause();
$imgPlayPauseSelector.attr('src', playButtonPath);
}
});
});
</script>
<% end %>

View File

@ -4,7 +4,7 @@
<a href="/signin">Already have an account?</a>
</div>
<br /><br />
<%= image_tag "web/carousel_musicians.jpg", {:width => 350, :alt => ""} %><br /><br />
<%= image_tag "web/carousel_musicians.jpg", {:width => 350, :alt => "", :class => 'video-slide', :'data-video-header' => 'JamKazam Overview', :'data-video-url' => 'http://www.youtube.com/embed/ylYcvTY9CVo?autoplay=1'} %><br /><br />
<%= image_tag "web/carousel_fans.jpg", {:width => 350, :alt => ""} %><br /><br />
<%= image_tag "web/carousel_bands.jpg", {:width => 350, :alt => ""} %>
</div>

View File

@ -1,11 +1,13 @@
<% provide(:title, 'Congratulations') %>
<div class="tagline">Congratulations!</div>
<div class="congratulations">
<div class="tagline">Congratulations!</div>
<p>You have successfully registered as a JamKazam fan.</p>
<p>You have successfully registered as a JamKazam fan.</p>
<div class="proceed"><%= link_to "PROCEED TO JAMKAZAM SITE", client_path, :class =>"button-orange m0" %></div>
<div class="proceed"><%= link_to "PROCEED TO JAMKAZAM SITE", client_path, :class =>"button-orange m0" %></div>
</div>
<script type="text/javascript">
window.congratulations.initialize(false, jQuery.QueryString["type"]);
</script>

View File

@ -1,9 +1,11 @@
<% provide(:title, 'Congratulations') %>
<% if @nativeClient %>
<div class="tagline">Congratulations!</div>
<p>You have successfully registered as a musician.</p>
<div class="proceed"><%= link_to "PROCEED TO JAMKAZAM SITE", client_path, :class =>"button-orange m0" %></div>
<div class="congratulations">
<div class="tagline">Congratulations!</div>
<p>You have successfully registered as a musician.</p>
<div class="proceed"><%= link_to "PROCEED TO JAMKAZAM SITE", client_path, :class =>"button-orange m0" %></div>
</div>
<% else %>
<%= render "users/downloads" %>
<% end %>

View File

@ -60,8 +60,9 @@ SampleApp::Application.routes.draw do
match '/gmail_contacts', to: 'gmail#gmail_contacts'
match '/events/:slug', to: 'events#show', :via => :get
# temporarily allow for debugging
# temporarily allow for debugging--only allows admini n
match '/listen_in', to: 'spikes#listen_in'
# embed resque-web if this is development mode