diff --git a/src/application/view/common/module/menu.phtml b/src/application/view/common/module/menu.phtml
index 2bb121c..8c615a9 100644
--- a/src/application/view/common/module/menu.phtml
+++ b/src/application/view/common/module/menu.phtml
@@ -3,12 +3,16 @@
+
+
+
+
diff --git a/src/bootstrap.php b/src/bootstrap.php
index eb0012d..bf5b1c6 100644
--- a/src/bootstrap.php
+++ b/src/bootstrap.php
@@ -76,6 +76,9 @@ if (isset($_GET['_route_'])) {
case 'api/post/get':
require(PROJECT_DIR . '/application/controller/api/post/get.php');
break;
+ case 'api/follow/total':
+ require(PROJECT_DIR . '/application/controller/api/follow/total.php');
+ break;
case 'api/follow/get':
require(PROJECT_DIR . '/application/controller/api/follow/get.php');
break;
diff --git a/src/public/css/template/default/module/menu.css b/src/public/css/template/default/module/menu.css
index 4aebcc7..1d6c1f1 100644
--- a/src/public/css/template/default/module/menu.css
+++ b/src/public/css/template/default/module/menu.css
@@ -20,5 +20,6 @@
.moduleMenu .item span {
font-size: 12px;
- margin: 0 8px
+ margin: 0 8px;
+ display: none;
}
\ No newline at end of file
diff --git a/src/public/js/follow.js b/src/public/js/follow.js
index f4206ca..c306e73 100644
--- a/src/public/js/follow.js
+++ b/src/public/js/follow.js
@@ -4,4 +4,8 @@ $(document).ready(function() {
ModuleMenu.init('follow');
ModuleFollowing.load('#moduleFollowing', true);
+ // Event listeners
+ $(document).on('ModuleFollowing.unFollow:success', function(/*event, response*/) {
+ ModuleMenu.init('follow');
+ });
});
\ No newline at end of file
diff --git a/src/public/js/module/menu.js b/src/public/js/module/menu.js
index 6d6f9c8..6a20b0f 100644
--- a/src/public/js/module/menu.js
+++ b/src/public/js/module/menu.js
@@ -1,5 +1,30 @@
var ModuleMenu = {
init: function(href) {
+
$('#moduleMenu a[href="' + href + '"]').addClass('active');
+
+ ModuleMenu.updateFollowTotal();
+ },
+ updateFollowTotal: function() {
+ $.ajax({
+ url: 'api/follow/total',
+ type: 'POST',
+ success: function (response) {
+ if (response.success) {
+
+ if (response.total) {
+ $('#moduleMenu a[href=follow] span').html(response.total).show();
+ }
+
+ } else {
+
+ alert(response.message);
+
+ }
+ },
+ error: function(jqXHR, textStatus, errorThrown) {
+ console.log(textStatus, errorThrown);
+ }
+ });
}
}
\ No newline at end of file