Commit 11f317c5 authored by Evren Kutar's avatar Evren Kutar

Merge branch 'notifications_enhancement'

parents 1c4b461b a1ea6c2d
...@@ -14,23 +14,30 @@ app.directive('logout', function ($http, $location, RESTURL) { ...@@ -14,23 +14,30 @@ app.directive('logout', function ($http, $location, RESTURL) {
$element.on('click', function () { $element.on('click', function () {
$http.post(RESTURL.url + 'logout', {}).then(function () { $http.post(RESTURL.url + 'logout', {}).then(function () {
$rootScope.loggedInUser = false; $rootScope.loggedInUser = false;
console.log($rootScope.loggedInUser);
$location.path("/login"); $location.path("/login");
}); });
}); });
} }
} };
}); });
/** /**
* headerNotification directive for header * headerNotification directive for header
*/ */
app.directive('headerNotification', function () { app.directive('headerNotification', function ($http, $interval) {
return { return {
templateUrl: 'shared/templates/directives/header-notification.html', templateUrl: 'shared/templates/directives/header-notification.html',
restrict: 'E', restrict: 'E',
replace: true replace: true,
link: function ($scope) {
$interval(function () {
// todo: change url to backend
$http.get("http://google.com").success(function (data) {
$scope.notifications = data;
});
}, 15000);
} }
};
}); });
app.directive('headerSubMenu', function () { app.directive('headerSubMenu', function () {
...@@ -44,9 +51,9 @@ app.directive('headerSubMenu', function () { ...@@ -44,9 +51,9 @@ app.directive('headerSubMenu', function () {
// todo: double make it but single not solve this! // todo: double make it but single not solve this!
angular.element($('#submitbutton')).triggerHandler('click'); angular.element($('#submitbutton')).triggerHandler('click');
angular.element($('#submitbutton')).triggerHandler('click'); angular.element($('#submitbutton')).triggerHandler('click');
};
} }
} };
}
}); });
app.directive('headerBreadcrumb', function () { app.directive('headerBreadcrumb', function () {
...@@ -54,7 +61,7 @@ app.directive('headerBreadcrumb', function () { ...@@ -54,7 +61,7 @@ app.directive('headerBreadcrumb', function () {
templateUrl: 'shared/templates/directives/header-breadcrumb.html', templateUrl: 'shared/templates/directives/header-breadcrumb.html',
restrict: 'E', restrict: 'E',
replace: true replace: true
} };
}); });
app.directive('sidebar', ['$location', function () { app.directive('sidebar', ['$location', function () {
...@@ -65,12 +72,12 @@ app.directive('sidebar', ['$location', function () { ...@@ -65,12 +72,12 @@ app.directive('sidebar', ['$location', function () {
scope: {}, scope: {},
controller: function ($scope, $rootScope, $http, RESTURL, $location, $timeout) { controller: function ($scope, $rootScope, $http, RESTURL, $location, $timeout) {
$http.post(RESTURL.url + 'crud/').success(function (data) { $http.post(RESTURL.url + 'crud/').success(function (data) {
$scope.allMenuItems = data.app_models; $scope.allMenuItems = angular.copy(data.app_models);
$scope.menuItems = []; // angular.copy($scope.allMenuItems); $scope.menuItems = []; // angular.copy($scope.allMenuItems);
// at start define breadcrumblinks for breadcrumb // at start define breadcrumblinks for breadcrumb
angular.forEach(data.app_models, function (value, key) { angular.forEach(data.app_models, function (value, key) {
angular.forEach(value[1], function (v, k) { angular.forEach(value[1], function (v, k) {
if (v[1] == $location.path().split('/')[2]) { if (v[1] === $location.path().split('/')[2]) {
$rootScope.breadcrumblinks = [value[0], v[0]]; $rootScope.breadcrumblinks = [value[0], v[0]];
$scope.menuItems = [$scope.allMenuItems[key]]; $scope.menuItems = [$scope.allMenuItems[key]];
} else { } else {
...@@ -80,17 +87,16 @@ app.directive('sidebar', ['$location', function () { ...@@ -80,17 +87,16 @@ app.directive('sidebar', ['$location', function () {
}); });
}); });
$rootScope.$watch(function($rootScope) {return $rootScope.section}, $rootScope.$watch(function ($rootScope) {return $rootScope.section; },
function(newindex, oldindex){ function (newindex, oldindex) {
if(newindex > -1){ if (newindex > -1) {
$scope.menuItems = [$scope.allMenuItems[newindex]]; $scope.menuItems = [$scope.allMenuItems[newindex]];
$scope.collapseVar = 1; $scope.collapseVar = 1;
$timeout(function () { $timeout(function () {
$('#side-menu').metisMenu(); $('#side-menu').metisMenu();
}); });
} }
} });
);
// todo: change to $watch to init // todo: change to $watch to init
//$timeout(function () { //$timeout(function () {
...@@ -103,10 +109,11 @@ app.directive('sidebar', ['$location', function () { ...@@ -103,10 +109,11 @@ app.directive('sidebar', ['$location', function () {
$scope.check = function (x) { $scope.check = function (x) {
if (x == $scope.collapseVar) if (x === $scope.collapseVar) {
$scope.collapseVar = 0; $scope.collapseVar = 0;
else } else {
$scope.collapseVar = x; $scope.collapseVar = x;
}
}; };
...@@ -119,14 +126,15 @@ app.directive('sidebar', ['$location', function () { ...@@ -119,14 +126,15 @@ app.directive('sidebar', ['$location', function () {
$scope.multiCheck = function (y) { $scope.multiCheck = function (y) {
if (y == $scope.multiCollapseVar) if (y === $scope.multiCollapseVar) {
$scope.multiCollapseVar = 0; $scope.multiCollapseVar = 0;
else } else {
$scope.multiCollapseVar = y; $scope.multiCollapseVar = y;
}
}; };
} }
} };
}]); }]);
app.directive('stats', function () { app.directive('stats', function () {
...@@ -145,7 +153,7 @@ app.directive('stats', function () { ...@@ -145,7 +153,7 @@ app.directive('stats', function () {
'goto': '@' 'goto': '@'
} }
} };
}); });
app.directive('notifications', function () { app.directive('notifications', function () {
...@@ -153,7 +161,7 @@ app.directive('notifications', function () { ...@@ -153,7 +161,7 @@ app.directive('notifications', function () {
templateUrl: 'shared/templates/directives/notifications.html', templateUrl: 'shared/templates/directives/notifications.html',
restrict: 'E', restrict: 'E',
replace: true, replace: true,
} };
}); });
app.directive('sidebarSearch', function () { app.directive('sidebarSearch', function () {
...@@ -165,7 +173,7 @@ app.directive('sidebarSearch', function () { ...@@ -165,7 +173,7 @@ app.directive('sidebarSearch', function () {
controller: function ($scope) { controller: function ($scope) {
$scope.selectedMenu = 'home'; $scope.selectedMenu = 'home';
} }
} };
}); });
app.directive('timeline', function () { app.directive('timeline', function () {
...@@ -173,7 +181,7 @@ app.directive('timeline', function () { ...@@ -173,7 +181,7 @@ app.directive('timeline', function () {
templateUrl: 'shared/templates/directives/timeline.html', templateUrl: 'shared/templates/directives/timeline.html',
restrict: 'E', restrict: 'E',
replace: true, replace: true,
} };
}); });
app.directive('chat', function () { app.directive('chat', function () {
...@@ -181,5 +189,5 @@ app.directive('chat', function () { ...@@ -181,5 +189,5 @@ app.directive('chat', function () {
templateUrl: 'shared/templates/directives/chat.html', templateUrl: 'shared/templates/directives/chat.html',
restrict: 'E', restrict: 'E',
replace: true, replace: true,
} };
}); });
\ No newline at end of file
...@@ -3,26 +3,26 @@ ...@@ -3,26 +3,26 @@
<a class="dropdown-toggle" data-toggle="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope fa-fw"></i> <i class="fa fa-caret-down"></i> <i class="fa fa-envelope fa-fw"></i> <i class="fa fa-caret-down"></i>
</a> </a>
<!--<ul class="dropdown-menu dropdown-messages">--> <ul class="dropdown-menu dropdown-messages">
<!--<li>--> <li>
<!--<a href="#">--> <a href="#">
<!--<div>--> <div>
<!--<strong>John Smith</strong>--> <strong>John Smith</strong>
<!--<span class="pull-right text-muted">--> <span class="pull-right text-muted">
<!--<em>Yesterday</em>--> <em>Yesterday</em>
<!--</span>--> </span>
<!--</div>--> </div>
<!--<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...</div>--> <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...</div>
<!--</a>--> </a>
<!--</li>--> </li>
<!--<li class="divider"></li>--> <li class="divider"></li>
<!--<li>--> <li>
<!--<a class="text-center" href="#">--> <a class="text-center" href="#">
<!--<strong>Read All Messages</strong>--> <strong>Read All Messages</strong>
<!--<i class="fa fa-angle-right"></i>--> <i class="fa fa-angle-right"></i>
<!--</a>--> </a>
<!--</li>--> </li>
<!--</ul>--> </ul>
<!-- /.dropdown-messages --> <!-- /.dropdown-messages -->
</li> </li>
<!-- /.dropdown --> <!-- /.dropdown -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment