diff --git a/web/app/assets/javascripts/feed.js b/web/app/assets/javascripts/feed.js index 77a073e95..cc176e06a 100644 --- a/web/app/assets/javascripts/feed.js +++ b/web/app/assets/javascripts/feed.js @@ -282,6 +282,23 @@ return false; } + function toggleUserProfile() { + var userId = $(this).attr('user-id'); + window.location = '/client#/profile/' + userId; + return false; + } + + function toggleBandProfile() { + var bandId = $(this).attr('band-id'); + if (bandId == null) { + var userId = $(this).attr('user-id'); + window.location = '/client#/profile/' + userId; + } + else { + window.location = '/client#/bandProfile/' + bandId; + } + return false; + } function renderFeeds(feeds) { @@ -302,6 +319,9 @@ $('.details', $feedItem).click(toggleSessionDetails); $('.details-arrow', $feedItem).click(toggleSessionDetails); $('.play-button', $feedItem).click(toggleSessionPlay); + $('.avatar-tiny', $feedItem).click(toggleUserProfile); + $('.musician-name', $feedItem).click(toggleUserProfile); + $('.artist', $feedItem).click(toggleBandProfile); // put the feed item on the page renderFeed($feedItem); diff --git a/web/app/assets/stylesheets/web/audioWidgets.css.scss b/web/app/assets/stylesheets/web/audioWidgets.css.scss index a21ce84e6..9803796b5 100644 --- a/web/app/assets/stylesheets/web/audioWidgets.css.scss +++ b/web/app/assets/stylesheets/web/audioWidgets.css.scss @@ -241,6 +241,7 @@ margin-bottom:10px; overflow: hidden; white-space: nowrap; + text-decoration: none; } .name { diff --git a/web/app/helpers/feeds_helper.rb b/web/app/helpers/feeds_helper.rb index 22e68b01f..2929b89e2 100644 --- a/web/app/helpers/feeds_helper.rb +++ b/web/app/helpers/feeds_helper.rb @@ -3,6 +3,18 @@ module FeedsHelper (music_session_history.band.nil? ? nil : music_session_history.band.name) || music_session_history.user.name end + def session_artist_id(music_session_history) + (music_session_history.band.nil? ? nil : music_session_history.band.id) || music_session_history.user.id + end + + def session_artist_hoveraction(music_session_history) + music_session_history.band.nil? ? 'musician' : 'band' + end + + def session_artist_datakey(music_session_history) + music_session_history.band.nil? ? 'user-id' : 'band-id' + end + def session_avatar(music_session_history) image_tag resolve_avatarables(music_session_history.band, music_session_history.user) end @@ -50,6 +62,18 @@ module FeedsHelper (recording.band.nil? ? nil : recording.band.name) || recording.candidate_claimed_recording.user.name end + def recording_artist_id(recording) + (recording.band.nil? ? nil : recording.band.id) || recording.candidate_claimed_recording.user.id + end + + def recording_artist_hoveraction(recording) + recording.band.nil? ? 'musician' : 'band' + end + + def recording_artist_datakey(recording) + recording.band.nil? ? 'user-id' : 'band-id' + end + def recording_avatar(recording) image_tag resolve_avatarables(recording.band, recording.owner) end diff --git a/web/app/views/api_feeds/show.rabl b/web/app/views/api_feeds/show.rabl index 40a99a51e..eaa514c05 100644 --- a/web/app/views/api_feeds/show.rabl +++ b/web/app/views/api_feeds/show.rabl @@ -14,6 +14,9 @@ glue :music_session_history do helpers: { avatar: asset_path(resolve_avatarables(history.band, history.user)), artist_name: session_artist_name(history), + artist_id: session_artist_id(history), + artist_datakey: session_artist_datakey(history), + artist_hoveraction: session_artist_hoveraction(history), utc_created_at: history.created_at.getutc.iso8601, description: session_description(history), status: session_text(history), @@ -81,6 +84,9 @@ glue :recording do helpers: { avatar: asset_path(resolve_avatarables(recording.band, recording.owner)), artist_name: recording_artist_name(recording), + artist_id: recording_artist_id(recording), + artist_hoveraction: recording_artist_hoveraction(recording), + artist_datakey: recording_artist_datakey(recording), utc_created_at: recording.created_at.getutc.iso8601, name: recording_name(recording), description: recording_description(recording), 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 4d830d18b..58d32ca4b 100644 --- a/web/app/views/users/_feed_music_session_ajax.html.haml +++ b/web/app/views/users/_feed_music_session_ajax.html.haml @@ -6,7 +6,7 @@ / type and artist .left.ml20.w15 .title{hoveraction: 'session', :'session-id' => '{{data.feed_item.id}}' } SESSION - .artist + %a.artist{href: "#", :hoveraction => '{{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 @@ -55,10 +55,10 @@ = '{% _.each(data.feed_item.participants, function(user) { %}' %tr %td{:width => "24"} - %a.avatar-tiny{:href => "#"} + %a.avatar-tiny{:href => "#", :hoveraction => "musician", :'user-id' => '{{user.id}}'} %img{src: '{{user.helpers.avatar}}'} %td - %a{:href => "#"} + %a.musician-name{:href => "#", :hoveraction => "musician", :'user-id' => '{{user.id}}'} = '{{user.first_name}} {{user.last_name}}' %td .nowrap diff --git a/web/app/views/users/_feed_recording_ajax.html.haml b/web/app/views/users/_feed_recording_ajax.html.haml index 974734d35..66595e900 100644 --- a/web/app/views/users/_feed_recording_ajax.html.haml +++ b/web/app/views/users/_feed_recording_ajax.html.haml @@ -6,7 +6,7 @@ / type and artist .left.ml20.w15 .title{hoveraction: 'recording', :'recording-id' => '{{data.candidate_claimed_recording.id}}' } RECORDING - .artist + %a.artist{href: "#", :hoveraction => '{{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}}' @@ -75,10 +75,10 @@ = '{% _.each(data.feed_item.grouped_tracks, function(track) { %}' %tr %td{:width => "24"} - %a.avatar-tiny{:href => "#"} + %a.avatar-tiny{:href => "#", :hoveraction => "musician", :"user-id" => '{{track.musician.id}}'} %img{src: '{{track.musician.helpers.avatar}}'} %td - %a{:href => "#"} + %a.musician-name{:href => "#", :hoveraction => "musician", :"user-id" => '{{track.musician.id}}'} = '{{track.musician.first_name}} {{track.musician.last_name}}' %td .nowrap