Browse Source

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)
master
Miguel Freitas 10 years ago
parent
commit
1a79865b77
  1. 13
      css/profile.css
  2. 1
      home.html
  3. 21
      js/interface_common.js

13
css/profile.css

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

1
home.html

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

21
js/interface_common.js

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

Loading…
Cancel
Save