VRFS-1562 make avatars clickable links (this commit addresses Feed and comment dialog only)
This commit is contained in:
parent
2b7ef1df55
commit
4e188d74b7
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -126,6 +126,9 @@
|
|||
$feedItem.data('original-max-height', $feedItem.css('height'));
|
||||
|
||||
events();
|
||||
|
||||
context.JK.bindHoverEvents($feedItem);
|
||||
//context.JK.bindProfileClickEvents($feedItem);
|
||||
}
|
||||
|
||||
initialize();
|
||||
|
|
|
|||
|
|
@ -112,6 +112,9 @@
|
|||
$feedItem.data('original-max-height', $feedItem.css('height'));
|
||||
|
||||
events();
|
||||
|
||||
context.JK.bindHoverEvents($feedItem);
|
||||
//context.JK.bindProfileClickEvents($feedItem);
|
||||
}
|
||||
|
||||
initialize();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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}}'
|
||||
|
|
|
|||
Loading…
Reference in New Issue