use #mentions?user= for mentions, add new button to user profile.

calm theme needs some layout fixing for the new button (a sync with their repo is badly needed)
This commit is contained in:
Miguel Freitas 2014-11-14 18:39:33 -02:00
parent ce738a5315
commit 1a79865b77
3 changed files with 30 additions and 11 deletions

View File

@ -59,16 +59,17 @@
}
.profile-card .direct-messages,
.profile-card .direct-messages-with-user,
.profile-card .mentions-from-user,
.profile-card .follow,
.profile-card .profileUnfollow
{
display: block;
position: absolute;
bottom: 20px;
right: 10px;
right: 125px;
padding: 10px;
font-size: 12px;
width: 120px;
width: 110px;
text-align: center;
color: rgba( 0, 0, 0, .7 );
background: rgba( 0, 0, 0, .1 );
@ -78,7 +79,11 @@
.profile-card .follow,
.profile-card .profileUnfollow
{
right: 135px;
right: 240px;
}
.profile-card .mentions-from-user
{
right: 10px;
}
.profile-card .profileUnfollow
{
@ -86,6 +91,7 @@
}
.profile-card .direct-messages:hover,
.profile-card .direct-messages-with-user:hover,
.profile-card .mentions-from-user:hover,
.profile-card .follow:hover
{
background: rgba( 0, 0, 0, .3 );
@ -310,6 +316,7 @@
*/
.profile-modal .direct-messages,
.profile-modal .direct-messages-with-user,
.profile-modal .mentions-from-user,
.profile-modal .follow,
.profile-modal .profileUnfollow
{

View File

@ -444,6 +444,7 @@
</div>
<button class="followButton follow" href="#">Follow</button>
<button class="direct-messages-with-user" href="#">Direct Messages</button>
<button class="mentions-from-user" href="#">Mentions</a>
</div>
<div class="who-follow"></div>
</div>

View File

@ -209,10 +209,6 @@ function openMentionsModal(e)
alert(polyglot.t("No one can mention you because you are not logged in."));
return;
}
// reuse the same hashtag modal to show mentions
var hashtagModalClass = "hashtag-modal";
openModal( hashtagModalClass );
$( "."+hashtagModalClass ).attr("data-resource","mention");
var username;
var $userInfo = $(this).closest("[data-screen-name]");
@ -221,15 +217,27 @@ function openMentionsModal(e)
else
username = defaultScreenName;
window.location.hash = '#mentions?user=' + username;
}
function openMentionsModalHandler(username)
{
// reuse the same hashtag modal to show mentions
var hashtagModalClass = "hashtag-modal";
openModal( hashtagModalClass );
$( "."+hashtagModalClass ).attr("data-resource","mention");
var hashtagModalContent = newHashtagModal( username );
hashtagModalContent.appendTo("." +hashtagModalClass + " .modal-content");
//título do modal
$( "."+hashtagModalClass + " h3" ).text( polyglot.t("users_mentions", { username: username }) );
// obtain already cached mention posts from twister_newmsgs.js
processHashtag(hashtagModalContent.find(".postboard-posts"), defaultScreenName, getMentionsData() );
resetMentionsCount();
if( username == defaultScreenName ) {
// obtain already cached mention posts from twister_newmsgs.js
processHashtag(hashtagModalContent.find(".postboard-posts"), defaultScreenName, getMentionsData() );
resetMentionsCount();
}
}
function newFollowingModal(username) {
@ -375,7 +383,7 @@ function watchHashChange(e)
var hashdata = hashstring.split(':');
if (hashdata[0] != '#web+twister') {
hashdata = hashstring.match(/(hashtag|profile)\?(?:user|hashtag)=(.+)/);
hashdata = hashstring.match(/(hashtag|profile|mentions)\?(?:user|hashtag)=(.+)/);
}
if (hashdata && hashdata[1] != undefined && hashdata[2] != undefined)
@ -384,6 +392,8 @@ function watchHashChange(e)
openProfileModalWithUsernameHandler(hashdata[2]);
}else if (hashdata[1] == 'hashtag') {
openHashtagModalFromSearchHandler(hashdata[2]);
}else if (hashdata[1] == 'mentions') {
openMentionsModalHandler(hashdata[2]);
}
} else {
closeModalHandler();
@ -1381,6 +1391,7 @@ function initInterfaceCommon() {
$( ".open-hashtag-modal").bind( "click", openHashtagModal );
$( ".open-following-modal").bind( "click", openFollowingModal );
$( ".userMenu-connections a").bind( "click", openMentionsModal );
$( ".mentions-from-user").bind( "click", openMentionsModal );
replaceDashboards();