* adding helper scripts

This commit is contained in:
Seth Call 2013-09-25 15:34:53 +00:00
parent d3fee152e1
commit 34ccc3a540
25 changed files with 456 additions and 243 deletions

5
runweb Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
pushd web
bundle exec rails s
popd

41
update Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
set -e
echo ""
echo "building database"
echo ""
pushd db
./build
popd
echo ""
echo "building protocol buffers"
echo ""
pushd pb
./build
popd
echo ""
echo "updating database"
echo ""
pushd ruby
./migrate.sh
popd
echo ""
echo "updating web"
echo ""
pushd web
bundle update
popd
echo ""
echo "updating admin"
echo ""
pushd admin
bundle update
popd
echo ""
echo "SUCCESS"

View File

@ -294,101 +294,15 @@
});
$('#btn-email-invitation').click(function() {
$('#invitation-textarea-container').show();
$('#invitation-checkbox-container').hide();
$('#btn-send-invitation').show();
$('#btn-next-invitation').hide();
invitationDialog.showDialog();
invitationDialog.showEmailDialog();
});
$('#btn-gmail-invitation').click(function() {
$('#invitation-textarea-container').hide();
$('#invitation-checkbox-container').show();
$('#btn-send-invitation').hide();
$('#btn-next-invitation').show();
invitationDialog.showDialog();
$('#invitation-checkboxes').html('<div style="text-align: center; margin-top: 100px;">Loading your contacts...</div>');
window._oauth_callback = function() {
window._oauth_win.close();
window._oauth_win = null;
window._oauth_callback = null;
$.ajax({
type: "GET",
url: "/gmail_contacts",
success: function(response) {
$('#invitation-checkboxes').html('');
for (var i in response) {
$('#invitation-checkboxes').append("<label><input type='checkbox' class='invitation-checkbox' data-email='" + response[i] + "' /> " + response[i] + "</label>");
}
$('.invitation-checkbox').change(function() {
var checkedBoxes = $('.invitation-checkbox:checkbox:checked');
var emails = '';
for (var i = 0; i < checkedBoxes.length; i++) {
emails += $(checkedBoxes[i]).data('email') + ', ';
}
emails = emails.replace(/, $/, '');
// track how many of these came from google
$('#txt-emails').val(emails).data('google_invite_count', checkedBoxes.length);
});
},
error: function() {
$('#invitation-checkboxes').html("Load failed");
}
});
};
window._oauth_win = window.open("/auth/google_login", "_blank", "height=500,width=500,menubar=no,resizable=no,status=no");
invitationDialog.showGoogleDialog();
});
$('#btn-facebook-invitation').click(function() {
/*
$('#invitation-textarea-container').hide();
$('#invitation-checkbox-container').show();
$('#btn-send-invitation').hide();
$('#btn-next-invitation').show();
invitationDialog.showDialog();
$('#invitation-checkboxes').html('<div style="text-align: center; margin-top: 100px;">Loading your contacts...</div>');
*/
window._oauth_callback = function() {
window._oauth_win.close();
window._oauth_win = null;
window._oauth_callback = null;
/*
$.ajax({
type: "GET",
url: "/gmail_contacts",
success: function(response) {
$('#invitation-checkboxes').html('');
for (var i in response) {
$('#invitation-checkboxes').append("<label><input type='checkbox' class='invitation-checkbox' data-email='" + response[i] + "' /> " + response[i] + "</label>");
}
$('.invitation-checkbox').change(function() {
var checkedBoxes = $('.invitation-checkbox:checkbox:checked');
var emails = '';
for (var i = 0; i < checkedBoxes.length; i++) {
emails += $(checkedBoxes[i]).data('email') + ', ';
}
emails = emails.replace(/, $/, '');
$('#txt-emails').val(emails);
});
},
error: function() {
$('#invitation-checkboxes').html("Load failed");
}
});
*/
};
window._oauth_win = window.open("/auth/facebook_login", "_blank", "height=500,width=500,menubar=no,resizable=no,status=no");
});
$('#btn-next-invitation').click(function() {
$('#invitation-textarea-container').show();
$('#invitation-checkbox-container').hide();
$('#btn-send-invitation').show();
$('#btn-next-invitation').hide();
invitationDialog.showFacebookDialog();
});
// friend input focus

View File

@ -17,6 +17,7 @@
var instrumentIds = [];
var instrumentNames = [];
var instrumentPopularities = {}; // id -> popularity
var invitationDialog = new context.JK.InvitationDialog(app);
function loadInstruments() {
// TODO: This won't work in the long-term. We'll need to provide
@ -95,10 +96,26 @@
$('body').on('click', 'div[layout="header"] h1', function() {
context.location = '#/home';
});
$('.userinfo').on('click', function() {
$('ul', this).toggle();
$('ul.shortcuts', this).toggle();
return false;
});
$('.userinfo .invite-friends .menuheader').on('click', function(e) {
$(this).closest('li').css('height', 'auto').find('ul').toggle();
e.stopPropagation();
return false;
});
$('.invite-friends .google-invite a').on('click', function(e) {
invitationDialog.showGoogleDialog();
});
$('.invite-friends .email-invite a').on('click', function(e) {
invitationDialog.showEmailDialog();
})
$('#account-identity-form').submit(handleIdentitySubmit);
$('#account-profile-form').submit(handleProfileSubmit);
// Remove added instruments when 'X' is clicked
@ -204,6 +221,7 @@
events();
loadInstruments();
loadMe();
invitationDialog.initialize();
//searcher = new context.JK.Searcher(app);

View File

@ -1,54 +0,0 @@
(function(context,$) {
"use strict";
context.JK = context.JK || {};
context.JK.InvitationDialog = function(app) {
var logger = context.JK.logger;
var rest = context.JK.Rest();
function events() {
$('#btn-send-invitation').click(sendEmail);
}
function trackGA(emails, googleInviteCount) {
var allInvitations = emails.length; // all email invites, regardless of how they got in the form
var emailInvitations = allInvitations - (googleInviteCount ? googleInviteCount : 0); // take out google invites
context.JK.GA.trackServiceInvitations(context.JK.GA.InvitationTypes.email, emailInvitations);
if (googleInviteCount) {
context.JK.GA.trackServiceInvitations(context.JK.GA.InvitationTypes.google, googleInviteCount);
}
}
function sendEmail() {
var emails = [];
emails = $('#txt-emails').val().split(',');
for (var i=0; i < emails.length; i++) {
rest.createInvitation($.trim(emails[i]), $('#txt-message').val())
.done(function() {
});
}
trackGA(emails, $('#txt-emails').data('google_invite_count'));
}
this.showDialog = function() {
clearTextFields();
}
function clearTextFields() {
$('#txt-emails').val('').removeData('google_invite_count');
$('#txt-message').val('');
}
this.initialize = function() {
events();
};
}
return this;
})(window,jQuery);

View File

@ -0,0 +1,177 @@
(function(context,$) {
"use strict";
context.JK = context.JK || {};
context.JK.InvitationDialog = function(app) {
var logger = context.JK.logger;
var rest = context.JK.Rest();
function trackMetrics(emails, googleInviteCount) {
var allInvitations = emails.length; // all email invites, regardless of how they got in the form
var emailInvitations = allInvitations - (googleInviteCount ? googleInviteCount : 0); // take out google invites
context.JK.GA.trackServiceInvitations(context.JK.GA.InvitationTypes.email, emailInvitations);
if (googleInviteCount) {
context.JK.GA.trackServiceInvitations(context.JK.GA.InvitationTypes.google, googleInviteCount);
}
}
function registerEvents(onOff) {
if(onOff) {
$('#btn-send-invitation').on('click', sendEmail);
$('#btn-next-invitation').on('click', clickNext);
}
else {
$('#btn-send-invitation').off('click', sendEmail);
$('#btn-next-invitation').off('click', clickNext);
}
}
function sendEmail() {
var emails = [];
emails = $('#txt-emails').val().split(',');
for (var i=0; i < emails.length; i++) {
rest.createInvitation($.trim(emails[i]), $('#txt-message').val())
.done(function() {
});
}
trackMetrics(emails, $('#txt-emails').data('google_invite_count'));
}
function clickNext() {
$('#invitation-textarea-container').show();
$('#invitation-checkbox-container').hide();
$('#btn-send-invitation').show();
$('#btn-next-invitation').hide();
}
function showEmailDialog() {
$('#invitation-dialog').show();
$('#invitation-textarea-container').show();
$('#invitation-checkbox-container').hide();
$('#btn-send-invitation').show();
$('#btn-next-invitation').hide();
clearTextFields();
app.layout.showDialog('inviteUsers')
}
function showGoogleDialog() {
$('#invitation-dialog').show();
$('#invitation-textarea-container').hide();
$('#invitation-checkbox-container').show();
$('#btn-send-invitation').hide();
$('#btn-next-invitation').show();
clearTextFields();
app.layout.showDialog('inviteUsers')
$('#invitation-checkboxes').html('<div style="text-align: center; margin-top: 100px;">Loading your contacts...</div>');
window._oauth_callback = function() {
window._oauth_win.close();
window._oauth_win = null;
window._oauth_callback = null;
$.ajax({
type: "GET",
url: "/gmail_contacts",
success: function(response) {
$('#invitation-checkboxes').html('');
for (var i in response) {
$('#invitation-checkboxes').append("<label><input type='checkbox' class='invitation-checkbox' data-email='" + response[i] + "' /> " + response[i] + "</label>");
}
$('.invitation-checkbox').change(function() {
var checkedBoxes = $('.invitation-checkbox:checkbox:checked');
var emails = '';
for (var i = 0; i < checkedBoxes.length; i++) {
emails += $(checkedBoxes[i]).data('email') + ', ';
}
emails = emails.replace(/, $/, '');
// track how many of these came from google
$('#txt-emails').val(emails).data('google_invite_count', checkedBoxes.length);
});
},
error: function() {
$('#invitation-checkboxes').html("Load failed");
}
});
};
window._oauth_win = window.open("/auth/google_login", "_blank", "height=500,width=500,menubar=no,resizable=no,status=no");
}
function showFacebookDialog() {
/*
$('#invitation-textarea-container').hide();
$('#invitation-checkbox-container').show();
$('#btn-send-invitation').hide();
$('#btn-next-invitation').show();
invitationDialog.showDialog();
$('#invitation-checkboxes').html('<div style="text-align: center; margin-top: 100px;">Loading your contacts...</div>');
*/
window._oauth_callback = function() {
window._oauth_win.close();
window._oauth_win = null;
window._oauth_callback = null;
/*
$.ajax({
type: "GET",
url: "/gmail_contacts",
success: function(response) {
$('#invitation-checkboxes').html('');
for (var i in response) {
$('#invitation-checkboxes').append("<label><input type='checkbox' class='invitation-checkbox' data-email='" + response[i] + "' /> " + response[i] + "</label>");
}
$('.invitation-checkbox').change(function() {
var checkedBoxes = $('.invitation-checkbox:checkbox:checked');
var emails = '';
for (var i = 0; i < checkedBoxes.length; i++) {
emails += $(checkedBoxes[i]).data('email') + ', ';
}
emails = emails.replace(/, $/, '');
$('#txt-emails').val(emails);
});
},
error: function() {
$('#invitation-checkboxes').html("Load failed");
}
});
*/
};
window._oauth_win = window.open("/auth/facebook_login", "_blank", "height=500,width=500,menubar=no,resizable=no,status=no");
}
function clearTextFields() {
$('#txt-emails').val('').removeData('google_invite_count');
$('#txt-message').val('');
}
function beforeShow() {
registerEvents(true);
}
function afterHide() {
registerEvents(false);
}
function initialize(){
var dialogBindings = {
'beforeShow' : beforeShow,
'afterHide': afterHide
};
app.bindDialog('inviteUsers', dialogBindings);
};
this.initialize = initialize;
this.showEmailDialog = showEmailDialog;
this.showGoogleDialog = showGoogleDialog;
this.showFacebookDialog = showFacebookDialog;
}
return this;
})(window,jQuery);

View File

@ -4,64 +4,9 @@
var congratulations = {};
function listClients() {
var rest = context.JK.Rest();
var currentOS = context.JK.detectOS();
var downloads = $('.downloads');
rest.getClientDownloads()
.done(function(data) {
downloads.removeClass('spinner-large');
var count = 0;
for ( var property in data ) count++;
if(count == 0) {
alert("Currently unable to list client software downloads.");
}
else {
$.each(data, function(key, item) {
// if the currentOS we detect from browser is found within the product of an available client
// we flag it with this boolean
var matchesUserOS = currentOS != null && key.toLowerCase().indexOf(currentOS.toLowerCase()) > -1;
var platform = key.substring('JamClient/'.length);
var options = {
emphasis: matchesUserOS ? "currentOS" : "",
uri: item.uri,
platform: platform
}
var download = $(context._.template($('#client-download-link').html(), options, { variable: 'data' }));
download.find('a').data('platform', platform).click(function() {
context.JK.GA.trackDownload($(this).data('platform'));
});
if(matchesUserOS) {
// make sure the current user OS is at the top
downloads.prepend(download);
}
else {
downloads.append(download)
}
});
}
})
.fail(function() {
downloads.removeClass('spinner-large');
alert("Currently unable to list client software downloads due to error.");
})
}
congratulations.initialize = function initialize(musician, registrationType) {
if(musician) {
listClients();
context.JK.Downloads.listClients();
}
if(registrationType) {

View File

@ -0,0 +1,69 @@
(function(context,$) {
"use strict";
context.JK = context.JK || {};
var downloads = {};
function listClients() {
var rest = context.JK.Rest();
var currentOS = context.JK.detectOS();
var downloads = $('.downloads');
rest.getClientDownloads()
.done(function(data) {
downloads.removeClass('spinner-large');
var count = 0;
for ( var property in data ) count++;
if(count == 0) {
alert("Currently unable to list client software downloads.");
}
else {
$.each(data, function(key, item) {
// if the currentOS we detect from browser is found within the product of an available client
// we flag it with this boolean
var matchesUserOS = currentOS != null && key.toLowerCase().indexOf(currentOS.toLowerCase()) > -1;
var platform = key.substring('JamClient/'.length);
var options = {
emphasis: matchesUserOS ? "currentOS" : "",
uri: item.uri,
platform: platform
}
var download = $(context._.template($('#client-download-link').html(), options, { variable: 'data' }));
download.find('a').data('platform', platform).click(function() {
context.JK.GA.trackDownload($(this).data('platform'));
});
if(matchesUserOS) {
// make sure the current user OS is at the top
downloads.prepend(download);
}
else {
downloads.append(download)
}
});
}
})
.fail(function() {
downloads.removeClass('spinner-large');
alert("Currently unable to list client software downloads due to error.");
})
}
downloads.listClients = listClients;
context.JK.Downloads = downloads;
})(window, jQuery)

View File

@ -8,4 +8,5 @@
//= require jam_rest
//= require landing/init
//= require landing/signup
//= require landing/downloads
//= require landing/congratulations

View File

@ -7,6 +7,7 @@
var logger = context.JK.logger;
var friends = [];
var notifications = [];
var invitationDialog = new context.JK.InvitationDialog(app);
function initializeFriendsPanel() {
@ -356,6 +357,15 @@
};
})();
function inviteHoverIn() {
}
function inviteHoverOut() {
}
function events() {
$('#search-input').keyup(function(evt) {
delay(function() {

View File

@ -26,6 +26,7 @@
*= require ./account
*= require ./search
*= require ./ftue
*= require ./invitationDialog
*= require ./createSession
*= require ./genreSelector
*= require ./sessionList

View File

@ -296,7 +296,7 @@ table.generaltable {
}
}
ul.account-shortcuts {
ul.shortcuts {
border:1px solid #ED3618;
li {
@ -306,15 +306,40 @@ ul.account-shortcuts {
padding:2px;
}
.account-home {
.account-home, .audio, .get-help, .download-app, .invite-friends {
border-bottom:1px;
border-style:solid;
border-color:#ED3618;
}
.audio {
border-bottom:1px;
border-style:solid;
border-color:#ED3618;
span.arrow-right {
display:inline-block;
width: 0;
height: 0;
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
border-left: 4px solid #FFCC00;
padding-left:5px;
}
ul.shortcuts-submenu {
display:none;
li {
margin:0;
height:20px;
line-height:20px;
padding:2px;
color:#FFCC00;
}
li.google-invite, li.email-invite {
padding-left:9px;
}
}
}

View File

@ -111,32 +111,4 @@ div.friendbox input[type=text] {
padding:10px;
border-bottom:solid 1px #999;
cursor:pointer;
}
.invitation-overlay {
width:384px;
height:344px;
padding:8px;
background-color:#787878;
position:fixed;
top:20%;
left:50%;
margin-left:-200px;
}
.invitation-overlay textarea {
font-family:"Raleway", arial, sans-serif;
background-color:#c5c5c5;
border:none;
-webkit-box-shadow: inset 2px 2px 3px 0px #888;
box-shadow: inset 2px 2px 3px 0px #888;
color:#666;
height:75px;
width:300px;
}
.invitation-inner {
height:300px;
overflow:auto;
background-color:#262626;
}

View File

@ -0,0 +1,27 @@
.invitation-overlay {
width:384px;
height:344px;
padding:8px;
background-color:#787878;
position:fixed;
top:20%;
left:50%;
margin-left:-200px;
}
.invitation-overlay textarea {
font-family:"Raleway", arial, sans-serif;
background-color:#c5c5c5;
border:none;
-webkit-box-shadow: inset 2px 2px 3px 0px #888;
box-shadow: inset 2px 2px 3px 0px #888;
color:#666;
height:75px;
width:300px;
}
.invitation-inner {
height:300px;
overflow:auto;
background-color:#262626;
}

View File

@ -244,5 +244,13 @@
padding-bottom:10px;
font-size:11px;
}
.invite-users-link {
font-size:11px;
color:#A0B9BD;
right:35px;
position:absolute;
top:15px;
}
}

View File

@ -108,6 +108,10 @@ class UsersController < ApplicationController
render :layout => "landing"
end
def downloads
render :layout => "landing"
end
def signup_confirm
signup_token = params[:signup_token]

View File

@ -108,7 +108,7 @@
</div>
<div style="width:78%">
<div class="left mr20">
<div class="left" layout-link="invite-users">
<div class="left" layout-link="inviteUsers">
<a id="btn-email-invitation">
<%= image_tag("content/icon_gmail.png", :size => "24x24", :align => "absmiddle") %>
</a>
@ -134,7 +134,7 @@
<div class="right mt5 ml5">Twitter</div>
</div> -->
<div class="left left">
<div class="left" layout-link="invite-users">
<div class="left" layout-link="inviteUsers">
<a id="btn-gmail-invitation">
<%= image_tag("content/icon_google.png", :size => "24x24", :align => "absmiddle") %>
</a>
@ -170,7 +170,6 @@
</div>
<%= render "friendSelector" %>
<%= render "invitation" %>
<!-- Added Invitation Template -->
<script type="text/template" id="template-added-invitation">

View File

@ -20,7 +20,7 @@
<div id="user"></div>
<div class="arrow-down"></div>
<ul class="account-shortcuts">
<ul class="shortcuts">
<!-- <li><a layout-link="account">Profile</a></li> -->
<li class="account-home"><%= link_to "Account Home", '#/account' %></li>
<li class="identity"><%= link_to "Identity", '#/account/identity' %></li>
@ -28,7 +28,15 @@
<!--<li class="subscriptions"><%= link_to "Subscriptions", '#/account/subscriptions' %></li> -->
<!-- <li class="payments"><%= link_to "Payments", '#/account/payments' %></li> -->
<li class="audio"><%= link_to "Audio Gear", '#/account/audio' %></li>
<li class="sign-out"><%= link_to "Sign out", signout_path, method: "delete" %></li>
<li class="invite-friends"><span class='menuheader'><span class="arrow-right"></span><%= link_to "Invite Friends", '#' %></span>
<ul class="shortcuts-submenu">
<li class="google-invite"><%= link_to "Google", '#' %></li>
<li class="email-invite"><%= link_to "Email", '#' %></li>
</ul>
</li>
<li class="download-app"><%= link_to "Download App", downloads_path, :rel => "external" %></li>
<li class="get-help"><%= link_to "Get Help", 'https://jamkazam.desk.com/', :rel => "external" %></li>
<li class="sign-out"><%= link_to "Sign Out", signout_path, method: "delete" %></li>
</ul>

View File

@ -1,5 +1,5 @@
<!-- Invitation Dialog -->
<div class="dialog invitation-overlay" layout="dialog" layout-id="invite-users" id="invitation-dialog">
<div class="dialog invitation-overlay" layout="dialog" layout-id="inviteUsers" id="invitation-dialog">
<div class="invitation-inner" id="invitation-textarea-container" style="display:none">
<div style="margin-left:10px; margin-top:10px;">
<label for="txt-emails">Enter email address(es). If multiple addresses, separate with commas.</label><br />

View File

@ -53,6 +53,18 @@
</div>
<div layout-panel="contents" class="panelcontents">
<ul id="sidebar-friend-list">
<li class="invite-friend-row">
<div class="avatar-small"></div>
<div class="friend-name">
invite a friend
</div>
<div class="left" layout-link="inviteUsers">
<a id="btn-email-invitation">
<%= image_tag("content/icon_gmail.png", :size => "24x24", :align => "absmiddle") %>
</a>
</div>
<br clear="all" />
</li>
</ul>
</div>
</div>

View File

@ -28,6 +28,7 @@
<%= render "account_profile" %>
<%= render "account_profile_avatar" %>
<%= render "account_audio_profile" %>
<%= render "invitationDialog" %>
<%= render "notify" %>
<%= render "client_update" %>
<%= render "banner" %>

View File

@ -0,0 +1,3 @@
<script type="text/template" id="client-download-link">
<div align="center" class="client-download {{data.emphasis}}"><a href="{{data.uri}}" class="button-orange m0">DOWNLOAD JAMKAZAM SOFTWARE<br/><span class="platform">{{data.platform}}</span></a></div>
</script>

View File

@ -27,6 +27,4 @@
window.congratulations.initialize(true, jQuery.QueryString["type"]);
</script>
<script type="text/template" id="client-download-link">
<div align="center" class="client-download {{data.emphasis}}"><a href="{{data.uri}}" class="button-orange m0">DOWNLOAD JAMKAZAM SOFTWARE<br/><span class="platform">{{data.platform}}</span></a></div>
</script>
<%= render "users/download_templates" %>

View File

@ -0,0 +1,28 @@
<% provide(:title, 'Downloads') %>
<div class="overlay-small">
<!-- header -->
<div class="content-head">
<h1>Downloads</h1>
</div>
<!-- inner wrapper -->
<div class="overlay-inner">
To get started playing with others, use the button below to download the JamKazam software, then click to open the download and follow the on-screen instructions to install the application on your computer.<br />
<br />
<div align="center" class="downloads spinner-large">
</div>
</div>
<!-- end inner -->
</div>
<%= render "users/download_templates" %>
<script type="text/javascript">
window.JK.Downloads.listClients();
</script>

View File

@ -20,6 +20,7 @@ SampleApp::Application.routes.draw do
match '/signup', to: 'users#create', :via => 'post'
match '/congratulations_musician', to: 'users#congratulations_musician'
match '/congratulations_fan', to: 'users#congratulations_fan'
match '/downloads', to: 'users#downloads'
match '/signin', to: 'sessions#new'
match '/signout', to: 'sessions#destroy', via: :delete