diff --git a/web/app/assets/javascripts/commentDialog.js b/web/app/assets/javascripts/commentDialog.js index cdb8e2167..702f52c80 100644 --- a/web/app/assets/javascripts/commentDialog.js +++ b/web/app/assets/javascripts/commentDialog.js @@ -17,6 +17,7 @@ } function afterShow(data) { + $("#txtComment", $screen).val(''); renderComments(); } @@ -25,7 +26,7 @@ function renderComments() { $content.empty(); - + var h1Text = $('h1', $screen).html('comment on this ' + entityType); if (entityType === 'session') { @@ -36,6 +37,8 @@ renderComment(val.comment, val.creator.id, val.creator.name, context.JK.resolveAvatarUrl(val.creator.photo_url), $.timeago(val.created_at), val.creator.musician, true); }); + context.JK.bindHoverEvents($content); + context.JK.bindProfileClickEvents($content, ['comment-dialog']); } }) .fail(function(xhr) { @@ -50,6 +53,9 @@ renderComment(val.comment, val.creator.id, val.creator.name, context.JK.resolveAvatarUrl(val.creator.photo_url), $.timeago(val.created_at), val.creator.musician, true); }); + + context.JK.bindHoverEvents($content); + context.JK.bindProfileClickEvents($content, ['comment-dialog']); } }) .fail(function(xhr) { @@ -101,7 +107,9 @@ } function events() { - $('#btn-add-comment', $screen).click(addComment); + var $btnSelector = $('#btn-add-comment', $screen); + $btnSelector.unbind('click'); + $btnSelector.click(addComment); } function showDialog() { diff --git a/web/app/assets/javascripts/feed.js b/web/app/assets/javascripts/feed.js index e6fd8030f..368bc81fb 100644 --- a/web/app/assets/javascripts/feed.js +++ b/web/app/assets/javascripts/feed.js @@ -354,6 +354,7 @@ $('.dotdotdot', $feedItem).dotdotdot(); $feedItem.data('original-max-height', $feedItem.css('height')); context.JK.bindHoverEvents($feedItem); + context.JK.bindProfileClickEvents($feedItem); } else if(feed.type == 'recording') { if(feed.claimed_recordings.length == 0) { @@ -401,6 +402,7 @@ $('.dotdotdot', $feedItem).dotdotdot(); $feedItem.data('original-max-height', $feedItem.css('height')); context.JK.bindHoverEvents($feedItem); + context.JK.bindProfileClickEvents($feedItem); } else { logger.warn("skipping feed type: " + feed.type); diff --git a/web/app/assets/javascripts/feed_item_recording.js b/web/app/assets/javascripts/feed_item_recording.js index 04e10d122..e9c138479 100644 --- a/web/app/assets/javascripts/feed_item_recording.js +++ b/web/app/assets/javascripts/feed_item_recording.js @@ -126,6 +126,9 @@ $feedItem.data('original-max-height', $feedItem.css('height')); events(); + + context.JK.bindHoverEvents($feedItem); + //context.JK.bindProfileClickEvents($feedItem); } initialize(); diff --git a/web/app/assets/javascripts/feed_item_session.js b/web/app/assets/javascripts/feed_item_session.js index 695d6aab3..c5a39246e 100644 --- a/web/app/assets/javascripts/feed_item_session.js +++ b/web/app/assets/javascripts/feed_item_session.js @@ -112,6 +112,9 @@ $feedItem.data('original-max-height', $feedItem.css('height')); events(); + + context.JK.bindHoverEvents($feedItem); + //context.JK.bindProfileClickEvents($feedItem); } initialize(); diff --git a/web/app/assets/javascripts/utils.js b/web/app/assets/javascripts/utils.js index dd5de4c3b..f7957024f 100644 --- a/web/app/assets/javascripts/utils.js +++ b/web/app/assets/javascripts/utils.js @@ -153,9 +153,39 @@ $element.bt(text, options); } + context.JK.bindProfileClickEvents = function($parent, dialogsToClose) { + if (!$parent) { + $parent = $('body'); + } + + function closeDialogs() { + if (dialogsToClose) { + $.each(dialogsToClose, function(index, val) { + JK.app.layout.closeDialog(val); + }); + } + } + + $("[profileaction='band']", $parent).unbind('click'); + $("[profileaction='band']", $parent).click(function(evt) { + closeDialogs(); + console.log("navigating to band profile %o", $(this).attr('band-id')); + context.location = "/client#/bandProfile/" + $(this).attr('band-id'); + }); + + $("[profileaction='musician']", $parent).unbind('click'); + $("[profileaction='musician']", $parent).click(function(evt) { + closeDialogs(); + console.log("navigating to musician profile %o", $(this).attr('user-id')); + context.location = "/client#/profile/" + $(this).attr('user-id'); + }); + } + context.JK.bindHoverEvents = function ($parent) { var timeout = 300; var fadeoutValue = 100; + var sensitivity = 3; + var interval = 500; if (!$parent) { $parent = $('body'); @@ -194,7 +224,8 @@ out: function () { // this registers for leaving the hoverable element hideBubble($(this)); }, - sensitivity: 1, + sensitivity: sensitivity, + interval: interval, timeout: timeout }); @@ -207,7 +238,8 @@ out: function () { // this registers for leaving the hoverable element hideBubble($(this)); }, - sensitivity: 1, + sensitivity: sensitivity, + interval: interval, timeout: timeout }); @@ -220,7 +252,8 @@ out: function () { // this registers for leaving the hoverable element hideBubble($(this)); }, - sensitivity: 1, + sensitivity: sensitivity, + interval: interval, timeout: timeout }); @@ -233,7 +266,8 @@ out: function () { // this registers for leaving the hoverable element hideBubble($(this)); }, - sensitivity: 1, + sensitivity: sensitivity, + interval: interval, timeout: timeout }); @@ -246,7 +280,8 @@ out: function () { // this registers for leaving the hoverable element hideBubble($(this)); }, - sensitivity: 1, + sensitivity: sensitivity, + interval: interval, timeout: timeout }); } diff --git a/web/app/views/clients/_commentDialog.html.haml b/web/app/views/clients/_commentDialog.html.haml index 084a550f7..065ba4cc4 100644 --- a/web/app/views/clients/_commentDialog.html.haml +++ b/web/app/views/clients/_commentDialog.html.haml @@ -17,10 +17,11 @@ .dialog-comment-scroller %script{type: 'text/template', id: 'template-comments'} - .avatar-small.mr10{'user-id' => '{{data.user_id}}', 'hoveraction' => '{{data.hoverAction}}'} - %img{:'src' => '{{data.avatar_url}}', alt: ''} + .avatar-small.mr10{'user-id' => '{{data.user_id}}', 'hoveraction' => '{{data.hoverAction}}', 'profileaction' => '{{data.hoverAction}}'} + %a{'href' => '/client#/profile/{{data.user_id}}'} + %img{:'src' => '{{data.avatar_url}}', alt: ''} .w80.left.p10.lightgrey.mt10.comment-text - %a{'user-id' => '{{data.user_id}}', 'hoveraction' => '{{data.hoverAction}}'} {{data.name}} + %a{'user-id' => '{{data.user_id}}', 'hoveraction' => '{{data.hoverAction}}', 'profileaction' => '{{data.hoverAction}}'} {{data.name}}  {{data.comment}} %br/ .f12.grey.mt5.comment-timestamp diff --git a/web/app/views/users/_feed_music_session_ajax.html.haml b/web/app/views/users/_feed_music_session_ajax.html.haml index 5cb7c5d4f..bc2b8ef04 100644 --- a/web/app/views/users/_feed_music_session_ajax.html.haml +++ b/web/app/views/users/_feed_music_session_ajax.html.haml @@ -2,13 +2,14 @@ .feed-entry.music-session-history-entry{'data-music-session' => '{{data.feed_item.id}}' } / avatar .avatar-small.ib - %img{ src: '{{data.feed_item.helpers.avatar}}' } + %a{:hoveraction => "{{data.feed_item.helpers.artist_hoveraction}}", :profileaction => "{{data.feed_item.helpers.artist_hoveraction}}", :"{{data.feed_item.helpers.artist_datakey}}" => "{{data.feed_item.helpers.artist_id}}"} + %img{ src: '{{data.feed_item.helpers.avatar}}' } / type and artist .left.ml20.w15 .title{:'session-id' => '{{data.feed_item.id}}' } %a{:href => "/sessions/{{data.feed_item.id}}", :rel => "external"} SESSION .artist - %a.artist{href: "#", :hoveraction => '{{data.feed_item.helpers.artist_hoveraction}}', :'{{data.feed_item.helpers.artist_datakey}}' => '{{data.feed_item.helpers.artist_id}}'} + %a.artist{:hoveraction => '{{data.feed_item.helpers.artist_hoveraction}}', :profileaction => "{{data.feed_item.helpers.artist_hoveraction}}", :'{{data.feed_item.helpers.artist_datakey}}' => '{{data.feed_item.helpers.artist_id}}'} = '{{data.feed_item.helpers.artist_name}}' %time.small.created_at.timeago{datetime: '{{data.feed_item.helpers.utc_created_at}}'}= '{{data.feed_item.created_at}}' / name and description diff --git a/web/app/views/users/_feed_recording_ajax.html.haml b/web/app/views/users/_feed_recording_ajax.html.haml index 1b5ddd703..b72758500 100644 --- a/web/app/views/users/_feed_recording_ajax.html.haml +++ b/web/app/views/users/_feed_recording_ajax.html.haml @@ -2,13 +2,14 @@ .feed-entry.recording-entry{:'data-claimed-recording-id' => '{{data.candidate_claimed_recording.id}}' } / avatar .avatar-small.ib - %img{ src: '{{data.feed_item.helpers.avatar}}' } + %a{:hoveraction => "{{data.feed_item.helpers.artist_hoveraction}}", :profileaction => "{{data.feed_item.helpers.artist_hoveraction}}", :"{{data.feed_item.helpers.artist_datakey}}" => "{{data.feed_item.helpers.artist_id}}"} + %img{ src: '{{data.feed_item.helpers.avatar}}' } / type and artist .left.ml20.w15 .title{:'recording-id' => '{{data.candidate_claimed_recording.id}}' } %a{:href => "/recordings/{{data.candidate_claimed_recording.id}}", :rel => "external"} RECORDING .artist - %a.artist{href: "#", :hoveraction => '{{data.feed_item.helpers.artist_hoveraction}}', :'{{data.feed_item.helpers.artist_datakey}}' => '{{data.feed_item.helpers.artist_id}}'} + %a.artist{:hoveraction => '{{data.feed_item.helpers.artist_hoveraction}}', :profileaction => "{{data.feed_item.helpers.artist_hoveraction}}", :'{{data.feed_item.helpers.artist_datakey}}' => '{{data.feed_item.helpers.artist_id}}'} = '{{data.feed_item.helpers.artist_name}}' %time.small.created_at.timeago{datetime: '{{data.feed_item.helpers.utc_created_at}}'} = '{{data.feed_item.created_at}}'