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

1
home.html

@ -444,6 +444,7 @@ @@ -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>

21
js/interface_common.js

@ -209,10 +209,6 @@ function openMentionsModal(e) @@ -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) @@ -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 }) );
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) @@ -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) @@ -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() { @@ -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();

Loading…
Cancel
Save