diff --git a/web/app/assets/javascripts/shareDialog.js b/web/app/assets/javascripts/shareDialog.js index cfa10cb41..47533deeb 100644 --- a/web/app/assets/javascripts/shareDialog.js +++ b/web/app/assets/javascripts/shareDialog.js @@ -5,6 +5,12 @@ context.JK.ShareDialog = function(app, entityId, entityType) { var logger = context.JK.logger; var rest = context.JK.Rest(); + var textMap = { + LIVE_SESSION: "LIVE SESSION", + SESSION: "SESSION", + RECORDING: "RECORDING", + RECORDED: "RECORDED" + }; function socialShare() { var shareWithFacebook = $('.share-with-facebook').is(':checked'); @@ -28,32 +34,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) { @@ -68,7 +79,6 @@ photoUrl = context.JK.resolveAvatarUrl(response.recording.owner.photo_url); } - console.log("band photo url=" + photoUrl); $("#imgWidgetCodeAvatar").attr('src', photoUrl); $("#imgWidgetPreviewAvatar").attr('src', photoUrl); @@ -78,9 +88,7 @@ $("#spnWidgetPreviewArtistName").html(name); $.each(response.recording.recorded_tracks, function(index, val) { - $(".widget-members").append('
'); + $(".widget-members").append(''); }); }); } @@ -106,6 +114,7 @@ }; app.bindDialog('share-dialog', dialogBindings); + initDialog(); }; this.initialize = initialize; diff --git a/web/app/assets/javascripts/user_dropdown.js b/web/app/assets/javascripts/user_dropdown.js index 807f154e2..2d7a57384 100644 --- a/web/app/assets/javascripts/user_dropdown.js +++ b/web/app/assets/javascripts/user_dropdown.js @@ -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); } diff --git a/web/app/assets/javascripts/web/recordings.js b/web/app/assets/javascripts/web/recordings.js index 51ed228f4..c49968e0f 100644 --- a/web/app/assets/javascripts/web/recordings.js +++ b/web/app/assets/javascripts/web/recordings.js @@ -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); diff --git a/web/app/assets/javascripts/web/sessions.js b/web/app/assets/javascripts/web/sessions.js index af7b8782d..853af4b20 100644 --- a/web/app/assets/javascripts/web/sessions.js +++ b/web/app/assets/javascripts/web/sessions.js @@ -20,6 +20,7 @@ .done(function(response) { $("#spnCommentCount").html(parseInt($("#spnCommentCount").text()) + 1); $(".landing-comment-scroller").prepend(comment); + $("#txtSessionComment").val("Enter a comment..."); }); } } @@ -40,6 +41,7 @@ $("#txtSessionComment").keypress(function(e) { if (e.which === 13) { addComment(); + this.val('') } }); } diff --git a/web/app/assets/stylesheets/client/shareDialog.css.scss b/web/app/assets/stylesheets/client/shareDialog.css.scss index 453798980..01a3294b4 100644 --- a/web/app/assets/stylesheets/client/shareDialog.css.scss +++ b/web/app/assets/stylesheets/client/shareDialog.css.scss @@ -12,6 +12,10 @@ h3 { } +td { + vertical-align:top !important; +} + .widget { width:430px; height:180px; diff --git a/web/app/views/api_claimed_recordings/show.rabl b/web/app/views/api_claimed_recordings/show.rabl index c487f0d22..d00a676a0 100644 --- a/web/app/views/api_claimed_recordings/show.rabl +++ b/web/app/views/api_claimed_recordings/show.rabl @@ -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) { diff --git a/web/app/views/clients/_shareDialog.html.erb b/web/app/views/clients/_shareDialog.html.erb index 917bf4415..9c114c0ec 100644 --- a/web/app/views/clients/_shareDialog.html.erb +++ b/web/app/views/clients/_shareDialog.html.erb @@ -1,29 +1,29 @@