VRFS-1442 bands page updates

This commit is contained in:
Jonathan Kolyer 2014-11-23 00:29:12 +00:00
parent 465fd6fa94
commit 588f03a199
8 changed files with 123 additions and 35 deletions

View File

@ -434,7 +434,11 @@
$("#btn-edit-band-profile").unbind('click').click(function() {
//$('div[layout-id="band/setup"] .hdn-band-id').val(bandId);
context.location = "/client#/band/setup/" + bandId;
context.location = "/client#/band/setup/" + bandId + '/step1';
return false;
});
$("#btn-edit-band-members").unbind('click').click(function() {
context.location = "/client#/band/setup/" + bandId + '/step2';
return false;
});
}

View File

@ -22,7 +22,8 @@
var nilOptionText = 'n/a';
var bandId = '';
var friendInput=null;
var isSaving = false;
var step1, step2;
var isSaving = false;
function is_new_record() {
return bandId.length == 0;
@ -135,30 +136,48 @@
if (is_new_record()) {
rest.createBand(band)
.done(function (response) {
isSaving = false;
isSaving = false;
createBandInvitations(response.id, function () {
context.location = "/client#/bandProfile/" + response.id;
});
})
.fail(function (jqXHR) {
isSaving = false;
isSaving = false;
app.notifyServerError(jqXHR, "Unable to create band")
});
;
}
else {
band.id = bandId;
rest.updateBand(band)
.done(function (response) {
if (!step1 && !step2){
rest.updateBand(band)
.done(function (response) {
isSaving = false;
createBandInvitations(band.id, function () {
context.location = "/client#/bandProfile/" + band.id;
createBandInvitations(band.id, function () {
context.location = "/client#/bandProfile/" + band.id;
});
}).fail(function (jqXHR) {
isSaving = false;
app.notifyServerError(jqXHR, "Unable to create band")
});
})
.fail(function (jqXHR) {
isSaving = false;
app.notifyServerError(jqXHR, "Unable to create band")
});
} else {
if (step1) {
rest.updateBand(band)
.done(function (response) {
isSaving = false;
app.notifyAlert('Band Information', 'Your changes have been saved');
}).fail(function (jqXHR) {
isSaving = false;
app.notifyServerError(jqXHR, "Unable to update band")
});
} else if (step2) {
isSaving = false;
createBandInvitations(bandId, function () {
app.notifyAlert('Band Members', 'Your invitations have been sent');
context.location = "/client#/bandProfile/" + bandId;
});
}
}
}
}
@ -190,6 +209,15 @@
function beforeShow(data) {
inviteMusiciansUtil.clearSelections();
bandId = data.id == 'new' ? '' : data.id;
step1 = step2 = false;
if ('step2'==data['d']) {
step2 = true;
delete data['d'];
} else if ('step1'==data['d']){
step1 = true;
delete data['d'];
}
resetForm();
}
@ -204,6 +232,27 @@
// retrieve and initialize band profile data points
loadBandDetails();
if (step2) {
$("#band-setup-step-2").show();
$("#band-setup-step-1").hide();
$('.band-setup-text-step2').each(function(idx) { $(this).hide(); });
$('#btn-band-setup-back').text('CANCEL');
$('#btn-band-setup-save').text('SEND INVITATIONS');
} else if (step1) {
$("#band-setup-step-1").show();
$("#band-setup-step-2").hide();
$('.band-setup-text-step1').each(function(idx) { $(this).hide(); });
$('#btn-band-setup-next').text('SAVE');
}
if (! step1 && ! step2) {
$('#btn-band-setup-next').text('NEXT');
$('#btn-band-setup-back').text('CANCEL');
$('#btn-band-setup-save').text('CREATE BAND');
$('.band-setup-text-step1').each(function(idx) { $(this).show(); });
$('.band-setup-text-step2').each(function(idx) { $(this).show(); });
}
}
else {
loadGenres();
@ -417,8 +466,12 @@
$('#btn-band-setup-next').click(function () {
validateGeneralInfo()
.done(function (response) {
$("#band-setup-step-2").show();
$("#band-setup-step-1").hide();
if (!step1 && !step2) {
$("#band-setup-step-2").show();
$("#band-setup-step-1").hide();
} else if (step1) {
saveBand();
}
})
.fail(function (jqXHR) {
if(jqXHR.status == 422) {
@ -431,8 +484,14 @@
});
$('#btn-band-setup-back').click(function () {
$("#band-setup-step-1").show();
$("#band-setup-step-2").hide();
if (!step2) {
$("#band-setup-step-1").show();
$("#band-setup-step-2").hide();
} else {
resetForm();
window.history.go(-1);
return false;
}
});
$('#btn-band-setup-save').click(saveBand);

View File

@ -19,7 +19,7 @@
function createFbInvite() {
if(deferredFbInvite == null || deferredFbInvite.isRejected()) {
if(deferredFbInvite == null || (typeof(deferredFbInvite.isRejected)!=='undefined' && deferredFbInvite.isRejected())) {
deferredFbInvite = rest.createFbInviteUrl();
}

View File

@ -84,15 +84,17 @@
var mTemplate = $('#template-find-band-row').html();
var pTemplate = $('#template-band-player-info').html();
var aTemplate = $('#template-band-action-btns').html();
var eTemplate = $('#template-band-edit-btns').html();
var bVals, bb, renderings='';
var instr_logos, instr;
var players, playerVals, aPlayer;
var players, playerVals, aPlayer, isMember;
for (ii=0, len=bands.length; ii < len; ii++) {
bb = bands[ii];
instr_logos = '';
players = '';
playerVals = {};
isMember = false;
for (var jj=0, ilen=bb['players'].length; jj<ilen; jj++) {
var toolTip = '';
aPlayer = bb['players'][jj];
@ -107,7 +109,9 @@
}
player_instrs += '<img src="' + instr + '" title="' + toolTip + '"/>';
}
if (!isMember) {
isMember = aPlayer.user_id == context.JK.currentUserId;
}
playerVals = {
user_id: aPlayer.user_id,
player_name: aPlayer.name,
@ -119,14 +123,24 @@
players += context.JK.fillTemplate(pTemplate, playerVals);
}
var actionVals = {
profile_url: "/client#/bandProfile/" + bb.id,
button_follow: bb['is_following'] ? '' : 'button-orange',
button_message: 'button-orange'
};
var band_actions = context.JK.fillTemplate(aTemplate, actionVals);
var bgenres = '';
var actionVals, band_actions;
if (isMember) {
actionVals = {
profile_url: "/client#/bandProfile/" + bb.id,
band_edit_url: "/client#/band/setup/" + bb.id + '/step1',
band_member_url: "/client#/band/setup/" + bb.id + '/step2'
};
band_actions = context.JK.fillTemplate(eTemplate, actionVals);
} else {
actionVals = {
profile_url: "/client#/bandProfile/" + bb.id,
button_follow: bb['is_following'] ? '' : 'button-orange',
button_message: 'button-orange'
};
band_actions = context.JK.fillTemplate(aTemplate, actionVals);
}
var bgenres = '';
for (jj=0, ilen=bb['genres'].length; jj<ilen; jj++) {
bgenres += bb['genres'][jj]['description'] + '<br />';
}

View File

@ -14,6 +14,7 @@
var profileScreen = null;
var textMessageDialog = null;
var feed = null;
var isBandMember = false;
var instrument_logo_map = context.JK.getInstrumentIconMap24();

View File

@ -19,7 +19,9 @@
<div class="right">
<a id="btn-follow-band" class="button-orange">FOLLOW</a>
<a id="btn-edit-band-profile" class="button-orange">EDIT PROFILE</a>
<a id="btn-edit-band-profile" class="button-orange">PROFILE</a>
<a id="btn-edit-band-info" class="button-orange">EDIT BAND</a>
<a id="btn-edit-band-members" class="button-orange">INVITE MEMBERS</a>
</div>
<br clear="all" /><br />
@ -104,7 +106,7 @@
</div>
<div class="button-row">
<div class="lcol stats left">
{friend_count} <img src="../assets/content/icon_friend.png" title="friends" width="22" height="12" align="absmiddle" />
{friend_count} <img src="../assets/content/icon_friend.png" title="friends" width="14" height="14" align="absmiddle" />
{follower_count} <img src="../assets/content/icon_followers.png" title="followers" width="22" height="12" align="absmiddle" />
{recording_count} <img src="../assets/content/icon_recordings.png" title="recordings" width="12" height="13" align="absmiddle" />
{session_count} <img src="../assets/content/icon_session_tiny.png" title="sessions" width="12" height="12" align="absmiddle" />
@ -128,4 +130,4 @@
<div user-id="{userId}" hoveraction="{hoverAction}" class="profile-block-name">{userName}</div>
<div class="profile-block-city">{location}</div>
</div>
</script>
</script>

View File

@ -18,7 +18,7 @@
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" colspan="2">
<h2>Step 1: General Information</h2>
<h2><span class="band-setup-text-step1">Step 1: </span>General Information</h2>
</td>
<td id="tdBandPhoto" valign="middle" rowspan="2" width="33%">
<a href="#" class="avatar-profile">
@ -92,8 +92,9 @@
</div>
<div id="band-setup-step-2" class="content-wrapper" style="padding:10px 35px 10px 35px; display:none;">
<br/>
<h2>Step 2: Add Band Members</h2><br/>
<h2><span class="band-setup-text-step2">Step 2: </span>Add Band Members</h2><br/>
<div id="band-setup-invite-musicians"></div>
<br/><br/>
If your bandmates are not on JamKazam yet, use any of the options below to invite them to join the service.<br/><br/>
<div class="left mr20">
<div class="left">
@ -103,16 +104,16 @@
</div>
<div class="right mt5 ml5">E-mail</div>
</div>
<!--
<div class="left mr20">
<div class="left">
<a id="btn-facebook-invitation">
<a class="btn-facebook-invitation">
<%= image_tag("content/icon_facebook.png", :size => "24x24", :align => "absmiddle") %>
</a>
</div>
<div class="right mt5 ml5">Facebook</div>
</div>
-->
<!-- <div class="left mr20">
<div class="left">
<a href="/client#/createSession" title="This feature is not yet available.">

View File

@ -50,6 +50,7 @@
<span class="recording-count">{recording_count} <img src="../assets/content/icon_recordings.png" width="12" height="13" align="absmiddle" style="margin-right:4px;"/></span>
<span class="session-count">{session_count} <img src="../assets/content/icon_session_tiny.png" width="12" height="12" align="absmiddle" /></span>
</div>
<div class="clearall"></div>
<div class="result-list-button-wrapper" data-band-id={band_id}>
{band_action_template}
</div>
@ -65,6 +66,12 @@
<a href="#" class="{button_follow} smallbutton search-m-follow">FOLLOW</a>
</script>
<script type="text/template" id="template-band-edit-btns">
<a href="{profile_url}" class="button-orange smallbutton">PROFILE</a>
<a href="{band_edit_url}" class="button-orange smallbutton">EDIT BAND</a>
<a href="{band_member_url}" class="button-orange smallbutton">INVITE MEMBERS</a>
</script>
<script type="text/template" id="template-band-player-info">
<tr>
<td>