Merge branch 'develop' into vrfs1576

This commit is contained in:
Jonathan Kolyer 2014-04-21 03:55:43 +00:00
commit c81e581786
10 changed files with 1173 additions and 9 deletions

View File

@ -182,7 +182,7 @@
band = response;
if (band) {
// name
$('#band-profile-name').html(band.name);
$('#band-profile-name').text(band.name);
// avatar
$('#band-profile-avatar').attr('src', context.JK.resolveAvatarUrl(band.photo_url));
@ -200,7 +200,7 @@
text = band.recording_count > 1 || band.recording_count == 0 ? " Recordings" : " Recording";
$('#band-profile-recording-stats').html(band.recording_count + text);
$('#band-profile-biography').html(band.biography);
$('#band-profile-biography').text(band.biography);
// wire up Follow click
configureBandFollowingButton(band.is_following);

View File

@ -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);

View File

@ -241,6 +241,7 @@
margin-bottom:10px;
overflow: hidden;
white-space: nowrap;
text-decoration: none;
}
.name {

View File

@ -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

View File

@ -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),

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -115,7 +115,6 @@ describe "Bands", :js => true, :type => :feature, :capybara_feature => true do
end
it "handles special characters in text fields" do
pending "update this after VRFS-1609 is resolved"
navigate_band_setup
band_name = garbage(3) + ' ' + garbage(50)
band_bio = garbage(500)

View File

@ -31,11 +31,20 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
find('.feed-details a.details').trigger(:click)
# confirm user avatar exists
find("a.avatar-tiny[user-id=\"#{user.id}\"][hoveraction=\"musician\"] img")
# confirm user name exists
find("a.musician-name[user-id=\"#{user.id}\"][hoveraction=\"musician\"]", text: user.name)
# confirm instrument icons exist
find("img[instrument-id=\"electric guitar\"]")
# confirm hover bubbles show
find("a.avatar-tiny[user-id=\"#{user.id}\"][hoveraction=\"musician\"]").hover_intent
# confirm navigate to user profile page
find(".avatar-tiny[user-id=\"#{user.id}\"][hoveraction=\"musician\"]").trigger(:click)
find("#user-profile h2[id=profile-username]", text: user.name)
end
# it "should render play widget" do
@ -63,14 +72,29 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
it "should render details" do
visit "/client#/feed"
# close recording finished dialog
find('#recording-finished-dialog h1')
find('#discard-session-recording').trigger(:click)
find('.feed-details a.details').trigger(:click)
# confirm user avatar exists
find("a.avatar-tiny[user-id=\"#{user.id}\"][hoveraction=\"musician\"] img")
# confirm user name exists
find("a.musician-name[user-id=\"#{user.id}\"][hoveraction=\"musician\"]", text: user.name)
# confirm instrument icons exist
find("img[instrument-id=\"electric guitar\"]")
# confirm hover bubbles show
find("a.avatar-tiny[user-id=\"#{user.id}\"][hoveraction=\"musician\"]").hover_intent
# confirm navigate to user profile page
find(".avatar-tiny[user-id=\"#{user.id}\"][hoveraction=\"musician\"]").trigger(:click)
find("#user-profile h2[id=profile-username]", text: user.name)
end
# it "should render play widget" do