From 44e190bc4a5b5c0f34c5150ab1520d126c166417 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Tue, 16 Feb 2016 03:48:39 +0500 Subject: [PATCH] make link to more followers in profile to be openning followers modal --- home.html | 4 ++++ js/interface_common.js | 1 + js/twister_following.js | 33 ++++++++++----------------------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/home.html b/home.html index 94aede8..99970f5 100644 --- a/home.html +++ b/home.html @@ -664,6 +664,10 @@ +
+ +
+
diff --git a/js/interface_common.js b/js/interface_common.js index a6b8177..5316a19 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -2289,6 +2289,7 @@ $(document).ready(function () { .on('click', muteEvent) // to prevent post expanding or collapsing ; twister.tmpl.postRtBy = extractTemplate('#template-post-rt-by'); + twister.tmpl.profileShowMoreFollowers = extractTemplate('#template-profile-show-more-followers'); var path = window.location.pathname; var page = path.split("/").pop(); diff --git a/js/twister_following.js b/js/twister_following.js index 8573b59..bb78ff6 100644 --- a/js/twister_following.js +++ b/js/twister_following.js @@ -483,33 +483,20 @@ function fillWhoFollows(list, item, offset, size) { } } -function getWhoFollows(username, item) { - if (!defaultScreenName || typeof(defaultScreenName) === 'undefined') +function getWhoFollows(peerAlias, elem) { + if (!defaultScreenName) return; - var list = whoFollows(username); + var list = whoFollows(peerAlias); - fillWhoFollows(list, item, 0, (list.length > 5 ? 5 : list.length)); + fillWhoFollows(list, elem, 0, (list.length > 5 ? 5 : list.length)); - if (list.length > 5) { - var more_link = $('' + polyglot.t('show_more_count', {'smart_count': list.length - 5}) + ''); - more_link.on('click', function() { - fillWhoFollows(list, item, 5, list.length - 5); - - var $this = $(this); - $this.remove(); - - $this.text(polyglot.t('hide')); - $this.unbind('click'); - $this.bind('click', function() { - item.html(''); - getWhoFollows(username, item); - }); - - item.append($this); - }); - item.append(more_link); - } + if (list.length > 5) + twister.tmpl.profileShowMoreFollowers.clone(true) + .text(polyglot.t('show_more_count', {'smart_count': list.length - 5})) + .on('mouseup', {route: '#followers?user=' + peerAlias}, routeOnClick) + .appendTo(elem) + ; } function processWhoToFollowSuggestion(suggestion, followedBy) {