hide Connect button for current user

This commit is contained in:
Brian Smith 2013-04-21 22:22:03 -04:00
parent 54f5a34cda
commit d7c401a294
5 changed files with 11 additions and 9 deletions

View File

@ -45,6 +45,7 @@
var searchResultHtml = context.JK.fillTemplate(template, {
userId: val.id,
avatar_url: context.JK.resolveAvatarUrl(val.photo_url),
profile_url: val.id,
userName: val.name,
location: val.location,
instruments: getInstrumentHtml(val.instruments)
@ -66,8 +67,8 @@
$('div[user-id=' + val.id + '].search-connected').hide();
$('div[user-id=' + val.id + '].search-result').show();
// wire up button click handler if search result is not a friend
if (!val.is_friend) {
// wire up button click handler if search result is not a friend or the current user
if (!val.is_friend && val.id !== context.JK.currentUserId) {
$('div[user-id=' + val.id + ']').find('#btn-connect-friend').click(sendFriendRequest);
}
else {

View File

@ -180,6 +180,7 @@
var searchResultHtml = context.JK.fillTemplate(template, {
userId: val.id,
avatar_url: context.JK.resolveAvatarUrl(val.photo_url),
profile_url: "/#/profile/" + val.id,
userName: val.name,
location: val.location
});
@ -200,8 +201,8 @@
$('div[layout=sidebar] div[user-id=' + val.id + '].sidebar-search-connected').hide();
$('div[layout=sidebar] div[user-id=' + val.id + '].sidebar-search-result').show();
// wire up button click handler if search result is not a friend
if (!val.is_friend) {
// wire up button click handler if search result is not a friend or the current user
if (!val.is_friend && val.id !== context.JK.currentUserId) {
$('div[layout=sidebar] div[user-id=' + val.id + ']').find('#btn-connect-friend').click(sendFriendRequest);
}
// hide the button if the search result is already a friend

View File

@ -3,11 +3,11 @@ class ApiUsersController < ApiController
before_filter :api_signed_in_user, :except => [:create, :signup_confirm, :auth_session_create, :complete]
before_filter :auth_user, :only => [:session_settings_show, :session_history_index, :session_user_history_index, :update, :delete,
:like_create, :like_destroy, # likes
:following_index, :following_create, :following_show, :following_destroy, :band_following_index, # followings
:following_create, :following_show, :following_destroy, :band_following_index, # followings
:recording_update, :recording_destroy, # recordings
:favorite_create, :favorite_destroy, # favorites
:friend_request_index, :friend_request_show, :friend_request_create, :friend_request_update, # friend requests
:friend_index, :friend_show, :friend_destroy, # friends
:friend_show, :friend_destroy, # friends
:notification_index, :notification_destroy, # notifications
:band_invitation_index, :band_invitation_show, :band_invitation_update, # band invitations
:set_password]

View File

@ -14,7 +14,7 @@
<div class="left ml35">
<a id="musician-search" href="#" class="search-nav active">MUSICIANS</a>
<a id="band-search" href="#" class="search-nav">BANDS</a>
<a id="fand-search" href="#" class="search-nav">FANS</a>
<a id="fan-search" href="#" class="search-nav">FANS</a>
<a id="recording-search" href="#" class="search-nav">RECORDINGS</a>
</div>
</div>
@ -27,7 +27,7 @@
<script type="text/template" id="template-search-result">
<div user-id="{userId}" class="search-result">
<a href="#" class="avatar-small"><img src="{avatar_url}" /></a>
<div class="search-result-name">{userName}<br />
<div class="search-result-name"><a href="{profile_url}">{userName}</a><br />
<span class="search-result-location">{location}</span>
</div>
<br clear="left" />

View File

@ -108,7 +108,7 @@
<script type="text/template" id="template-sidebar-search-result">
<div user-id="{userId}" class="sidebar-search-result">
<a class="avatar-small"><img src="{avatar_url}" /></a>
<div class="result-name">{userName}<br />
<div class="result-name"><a href="{profile_url}">{userName}</a><br />
<span class="result-location">{location}</span>
</div><br />
<a id="btn-connect-friend" class="button-orange smallbutton right">CONNECT</a>