vrfs-916: added toggles for fan/musician; misc fan tweaks
This commit is contained in:
parent
4b3b8491b3
commit
0ecbf9f047
|
|
@ -74,7 +74,11 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
function configUserType() {
|
||||
function isCurrentUser() {
|
||||
return userId === context.JK.currentUserId;
|
||||
}
|
||||
|
||||
function configureUserType() {
|
||||
if (isMusician()) {
|
||||
$('#profile-history-link').show();
|
||||
$('#profile-bands-link').show();
|
||||
|
|
@ -82,11 +86,11 @@
|
|||
$('#profile-session-stats').show();
|
||||
$('#profile-recording-stats').show();
|
||||
|
||||
$('#profile-following-stats').hide();
|
||||
$('#profile-favorites-stats').hide();
|
||||
// $('#profile-following-stats').hide();
|
||||
// $('#profile-favorites-stats').hide();
|
||||
|
||||
$('#btn-add-friend').show();
|
||||
$('#profile-social-left').show();
|
||||
$('.profile-social-left').show();
|
||||
|
||||
$('#profile-type-label').text('musician');
|
||||
$('#profile-location-label').text('Location');
|
||||
|
|
@ -98,20 +102,28 @@
|
|||
$('#profile-session-stats').hide();
|
||||
$('#profile-recording-stats').hide();
|
||||
|
||||
$('#profile-following-stats').show();
|
||||
$('#profile-favorites-stats').show();
|
||||
// $('#profile-following-stats').show();
|
||||
// $('#profile-favorites-stats').show();
|
||||
|
||||
$('#btn-add-friend').hide();
|
||||
$('#profile-social-left').hide();
|
||||
$('.profile-social-left').hide();
|
||||
|
||||
$('#profile-type-label').text('fan');
|
||||
$('#profile-location-label').text('Presence');
|
||||
}
|
||||
|
||||
if (isCurrentUser()) {
|
||||
$('#btn-profile-edit').show();
|
||||
} else {
|
||||
$('#btn-profile-edit').hide();
|
||||
}
|
||||
}
|
||||
|
||||
/****************** MAIN PORTION OF SCREEN *****************/
|
||||
// events for main screen
|
||||
function events() {
|
||||
configureUserType();
|
||||
|
||||
// wire up panel clicks
|
||||
$('#profile-about-link').click(renderAbout);
|
||||
$('#profile-history-link').click(renderHistory);
|
||||
|
|
@ -120,14 +132,12 @@
|
|||
$('#profile-favorites-link').click(renderFavorites);
|
||||
|
||||
// wire up buttons if you're not viewing your own profile
|
||||
if (userId != context.JK.currentUserId) {
|
||||
if (!isCurrentUser()) {
|
||||
// wire up Add Friend click
|
||||
var friend = isFriend();
|
||||
configureFriendButton(friend);
|
||||
configureFriendButton(isFriend());
|
||||
|
||||
// wire up Follow click
|
||||
var following = isFollowing();
|
||||
configureFollowingButton(following);
|
||||
configureFollowingButton(isFollowing());
|
||||
}
|
||||
else {
|
||||
$('#btn-add-friend').hide();
|
||||
|
|
@ -248,6 +258,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
function configureEditProfileButton() {
|
||||
$('#btn-follow-user').click(addFollowing);
|
||||
}
|
||||
|
||||
// refreshes the currently active tab
|
||||
function renderActive() {
|
||||
if ($('#profile-about-link').hasClass('active')) {
|
||||
|
|
@ -287,7 +301,6 @@
|
|||
$('#profile-instruments').empty();
|
||||
|
||||
if (getUser()) {
|
||||
configUserType();
|
||||
// name
|
||||
$('#profile-username').html(user.name);
|
||||
|
||||
|
|
@ -325,7 +338,7 @@
|
|||
text = user.follower_count > 1 || user.follower_count === 0 ? " Followers" : " Follower";
|
||||
$('#profile-follower-stats').html(user.follower_count + text);
|
||||
|
||||
if (user.musician === true) {
|
||||
if (isMusician()) {
|
||||
text = user.session_count > 1 || user.session_count === 0 ? " Sessions" : " Session";
|
||||
$('#profile-session-stats').html(user.session_count + text);
|
||||
|
||||
|
|
@ -334,6 +347,8 @@
|
|||
} else {
|
||||
text = " Following";
|
||||
$('#profile-following-stats').html(user.following_count + text);
|
||||
text = user.favorite_count > 1 || user.favorite_count === 0 ? " Favorites" : " Favorite";
|
||||
$('#profile-favorite-stats').html(user.favorite_count + text);
|
||||
}
|
||||
|
||||
$('#profile-biography').html(user.biography);
|
||||
|
|
@ -358,6 +373,12 @@
|
|||
$('.profile-nav a.active').removeClass('active');
|
||||
$('.profile-nav a.#profile-social-link').addClass('active');
|
||||
|
||||
/*if (isMusician()) {
|
||||
$('.profile-social-left').show();
|
||||
} else {
|
||||
$('.profile-social-left').hide();
|
||||
}*/
|
||||
|
||||
bindSocial();
|
||||
}
|
||||
|
||||
|
|
@ -501,7 +522,7 @@
|
|||
async: false,
|
||||
processData:false,
|
||||
success: function(response) {
|
||||
if ( (!response || response.length === 0) && context.JK.currentUserId === userId) {
|
||||
if ( (!response || response.length === 0) && isCurrentUser()) {
|
||||
var noBandHtml = $('#template-no-bands').html();
|
||||
$("#profile-bands").append(noBandHtml);
|
||||
}
|
||||
|
|
@ -567,7 +588,7 @@
|
|||
}
|
||||
|
||||
function addMoreBandsLink() {
|
||||
if (context.JK.currentUserId === userId) {
|
||||
if (isCurrentUser()) {
|
||||
var moreBandsHtml = $('#template-more-bands').html();
|
||||
$("#profile-bands").append(moreBandsHtml);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,10 @@ class ApiUsersController < ApiController
|
|||
end
|
||||
|
||||
def show
|
||||
@user = User.find(params[:id])
|
||||
@user = User.includes([{:musician_instruments => :instrument},
|
||||
{:band_musicians => :user},
|
||||
:bands, :instruments])
|
||||
.find(params[:id])
|
||||
respond_with @user, responder: ApiResponder, :status => 200
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
object @user
|
||||
|
||||
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :location, :online, :photo_url, :musician, :gender, :birth_date, :internet_service_provider, :friend_count, :liker_count, :like_count, :band_like_count, :follower_count, :following_count, :band_following_count, :recording_count, :session_count, :biography
|
||||
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :location, :online, :photo_url, :musician, :gender, :birth_date, :internet_service_provider, :friend_count, :liker_count, :like_count, :band_like_count, :follower_count, :following_count, :band_following_count, :recording_count, :session_count, :biography, :favorite_count
|
||||
|
||||
if @user.musician?
|
||||
node :location do @user.location end
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@
|
|||
<br clear="all" />
|
||||
|
||||
<hr />
|
||||
|
||||
<% if current_user && current_user.musician? %>
|
||||
|
||||
<div class="account-left">
|
||||
<h2>payments:</h2>
|
||||
|
|
@ -106,6 +108,8 @@
|
|||
<a id="account-edit-audio-link" href="#" class="button-orange">UPDATE</a>
|
||||
</div>
|
||||
<br clear="all" />
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<!-- end content wrapper -->
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
<div class="right">
|
||||
<a id="btn-add-friend" class="button-orange">ADD FRIEND</a>
|
||||
<a id="btn-follow-user" class="button-orange">FOLLOW</a>
|
||||
<%= link_to("EDIT PROFILE", '/client#/account/profile', :id => "btn-profile-edit", :class => "button-orange") %>
|
||||
</div>
|
||||
<br clear="all" /><br />
|
||||
|
||||
|
|
@ -53,6 +54,7 @@
|
|||
<span id="profile-friend-stats"></span><br />
|
||||
<span id="profile-follower-stats"></span><br />
|
||||
<span id="profile-following-stats"></span><br />
|
||||
<span id="profile-favorite-stats"></span><br />
|
||||
<span id="profile-session-stats"></span><br />
|
||||
<span id="profile-recording-stats"></span><br />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -18,8 +18,10 @@
|
|||
<li class="profile"><%= link_to "Profile", '/client#/account/profile' %></li>
|
||||
<!--<li class="subscriptions"><%= link_to "Subscriptions", '/client#/account/subscriptions' %></li> -->
|
||||
<!-- <li class="payments"><%= link_to "Payments", '/client#/account/payments' %></li> -->
|
||||
<li class="audio"><%= link_to "Audio Gear", '/client#/account/audio' %></li>
|
||||
<li class="band-setup"><%= link_to "Band Setup", '/client#/band/setup' %></li>
|
||||
<% if current_user && current_user.musician? %>
|
||||
<li class="audio"><%= link_to "Audio Gear", '/client#/account/audio' %></li>
|
||||
<li class="band-setup"><%= link_to "Band Setup", '/client#/band/setup' %></li>
|
||||
<% end %>
|
||||
<li class="invite-friends"><span class='menuheader'><span class="arrow-right"></span><%= link_to "Invite Friends", '#' %></span>
|
||||
<ul class="shortcuts-submenu">
|
||||
<li class="google-invite"><%= link_to "Google", '#' %></li>
|
||||
|
|
@ -37,4 +39,4 @@
|
|||
<a class="signin" href="/signin">Sign In</a>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue