diff --git a/admin/spec/features/invited_users_spec.rb b/admin/spec/features/invited_users_spec.rb index 2e621d00c..8fa92598f 100644 --- a/admin/spec/features/invited_users_spec.rb +++ b/admin/spec/features/invited_users_spec.rb @@ -27,7 +27,7 @@ describe InvitedUser do end - it { should have_selector('#main_content .panel:first-child h3', text: "Invited Users Details" ); } + it { should have_selector('#main_content .panel:first-child h3', text: "Invited Users nDetails" ); } it { UserMailer.deliveries.length.should == 1 } end end diff --git a/web/Gemfile b/web/Gemfile index 9f6af9081..1db5f3b03 100644 --- a/web/Gemfile +++ b/web/Gemfile @@ -95,7 +95,7 @@ end gem 'rack-test' # gem 'rb-fsevent', '0.9.1', :require => false # gem 'growl', '1.0.3' - gem 'poltergeist' , '1.4.1' # can't go to 1.4.0 until this is fixed https://github.com/jonleighton/poltergeist/issues/385 + gem 'poltergeist' end diff --git a/web/app/assets/images/content/button_download_linux.png b/web/app/assets/images/content/button_download_linux.png new file mode 100644 index 000000000..b271f72d2 Binary files /dev/null and b/web/app/assets/images/content/button_download_linux.png differ diff --git a/web/app/assets/images/content/button_download_mac.png b/web/app/assets/images/content/button_download_mac.png new file mode 100644 index 000000000..7a301312a Binary files /dev/null and b/web/app/assets/images/content/button_download_mac.png differ diff --git a/web/app/assets/images/content/button_download_other_linux.png b/web/app/assets/images/content/button_download_other_linux.png new file mode 100644 index 000000000..83aec944c Binary files /dev/null and b/web/app/assets/images/content/button_download_other_linux.png differ diff --git a/web/app/assets/images/content/button_download_other_mac.png b/web/app/assets/images/content/button_download_other_mac.png new file mode 100644 index 000000000..8f63820dc Binary files /dev/null and b/web/app/assets/images/content/button_download_other_mac.png differ diff --git a/web/app/assets/images/content/button_download_other_windows.png b/web/app/assets/images/content/button_download_other_windows.png new file mode 100644 index 000000000..d857bf373 Binary files /dev/null and b/web/app/assets/images/content/button_download_other_windows.png differ diff --git a/web/app/assets/images/content/button_download_windows.png b/web/app/assets/images/content/button_download_windows.png new file mode 100644 index 000000000..fd240ee35 Binary files /dev/null and b/web/app/assets/images/content/button_download_windows.png differ diff --git a/web/app/assets/images/web/Bullet-Black.png b/web/app/assets/images/web/Bullet-Black.png new file mode 100755 index 000000000..ef28ebc35 Binary files /dev/null and b/web/app/assets/images/web/Bullet-Black.png differ diff --git a/web/app/assets/images/web/Bullet-White.png b/web/app/assets/images/web/Bullet-White.png new file mode 100755 index 000000000..5b373a1c7 Binary files /dev/null and b/web/app/assets/images/web/Bullet-White.png differ diff --git a/web/app/assets/images/web/bkg_corporate.gif b/web/app/assets/images/web/bkg_corporate.gif new file mode 100644 index 000000000..c0f94155e Binary files /dev/null and b/web/app/assets/images/web/bkg_corporate.gif differ diff --git a/web/app/assets/images/web/bkg_home.gif b/web/app/assets/images/web/bkg_home.gif new file mode 100644 index 000000000..dd9434401 Binary files /dev/null and b/web/app/assets/images/web/bkg_home.gif differ diff --git a/web/app/assets/images/web/carousel_bands.jpg b/web/app/assets/images/web/carousel_bands.jpg new file mode 100644 index 000000000..309366d68 Binary files /dev/null and b/web/app/assets/images/web/carousel_bands.jpg differ diff --git a/web/app/assets/images/web/carousel_fans.jpg b/web/app/assets/images/web/carousel_fans.jpg new file mode 100644 index 000000000..929864c5b Binary files /dev/null and b/web/app/assets/images/web/carousel_fans.jpg differ diff --git a/web/app/assets/images/web/carousel_musicians.jpg b/web/app/assets/images/web/carousel_musicians.jpg new file mode 100644 index 000000000..74d0fe73a Binary files /dev/null and b/web/app/assets/images/web/carousel_musicians.jpg differ diff --git a/web/app/assets/images/web/cta_button.png b/web/app/assets/images/web/cta_button.png new file mode 100644 index 000000000..cca3f358a Binary files /dev/null and b/web/app/assets/images/web/cta_button.png differ diff --git a/web/app/assets/images/web/icon_pdf.png b/web/app/assets/images/web/icon_pdf.png new file mode 100644 index 000000000..a08a55700 Binary files /dev/null and b/web/app/assets/images/web/icon_pdf.png differ diff --git a/web/app/assets/images/web/icon_pr.png b/web/app/assets/images/web/icon_pr.png new file mode 100644 index 000000000..99d0e7aae Binary files /dev/null and b/web/app/assets/images/web/icon_pr.png differ diff --git a/web/app/assets/images/web/icon_product.png b/web/app/assets/images/web/icon_product.png new file mode 100644 index 000000000..739cf6200 Binary files /dev/null and b/web/app/assets/images/web/icon_product.png differ diff --git a/web/app/assets/images/web/icon_users.png b/web/app/assets/images/web/icon_users.png new file mode 100644 index 000000000..889d5395f Binary files /dev/null and b/web/app/assets/images/web/icon_users.png differ diff --git a/web/app/assets/images/web/logo_corporate.png b/web/app/assets/images/web/logo_corporate.png new file mode 100644 index 000000000..529cff728 Binary files /dev/null and b/web/app/assets/images/web/logo_corporate.png differ diff --git a/web/app/assets/images/web/logo_home.png b/web/app/assets/images/web/logo_home.png new file mode 100644 index 000000000..d7482a85d Binary files /dev/null and b/web/app/assets/images/web/logo_home.png differ diff --git a/web/app/assets/images/web/next_button.png b/web/app/assets/images/web/next_button.png new file mode 100755 index 000000000..dc45fd579 Binary files /dev/null and b/web/app/assets/images/web/next_button.png differ diff --git a/web/app/assets/images/web/prev_button.png b/web/app/assets/images/web/prev_button.png new file mode 100755 index 000000000..445d40377 Binary files /dev/null and b/web/app/assets/images/web/prev_button.png differ diff --git a/web/app/assets/images/web/shadowLeft.png b/web/app/assets/images/web/shadowLeft.png new file mode 100755 index 000000000..74d131262 Binary files /dev/null and b/web/app/assets/images/web/shadowLeft.png differ diff --git a/web/app/assets/images/web/shadowLeft8.png b/web/app/assets/images/web/shadowLeft8.png new file mode 100755 index 000000000..c4b7bc6aa Binary files /dev/null and b/web/app/assets/images/web/shadowLeft8.png differ diff --git a/web/app/assets/images/web/shadowMiddle8.png b/web/app/assets/images/web/shadowMiddle8.png new file mode 100755 index 000000000..a4381df28 Binary files /dev/null and b/web/app/assets/images/web/shadowMiddle8.png differ diff --git a/web/app/assets/images/web/shadowRight.png b/web/app/assets/images/web/shadowRight.png new file mode 100755 index 000000000..56f1a7d86 Binary files /dev/null and b/web/app/assets/images/web/shadowRight.png differ diff --git a/web/app/assets/images/web/shadowTile.png b/web/app/assets/images/web/shadowTile.png new file mode 100755 index 000000000..ad9e48ab3 Binary files /dev/null and b/web/app/assets/images/web/shadowTile.png differ diff --git a/web/app/assets/images/web/video.png b/web/app/assets/images/web/video.png new file mode 100755 index 000000000..05960f0ac Binary files /dev/null and b/web/app/assets/images/web/video.png differ diff --git a/web/app/assets/javascripts/accounts_profile_avatar.js b/web/app/assets/javascripts/accounts_profile_avatar.js index 4f1757f30..d656577bc 100644 --- a/web/app/assets/javascripts/accounts_profile_avatar.js +++ b/web/app/assets/javascripts/accounts_profile_avatar.js @@ -92,7 +92,7 @@ function deleteAvatarSuccess(response) { renderAvatar(null, null); - JK.Header.loadMe(); + JK.UserDropdown.loadMe(); rest.getUserDetail() .done(function(userDetail) { @@ -361,7 +361,7 @@ self.userDetail = response; // notify any listeners that the avatar changed - JK.Header.loadMe(); + JK.UserDropdown.loadMe(); // $('.avatar_large img').trigger('avatar_changed', [self.userDetail.photo_url]); app.notify( diff --git a/web/app/assets/javascripts/header.js b/web/app/assets/javascripts/header.js index 9bb52535f..02575410f 100644 --- a/web/app/assets/javascripts/header.js +++ b/web/app/assets/javascripts/header.js @@ -1,7 +1,7 @@ (function(context,$) { /** - * Javascript for managing the header (account dropdown) as well + * Javascript for managing the header as well * as any dialogs reachable from there. Account settings dialog. */ @@ -17,8 +17,7 @@ var instrumentIds = []; var instrumentNames = []; var instrumentPopularities = {}; // id -> popularity - var invitationDialog = new context.JK.InvitationDialog(app); - var rest = new JK.Rest(); + function loadInstruments() { // TODO: This won't work in the long-term. We'll need to provide @@ -98,45 +97,10 @@ context.location = '#/home'; }); - $('.userinfo').on('click', function() { - $('ul.shortcuts', this).toggle(); - }); - - $('.userinfo .invite-friends .menuheader').on('click', function(e) { - $(this).closest('li').css('height', 'auto').find('ul').toggle(); - e.stopPropagation(); - return false; - }); - - /** - $('.userinfo .sign-out a').on('click', function(e) { - e.stopPropagation(); - - /** rest.signout() - .done(function() { - - }) - - }); */ - - $('.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 $('#added-profile-instruments').on("click", ".instrument span", removeInvitation); - - $('#header-avatar').on('avatar_changed', function(event, newAvatarUrl) { - updateAvatar(newAvatarUrl); - event.preventDefault(); - return false; - }) } function handleIdentitySubmit(evt) { @@ -194,52 +158,12 @@ return false; } - function loadMe() { - $.ajax({ - url: '/api/users/' + context.JK.currentUserId - }).done(function(r) { - userMe = r; - // TODO - Setting global variable for local user. - context.JK.userMe = r; - updateHeader(); - }).fail(app.ajaxError); - } - - function updateHeader() { - - $('#user').html(userMe.name); - showAvatar(); - } - - // initially show avatar - function showAvatar() { - var photoUrl = context.JK.resolveAvatarUrl(userMe.photo_url); - $('#header-avatar').attr('src', photoUrl); - } - - // handle update avatar event - function updateAvatar(avatar_url) { - var photoUrl = context.JK.resolveAvatarUrl(avatar_url); - var avatar = $(new Image()); - avatar.attr('src', photoUrl + '?cache_bust=' + new Date().getTime()); - avatar.attr('alt', "Avatar"); - avatar.attr('id', 'header-avatar'); - $('#header-avatar').replaceWith(avatar); - } - this.initialize = function() { - events(); loadInstruments(); - loadMe(); - invitationDialog.initialize(); - - //searcher = new context.JK.Searcher(app); //searcher.initialize(); }; - - this.loadMe = loadMe; }; })(window,jQuery); \ No newline at end of file diff --git a/web/app/assets/javascripts/jamkazam.js b/web/app/assets/javascripts/jamkazam.js index 9ac210a95..c7462d62f 100644 --- a/web/app/assets/javascripts/jamkazam.js +++ b/web/app/assets/javascripts/jamkazam.js @@ -28,7 +28,10 @@ var heartbeatAckCheckInterval = null; var opts = { - layoutOpts: {} + inClient: true, // specify false if you want the app object but none of the client-oriented features + layoutOpts: { + layoutFilter: true // specify false if you want footer to be left alone + } }; /** @@ -279,14 +282,17 @@ this.opts = $.extend(opts, inOpts); this.layout = new context.JK.Layout(); this.layout.initialize(this.opts.layoutOpts); - registerLoginAck(); - registerHeartbeatAck(); - registerBadStateRecovered(); - registerBadStateError(); - registerSocketClosed(); events(); - context.JK.FaderHelpers.initialize(); - context.window.onunload = this.unloadFunction; + + if(opts.inClient) { + registerLoginAck(); + registerHeartbeatAck(); + registerBadStateRecovered(); + registerBadStateError(); + registerSocketClosed(); + context.JK.FaderHelpers.initialize(); + context.window.onunload = this.unloadFunction; + } }; diff --git a/web/app/assets/javascripts/jquery.hoverIntent.js b/web/app/assets/javascripts/jquery.hoverIntent.js index 3dcff261f..bc1637354 100644 --- a/web/app/assets/javascripts/jquery.hoverIntent.js +++ b/web/app/assets/javascripts/jquery.hoverIntent.js @@ -1,106 +1,115 @@ -/** -* hoverIntent is similar to jQuery's built-in "hover" function except that -* instead of firing the onMouseOver event immediately, hoverIntent checks -* to see if the user's mouse has slowed down (beneath the sensitivity -* threshold) before firing the onMouseOver event. -* -* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+ -* -* -* hoverIntent is currently available for use in all personal or commercial -* projects under both MIT and GPL licenses. This means that you can choose -* the license that best suits your project, and use it accordingly. -* -* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions -* $("ul li").hoverIntent( showNav , hideNav ); -* -* // advanced usage receives configuration object only -* $("ul li").hoverIntent({ -* sensitivity: 7, // number = sensitivity threshold (must be 1 or higher) -* interval: 100, // number = milliseconds of polling interval -* over: showNav, // function = onMouseOver callback (required) -* timeout: 0, // number = milliseconds delay before onMouseOut function call -* out: hideNav // function = onMouseOut callback (required) -* }); -* -* @param f onMouseOver function || An object with configuration options -* @param g onMouseOut function || Nothing (use configuration options object) -* @author Brian Cherne brian(at)cherne(dot)net -*/ +/*! + * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+ + * http://cherne.net/brian/resources/jquery.hoverIntent.html + * + * You may use hoverIntent under the terms of the MIT license. Basically that + * means you are free to use hoverIntent as long as this header is left intact. + * Copyright 2007, 2013 Brian Cherne + */ + +/* hoverIntent is similar to jQuery's built-in "hover" method except that + * instead of firing the handlerIn function immediately, hoverIntent checks + * to see if the user's mouse has slowed down (beneath the sensitivity + * threshold) before firing the event. The handlerOut function is only + * called after a matching handlerIn. + * + * // basic usage ... just like .hover() + * .hoverIntent( handlerIn, handlerOut ) + * .hoverIntent( handlerInOut ) + * + * // basic usage ... with event delegation! + * .hoverIntent( handlerIn, handlerOut, selector ) + * .hoverIntent( handlerInOut, selector ) + * + * // using a basic configuration object + * .hoverIntent( config ) + * + * @param handlerIn function OR configuration object + * @param handlerOut function OR selector for delegation OR undefined + * @param selector selector OR undefined + * @author Brian Cherne + */ (function($) { - $.fn.hoverIntent = function(f,g) { - // default configuration options - var cfg = { - sensitivity: 7, - interval: 100, - timeout: 0 - }; - // override configuration options with user supplied object - cfg = $.extend(cfg, g ? { over: f, out: g } : f ); + $.fn.hoverIntent = function(handlerIn,handlerOut,selector) { - // instantiate variables - // cX, cY = current X and Y position of mouse, updated by mousemove event - // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval - var cX, cY, pX, pY; + // default configuration values + var cfg = { + interval: 100, + sensitivity: 7, + timeout: 0 + }; - // A private function for getting mouse position - var track = function(ev) { - cX = ev.pageX; - cY = ev.pageY; - }; + if ( typeof handlerIn === "object" ) { + cfg = $.extend(cfg, handlerIn ); + } else if ($.isFunction(handlerOut)) { + cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } ); + } else { + cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } ); + } - // A private function for comparing current and previous mouse position - var compare = function(ev,ob) { - ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); - // compare mouse positions to see if they've crossed the threshold - if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) { - $(ob).unbind("mousemove",track); - // set hoverIntent state to true (so mouseOut can be called) - ob.hoverIntent_s = 1; - return cfg.over.apply(ob,[ev]); - } else { - // set previous coordinates for next time - pX = cX; pY = cY; - // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs) - ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval ); - } - }; + // instantiate variables + // cX, cY = current X and Y position of mouse, updated by mousemove event + // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval + var cX, cY, pX, pY; - // A private function for delaying the mouseOut function - var delay = function(ev,ob) { - ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); - ob.hoverIntent_s = 0; - return cfg.out.apply(ob,[ev]); - }; + // A private function for getting mouse position + var track = function(ev) { + cX = ev.pageX; + cY = ev.pageY; + }; - // A private function for handling mouse 'hovering' - var handleHover = function(e) { - // copy objects to be passed into t (required for event object to be passed in IE) - var ev = jQuery.extend({},e); - var ob = this; + // A private function for comparing current and previous mouse position + var compare = function(ev,ob) { + ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); + // compare mouse positions to see if they've crossed the threshold + if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) { + $(ob).off("mousemove.hoverIntent",track); + // set hoverIntent state to true (so mouseOut can be called) + ob.hoverIntent_s = 1; + return cfg.over.apply(ob,[ev]); + } else { + // set previous coordinates for next time + pX = cX; pY = cY; + // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs) + ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval ); + } + }; - // cancel hoverIntent timer if it exists - if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); } + // A private function for delaying the mouseOut function + var delay = function(ev,ob) { + ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); + ob.hoverIntent_s = 0; + return cfg.out.apply(ob,[ev]); + }; - // if e.type == "mouseenter" - if (e.type == "mouseenter") { - // set "previous" X and Y position based on initial entry point - pX = ev.pageX; pY = ev.pageY; - // update "current" X and Y position based on mousemove - $(ob).bind("mousemove",track); - // start polling interval (self-calling timeout) to compare mouse coordinates over time - if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );} + // A private function for handling mouse 'hovering' + var handleHover = function(e) { + // copy objects to be passed into t (required for event object to be passed in IE) + var ev = jQuery.extend({},e); + var ob = this; - // else e.type == "mouseleave" - } else { - // unbind expensive mousemove event - $(ob).unbind("mousemove",track); - // if hoverIntent state is true, then call the mouseOut function after the specified delay - if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );} - } - }; + // cancel hoverIntent timer if it exists + if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); } - // bind the function to the two event listeners - return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover); - }; + // if e.type == "mouseenter" + if (e.type == "mouseenter") { + // set "previous" X and Y position based on initial entry point + pX = ev.pageX; pY = ev.pageY; + // update "current" X and Y position based on mousemove + $(ob).on("mousemove.hoverIntent",track); + // start polling interval (self-calling timeout) to compare mouse coordinates over time + if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );} + + // else e.type == "mouseleave" + } else { + // unbind expensive mousemove event + $(ob).off("mousemove.hoverIntent",track); + // if hoverIntent state is true, then call the mouseOut function after the specified delay + if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );} + } + }; + + // listen for mouseenter and mouseleave + return this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover}, cfg.selector); + }; })(jQuery); \ No newline at end of file diff --git a/web/app/assets/javascripts/landing/landing.js b/web/app/assets/javascripts/landing/landing.js index 25ba05e7b..72562e8dc 100644 --- a/web/app/assets/javascripts/landing/landing.js +++ b/web/app/assets/javascripts/landing/landing.js @@ -7,6 +7,4 @@ //= require ga //= require jam_rest //= require landing/init -//= require landing/signup -//= require landing/downloads -//= require landing/congratulations \ No newline at end of file +//= require landing/signup \ No newline at end of file diff --git a/web/app/assets/javascripts/layout.js b/web/app/assets/javascripts/layout.js index a3fb2c60c..682f0f7a3 100644 --- a/web/app/assets/javascripts/layout.js +++ b/web/app/assets/javascripts/layout.js @@ -281,6 +281,8 @@ } function layoutFooter(screenWidth, screenHeight) { + + if(!opts.layoutFooter) { return; } var $footer = $('#footer'); var nHeight = $footer.height(); var footerStyle = { @@ -291,17 +293,7 @@ $footer.animate({ "left" : opts.gutter, "width" : width, "top": (screenHeight - 78) + "px"}, opts.animationDuration); } - function requiredStyles() { - var bodyStyle = { - margin: '0px', - padding: '0px', - overflow: 'hidden' - }; - if (opts.allowBodyOverflow) { - delete bodyStyle.overflow; - } - $('body').css(bodyStyle); - + function requiredLayoutStyles() { var layoutStyle = { position: 'absolute', margin: '0px', @@ -321,6 +313,21 @@ $('[layout-grid]').children().css({ position: "absolute" }); + } + + function requiredStyles() { + var bodyStyle = { + margin: '0px', + padding: '0px', + overflow: 'hidden' + }; + if (opts.allowBodyOverflow) { + delete bodyStyle.overflow; + } + $('body').css(bodyStyle); + + requiredLayoutStyles(); + var curtainStyle = { position: "absolute", margin: '0px', diff --git a/web/app/assets/javascripts/user_dropdown.js b/web/app/assets/javascripts/user_dropdown.js index e69de29bb..462a85269 100644 --- a/web/app/assets/javascripts/user_dropdown.js +++ b/web/app/assets/javascripts/user_dropdown.js @@ -0,0 +1,85 @@ +(function(context,$) { +/** Javascript for managing the (account dropdown) */ + + +"use strict"; + + context.JK = context.JK || {}; + context.JK.UserDropdown = function(app) { + + var logger = context.JK.logger; + var rest = new JK.Rest(); + var userMe = null; + var invitationDialog = new context.JK.InvitationDialog(app); + + function menuHoverIn() { + $('ul.shortcuts', this).show(); + } + + function menuHoverOut() { + $('ul.shortcuts', this).hide(); + } + + function events() { + $('.userinfo').hoverIntent(menuHoverIn, menuHoverOut); + + $('.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(); + }); + + $('#header-avatar').on('avatar_changed', function(event, newAvatarUrl) { + updateAvatar(newAvatarUrl); + event.preventDefault(); + return false; + }) + } + + function loadMe() { + $.ajax({ + url: '/api/users/' + context.JK.currentUserId + }).done(function(r) { + userMe = r; + // TODO - Setting global variable for local user. + context.JK.userMe = r; + updateHeader(); + }).fail(app.ajaxError); + } + + function updateHeader() { + $('#user').html(userMe.name); + showAvatar(); + } + + // initially show avatar + function showAvatar() { + var photoUrl = context.JK.resolveAvatarUrl(userMe.photo_url); + $('#header-avatar').attr('src', photoUrl); + } + + // handle update avatar event + function updateAvatar(avatar_url) { + var photoUrl = context.JK.resolveAvatarUrl(avatar_url); + var avatar = $(new Image()); + avatar.attr('src', photoUrl + '?cache_bust=' + new Date().getTime()); + avatar.attr('alt', "Avatar"); + avatar.attr('id', 'header-avatar'); + $('#header-avatar').replaceWith(avatar); + } + + this.initialize = function() { + events(); + invitationDialog.initialize(); + loadMe(); + } + } +})(window,jQuery); \ No newline at end of file diff --git a/web/app/assets/javascripts/utils.js b/web/app/assets/javascripts/utils.js index 525ba4cf4..a0c347dea 100644 --- a/web/app/assets/javascripts/utils.js +++ b/web/app/assets/javascripts/utils.js @@ -297,7 +297,7 @@ context.JK.popExternalLinks = function() { // Allow any a link with a rel="external" attribute to launch // the link in the default browser, using jamClient: - $('a[rel="external"]').click(function(evt) { + $('body').on('click', 'a[rel="external"]', function(evt) { if(!context.jamClient) { return; diff --git a/web/app/assets/javascripts/web/congratulations.js b/web/app/assets/javascripts/web/congratulations.js index a2a45a398..576759f17 100644 --- a/web/app/assets/javascripts/web/congratulations.js +++ b/web/app/assets/javascripts/web/congratulations.js @@ -6,7 +6,7 @@ congratulations.initialize = function initialize(musician, registrationType) { if(musician) { - context.JK.Downloads.listClients(); + context.JK.Downloads.listClients(true); } if(registrationType) { diff --git a/web/app/assets/javascripts/web/downloads.js b/web/app/assets/javascripts/web/downloads.js index 76f6e5714..8be6b5b53 100644 --- a/web/app/assets/javascripts/web/downloads.js +++ b/web/app/assets/javascripts/web/downloads.js @@ -5,66 +5,121 @@ context.JK = context.JK || {}; var downloads = {}; + var isCongratulations; + var downloadUris = {}; // map of platform > uri + var rest = context.JK.Rest(); + + function selectPlatform(selectedPlatform) { + var platformName; // mac, windows, linux + var platformDisplay; // Mac, Windows, Linux + var platform = selectedPlatform; //MacOSX, Win32, Unix + var platformName1, platformName2, platform1, platform2; + var uri = downloadUris[selectedPlatform]; + + // prepare template varaibles + if (selectedPlatform == "Unix") { + platformName = "linux"; + platformDisplay = "Linux" + platformName1 = "mac"; + platformName2 = "windows"; + platform1 = "MacOSX"; + platform2 = "Win32" + } else if(selectedPlatform == "Win32") { + platformName = "windows"; + platformDisplay = "Windows"; + platformName1 = "mac"; + platformName2 = "linux" + platform1 = "MacOSX"; + platform2 = "Unix"; + } else if(selectedPlatform == "MacOSX") { + platformName = "mac"; + platformDisplay = "Mac"; + platformName1 = "windows"; + platformName2 = "linux"; + platform1 = "Win32"; + platform2 = "Unix"; + } + else { + alert("unknown platform: " + selectedPlatform); + } + + var options = { + platform : platform, + platformName : platformName, + platformDisplay : platformDisplay, + platformName1 : platformName1, + platformName2 : platformName2, + platform1: platform1, + platform2: platform2, + uri : uri ? uri : '#', + isCongratulations : isCongratulations + }; + + var blurb = $(context._.template($('#client-download-blurb-contents').html(), options, { variable: 'data' })); + var selectOthers = $(context._.template($('#client-download-select-others').html(), options, { variable: 'data' })); + + // install click handler for change selection + $('a', selectOthers).click(function() { + var platform = $(this).attr('data-platform'); + selectPlatform(platform); + return false; + }); + + $('a', blurb).click(function() { + var clicked = $(this); + var href = clicked.attr('href'); + if(href != "#") { + rest.userDownloadedClient().always(function() { + $('body').append('