This commit is contained in:
Seth Call 2014-02-05 11:20:18 +00:00
commit 10573fd37a
13 changed files with 90 additions and 25 deletions

View File

@ -8,6 +8,13 @@
var facebookRest = context.JK.FacebookRest();
var facebookHelper = null;
var textMap = {
LIVE_SESSION: "LIVE SESSION",
SESSION: "SESSION",
RECORDING: "RECORDING",
RECORDED: "RECORDED"
};
function handleShareWithFacebook() {
facebookHelper.promptLogin()
.done(function(response) {
@ -30,7 +37,6 @@
}
})
}
function socialShare() {
var shareWithFacebook = $('.share-with-facebook').is(':checked');
var shareWithGoogle = $('.share-with-google').is(':checked');
@ -61,32 +67,37 @@
}
function initDialog() {
var sessionText = textMap.SESSION;
var liveSessionText = textMap.LIVE_SESSION;
var fill = entityType === "session" ? "teal-fill" : "orange-fill";
var fill = entityType === sessionText.toLowerCase() ? "teal-fill" : "orange-fill";
$("#shareType").html(entityType);
$("#shareType").text(entityType);
$("#divWidgetCodeHeader").addClass(fill);
$("#divWidgetPreviewHeader").addClass(fill);
$("#divWidgetPreview").addClass(entityType);
// SESSION
if (entityType === "session") {
$("#lblWidgetCodeType").html('LIVE SESSION');
$("#lblWidgetPreviewType").html('LIVE SESSION');
if (entityType === sessionText.toLowerCase() ) {
$("#lblWidgetCodeType").html(sessionText.toLowerCase());
$("#lblWidgetPreviewType").html(sessionText.toLowerCase());
$("#spnWidgetCodeBranding").text(liveSessionText.toLowerCase());
$("#spnWidgetPreviewBranding").text(liveSessionText.toLowerCase());
rest.getSessionHistory(entityId)
.done(function(response) {
var name, photoUrl;
});
}
// RECORDING
else {
$("#lblWidgetCodeType").html('RECORDING');
$("#lblWidgetPreviewType").html('RECORDING');
var recordedText = textMap.RECORDED.toLowerCase();
$("#lblWidgetCodeType").text(textMap.RECORDING);
$("#lblWidgetPreviewType").text(textMap.RECORDING);
$("#spnWidgetCodeBranding").text(recordedText);
$("#spnWidgetPreviewBranding").text(recordedText);
rest.getClaimedRecording(entityId)
.done(function(response) {
@ -101,7 +112,6 @@
photoUrl = context.JK.resolveAvatarUrl(response.recording.owner.photo_url);
}
console.log("band photo url=" + photoUrl);
$("#imgWidgetCodeAvatar").attr('src', photoUrl);
$("#imgWidgetPreviewAvatar").attr('src', photoUrl);
@ -111,9 +121,7 @@
$("#spnWidgetPreviewArtistName").html(name);
$.each(response.recording.recorded_tracks, function(index, val) {
$(".widget-members").append('<div class="widget-avatar-small">');
$(".widget-members").append('<img src="' + context.JK.resolveAvatarUrl(val.user.photo_url) + '" alt="" />');
$(".widget-members").append('</div>');
$(".widget-members").append('<div class="widget-avatar-small">' + '<img src="' + context.JK.resolveAvatarUrl(val.user.photo_url) + '" alt="" />' + '</div>');
});
});
}
@ -141,6 +149,7 @@
};
app.bindDialog('share-dialog', dialogBindings);
initDialog();
};
this.initialize = initialize;

View File

@ -79,7 +79,6 @@
// initially show avatar
function showAvatar() {
var photoUrl = context.JK.resolveAvatarUrl(userMe.photo_url);
logger.debug("photoUrl=" + photoUrl);
$('#header-avatar').attr('src', photoUrl);
}

View File

@ -27,7 +27,17 @@
rest.addRecordingComment(recordingId, JK.currentUserId, comment)
.done(function(response) {
$("#spnCommentCount").html(parseInt($("#spnCommentCount").text()) + 1);
$(".landing-comment-scroller").prepend(comment);
var template = $('#template-landing-comment').html();
var commentHtml = context.JK.fillTemplate(template, {
avatar_url: context.JK.currentUserAvatarUrl,
name: context.JK.currentUserName,
comment: comment
});
$(".landing-comment-scroller").prepend(commentHtml);
$("#txtRecordingComment").val("Enter a comment...");
});
}
}
@ -37,7 +47,6 @@
claimedRecordingId = _claimedRecordingId;
if (JK.currentUserId) {
var shareDialog = new JK.ShareDialog(JK.app, claimedRecordingId, "recording");
shareDialog.initialize(context.JK.FacebookHelperInstance);

View File

@ -19,7 +19,17 @@
rest.addSessionComment(sessionId, JK.currentUserId, comment)
.done(function(response) {
$("#spnCommentCount").html(parseInt($("#spnCommentCount").text()) + 1);
$(".landing-comment-scroller").prepend(comment);
var template = $('#template-landing-comment').html();
var commentHtml = context.JK.fillTemplate(template, {
avatar_url: context.JK.currentUserAvatarUrl,
name: context.JK.currentUserName,
comment: comment
});
$(".landing-comment-scroller").prepend(commentHtml);
$("#txtSessionComment").val("Enter a comment...");
});
}
}
@ -40,6 +50,7 @@
$("#txtSessionComment").keypress(function(e) {
if (e.which === 13) {
addComment();
this.val('')
}
});
}

View File

@ -12,6 +12,10 @@ h3 {
}
td {
vertical-align:top !important;
}
.widget {
width:430px;
height:180px;

View File

@ -18,7 +18,7 @@ child(:recording => :recording) {
}
child(:mixes => :mixes) {
attributes :id, :mp3_url, :ogg_url :is_completed
attributes :id, :mp3_url, :ogg_url, :is_completed
}
child(:recorded_tracks => :recorded_tracks) {

View File

@ -1,11 +1,12 @@
<!-- Share dialog -->
<div class="dialog share-overlay" layout="dialog" layout-id="share-dialog" id="share-dialog" style="width:800px; height:auto;">
<div class="content-head"><h1> <span id="shareType"></span></h1></div>
<div class="content-head"><h1>share this <span id="shareType"></span></h1></div>
<div class="dialog-inner">
<div class="right"> <a class="button-orange" layout-action="close">X CLOSE</a></div>
<table class="w100">
<tr>
<td valign="top" width="45%" class="border-right"><h3 class="mb5">Share to Social Media:</h3>
<textarea class="w95" rows="3">Add a Message...</textarea><br />
<div class="left share-options">
<input type="checkbox" class="share-with-facebook"/>
@ -21,9 +22,9 @@
<td valign="top" width="48%">
<div class="ml10">
<h3>Share a Link:</h3><br />
<% unless # share_token.blank? %>
<% unless share_token.blank? %>
<%= "#{root_url}#{share_token}" %>
<% end %>
<% end %><br/><br/>
<div class="right"><a class="button-orange">COPY LINK</a></div>
</div>
</td>
@ -75,7 +76,7 @@
<a href="#"><img class="space" src="images/content/icon_share.png" width="13" height="15" alt=""/>&nbsp;&nbsp;SHARE</a>
</div>
<!-- jamkazam branding -->
<div class="widget-branding">recorded on
<div class="widget-branding"><span id="spnWidgetCodeBranding"></span> on
<a href="http://jamkazam.com"><img src="images/shared/jk_logo_small.png" alt="" width="142" height="26" align="absbottom"/></a>
</div>
</div>
@ -104,7 +105,7 @@
<div class="widget-members"></div>
<!-- jamkazam branding -->
<div class="widget-branding"><span id="spnWidgetPreview" on
<div class="widget-branding"><span id="spnWidgetPreviewBranding"></span> on
<a href=<%= "#{root_url}" %>>
<%= image_tag "shared/jk_logo_small.png", :size => "142x26", :align => "absbottom", :alt => "" %>
</a>

View File

@ -85,8 +85,12 @@
<% if current_user %>
JK.currentUserId = '<%= current_user.id %>';
JK.currentUserAvatarUrl = JK.resolveAvatarUrl('<%= current_user.photo_url %>');
JK.currentUserName = '<%= current_user.name %>';
<% else %>
JK.currentUserId = null;
JK.currentUserAvatarUrl = null;
JK.currentUserName = null;
<% end %>

View File

@ -46,8 +46,12 @@
<% if current_user %>
JK.currentUserId = '<%= current_user.id %>';
JK.currentUserAvatarUrl = JK.resolveAvatarUrl('<%= current_user.photo_url %>');
JK.currentUserName = '<%= current_user.name %>';
<% else %>
JK.currentUserId = null;
JK.currentUserAvatarUrl = null;
JK.currentUserName = null;
<% end %>
})
</script>

View File

@ -61,8 +61,12 @@
<% if current_user %>
JK.currentUserId = '<%= current_user.id %>';
JK.currentUserAvatarUrl = JK.resolveAvatarUrl('<%= current_user.photo_url %>');
JK.currentUserName = '<%= current_user.name %>';
<% else %>
JK.currentUserId = null;
JK.currentUserAvatarUrl = null;
JK.currentUserName = null;
<% end %>
})
</script>

View File

@ -43,8 +43,12 @@
<% if current_user %>
JK.currentUserId = '<%= current_user.id %>';
JK.currentUserAvatarUrl = JK.resolveAvatarUrl('<%= current_user.photo_url %>');
JK.currentUserName = '<%= current_user.name %>';
<% else %>
JK.currentUserId = null;
JK.currentUserAvatarUrl = null;
JK.currentUserName = null;
<% end %>
})
</script>

View File

@ -59,8 +59,12 @@
<% if current_user %>
JK.currentUserId = '<%= current_user.id %>';
JK.currentUserAvatarUrl = JK.resolveAvatarUrl('<%= current_user.photo_url %>');
JK.currentUserName = '<%= current_user.name %>';
<% else %>
JK.currentUserId = null;
JK.currentUserAvatarUrl = null;
JK.currentUserName = null;
<% end %>
JK.app = JK.JamKazam();

View File

@ -25,4 +25,16 @@
<br clear="all" />
<% end %>
</div>
</div>
</div>
<script type="text/template" id="template-landing-comment">
<div class="avatar-small mr10">
<img src="{avatar_url}" alt="" />
</div>
<div class="w80 left p10 lightgrey mt10">
<a href="#">{name}</a>&nbsp;{comment}
<br />
<div class="f12 grey mt5">Just now</div>
</div>
<br clear="all" />
</script>