diff --git a/web/app/assets/javascripts/accounts.js b/web/app/assets/javascripts/accounts.js index 046a09772..6d299e9c8 100644 --- a/web/app/assets/javascripts/accounts.js +++ b/web/app/assets/javascripts/accounts.js @@ -78,6 +78,7 @@ // events for main screen function events() { // wire up main panel clicks + $('#account-content-scroller').on('click', '#account-schduled-sessions-link', function(evt) { evt.stopPropagation(); navToScheduledSessions(); return false; } ); $('#account-content-scroller').on('click', '#account-edit-identity-link', function(evt) { evt.stopPropagation(); navToEditIdentity(); return false; } ); $('#account-content-scroller').on('click', '#account-edit-profile-link', function(evt) { evt.stopPropagation(); navToEditProfile(); return false; } ); $('#account-content-scroller').on('click', '#account-edit-subscriptions-link', function(evt) { evt.stopPropagation(); navToEditSubscriptions(); return false; } ); @@ -92,6 +93,11 @@ .error(app.ajaxError) } + function navToScheduledSessions() { + resetForm(); + window.location = '/client#/account/sessions' + } + function navToEditIdentity() { resetForm() window.location = '/client#/account/identity' diff --git a/web/app/assets/javascripts/accounts_sessions.js b/web/app/assets/javascripts/accounts_sessions.js new file mode 100644 index 000000000..1d8ece9ac --- /dev/null +++ b/web/app/assets/javascripts/accounts_sessions.js @@ -0,0 +1,72 @@ +(function (context, $) { + + "use strict"; + + context.JK = context.JK || {}; + context.JK.AccountSessions = function (app) { + var logger = context.JK.logger; + var rest = context.JK.Rest(); + var userId; + var scheduledSessions = {}; + + function beforeShow(data) { + userId = data.id; + } + + function afterShow(data) { + resetForm(); + renderAccountIdentity(); + } + + function resetForm() { + // remove all display errors + $('#account-sessions-content-scroller form .error-text').remove() + $('#account-sessions-content-scroller form .error').removeClass("error") + } + + /****************** MAIN PORTION OF SCREEN *****************/ + // events for main screen + function events() { + } + + function appendSessions(template) { + $("#account-scheduled-sessions table tbody").replaceWith(template); + } + + function populateSessions(sessionList) { + $.each(sessionList, function(index, session) { + scheduledSessions[session.id] = session; + }); + + var template = context._.template($('#template-account-session').html(), {sessions: sessionList}, {variable: 'data'}); + + appendSessions(template); + } + + function renderAccountIdentity() { + rest.findScheduledSessions({}) + .done(populateSessions) + .fail(app.ajaxError); + } + + function navToAccount() { + resetForm(); + window.location = '/client#/account'; + } + + function initialize() { + var screenBindings = { + 'beforeShow': beforeShow, + 'afterShow': afterShow + }; + app.bindScreen('account/sessions', screenBindings); + events(); + } + + this.initialize = initialize; + this.beforeShow = beforeShow; + this.afterShow = afterShow; + return this; + }; + +})(window, jQuery); diff --git a/web/app/assets/stylesheets/client/account.css.scss b/web/app/assets/stylesheets/client/account.css.scss index a1adfda4a..9ed774709 100644 --- a/web/app/assets/stylesheets/client/account.css.scss +++ b/web/app/assets/stylesheets/client/account.css.scss @@ -246,6 +246,25 @@ color:grey; } } + + /** account sessions */ + .account-sessions { + table.generaltable td { + vertical-align:middle; + } + + div#account-scheduled-sessions { + position: relative; + display: block; + overflow: auto; + margin: 0px; + height: 340px; + } + + table.generaltable td { + vertical-align:middle; + } + } } diff --git a/web/app/views/clients/_account.html.erb b/web/app/views/clients/_account.html.erb index 7f4acb741..817edbbb7 100644 --- a/web/app/views/clients/_account.html.erb +++ b/web/app/views/clients/_account.html.erb @@ -26,6 +26,17 @@
{% if (data.isNativeClient) { %} +
+

sessions:

+
+
+
+
+ UPDATE +
+
+
+

audio gear:

diff --git a/web/app/views/clients/_account_sessions.html.erb b/web/app/views/clients/_account_sessions.html.erb new file mode 100644 index 000000000..83f513527 --- /dev/null +++ b/web/app/views/clients/_account_sessions.html.erb @@ -0,0 +1,78 @@ + +
+ +
+ +
+ <%= image_tag "content/icon_account.png", {:width => 27, :height => 20} %> +
+ +

my account

+ <%= render "screen_navigation" %> +
+ + + +
+ +
+ +
+ + \ No newline at end of file diff --git a/web/app/views/clients/index.html.erb b/web/app/views/clients/index.html.erb index 84ce68afd..339e0428b 100644 --- a/web/app/views/clients/index.html.erb +++ b/web/app/views/clients/index.html.erb @@ -48,6 +48,7 @@ <%= render "friendSelector" %> <%= render "account_profile_avatar" %> <%= render "account_audio_profile" %> +<%= render "account_sessions" %> <%= render "configure_tracks_dialog" %> <%= render "invitationDialog" %> <%= render "inviteMusicians" %> @@ -181,6 +182,9 @@ var accountIdentityScreen = new JK.AccountIdentityScreen(JK.app); accountIdentityScreen.initialize(); + var accountSessionsScreen = new JK.AccountSessions(JK.app); + accountSessionsScreen.initialize(); + var affiliateReportScreen = new JK.AffiliateReportScreen(JK.app); affiliateReportScreen.initialize();