account sessions page initial

This commit is contained in:
Bert Owen 2014-06-15 15:11:34 +08:00
parent db6d6fa315
commit 418ec9d927
6 changed files with 190 additions and 0 deletions

View File

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

View File

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

View File

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

View File

@ -26,6 +26,17 @@
<br />
{% if (data.isNativeClient) { %}
<div class="account-left">
<h2>sessions: </h2>
</div>
<div class="account-mid">
</div>
<div class="right">
<a id="account-schduled-sessions-link" href="#" class="button-orange">UPDATE</a>
</div>
<br clear="all" />
<hr/>
<div class="account-left">
<h2>audio gear:</h2>
</div>

View File

@ -0,0 +1,78 @@
<!-- Account Summary Dialog -->
<div layout="screen" layout-id="account/sessions" class="screen secondary" id="account-sessions">
<!-- header -->
<div class="content-head">
<!-- icon -->
<div class="content-icon">
<%= image_tag "content/icon_account.png", {:width => 27, :height => 20} %>
</div>
<!-- section head text -->
<h1>my account</h1>
<%= render "screen_navigation" %>
</div>
<!-- end header -->
<!-- sessions scrolling area -->
<div class="content-body">
<div id="account-sessions-content-scroller" class="content-body-scroller account-content-scroller">
<div class="content-wrapper account-sessions">
<br />
<div class="account-left w80 mb10">
<h2>scheduled sessions:</h2>
</div>
<div class="right mb10">
<a class="button-grey" href="javascript:history.go(-1)">BACK</a>
</div>
<br clear="all" />
<div id="account-scheduled-sessions">
<table class="generaltable f14" cellpadding="0" cellspacing="0">
<thead>
</thead>
<tbody>
</tbody>
</table>
</div>
<br clear="all" />
</div>
</div>
</div>
<!-- end content scrolling area -->
</div>
<script type="text/template" id="template-account-session">
<tbody>
{% for (var i = 0; i < data.sessions.length; i++) { %}
{% var session = data.sessions[i]; %}
<tr>
<td>
<div data-id="{{session.id}}">
<div class="left w20 mb5">Date/Time:</div>
<div class="right w80 mb5 ">
{{session.scheduled_start_time}} {{session.timezone_description}}
</div>
<br class="all"/>
<div class="left w20 mb5">Session:</div>
<div class="right w80 mb5">
{{session.name}}
</div>
<br class="all"/>
<div class="left w20 mb5">Notifications:</div>
<div class="right w80 mb5">
{{session.name}}
</div>
<br class="all"/>
<div class="left w20 mb5"></div>
<div class="right w80 mb5">
<a href="#" class="button-orange">DETAILS</a>
<a href="#" class="button-orange">CANCEL SESSION</a>
</div>
</div>
</td>
</tr>
{% } %}
</tbody>
</script>

View File

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