Commit 2440378e authored by Evren Kutar's avatar Evren Kutar

Merge branch 'develop2' into develop

parents 18937cec 66fde080
...@@ -37,7 +37,7 @@ angular.module('ulakbus') ...@@ -37,7 +37,7 @@ angular.module('ulakbus')
* 1: tasks, 2: messages, 3: announcements, 4: recents * 1: tasks, 2: messages, 3: announcements, 4: recents
* - Notifications can be disabled in /dev/settings page * - Notifications can be disabled in /dev/settings page
*/ */
.directive('headerNotification', function (WSOps, $rootScope, $cookies, $interval, RESTURL) { .directive('headerNotification', function (WSOps, $rootScope, $cookies, $interval, RESTURL, $uibModal) {
return { return {
templateUrl: 'shared/templates/directives/header-notification.html', templateUrl: 'shared/templates/directives/header-notification.html',
restrict: 'E', restrict: 'E',
...@@ -51,6 +51,21 @@ angular.module('ulakbus') ...@@ -51,6 +51,21 @@ angular.module('ulakbus')
* Group notifications * Group notifications
* @param notifications * @param notifications
*/ */
$scope.popModal = function(item){
var modalInstance = $uibModal.open({
animation: true,
templateUrl: 'shared/templates/notificationsModalContent.html',
controller: function($scope){
$scope.notification = item;
$scope.cancel = function() {
modalInstance.dismiss('cancel');
};
},
size: 'lg'
});
}
$scope.groupNotifications = function (notifications) { $scope.groupNotifications = function (notifications) {
// $scope.notifications = {1: [], 2: [], 3: [], 4: []}; // $scope.notifications = {1: [], 2: [], 3: [], 4: []};
...@@ -73,9 +88,15 @@ angular.module('ulakbus') ...@@ -73,9 +88,15 @@ angular.module('ulakbus')
* @param items * @param items
* @todo: do it in detail page of notification * @todo: do it in detail page of notification
*/ */
$scope.markAsRead = function (item, group, index) { $scope.markAsRead = function (event,item, group, index) {
WSOps.doSend(angular.toJson({data: {view: 'notify', id: item.id}})); //Added event parameter to stop propagate, so that behaviour of outsideClick won't be interrupted.
$scope.notifications[group].splice(index, 1); event.stopPropagation();
WSOps.doSend(angular.toJson({data: {view: 'notify', id:item.id}}));
$scope.notifications[group].splice(index,1);
$event.preventDefault();
$event.stopPropagation();
return false;
}; };
// if markasread triggered outside the directive // if markasread triggered outside the directive
...@@ -640,4 +661,4 @@ angular.module('ulakbus') ...@@ -640,4 +661,4 @@ angular.module('ulakbus')
}); });
} }
} }
}); });
\ No newline at end of file
<ul class="nav navbar-top-links navbar-right"> <ul class="nav navbar-top-links navbar-right">
<li class="dropdown"> <!--<li class="dropdown" >
<a class="dropdown-toggle" data-toggle="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown">
<div class="badge" ng-show="notifications[2].length > 0">{{notifications[2].length}}</div> <div class="badge" ng-show="notifications[2].length > 0">{{notifications[2].length}}</div>
<i class="fa fa-envelope fa-fw" tooltip-placement="bottom" uib-tooltip="Mesajlar"></i> <i <i class="fa fa-envelope fa-fw" tooltip-placement="bottom" uib-tooltip="Mesajlar"></i> <i
...@@ -8,13 +8,15 @@ ...@@ -8,13 +8,15 @@
<ul class="dropdown-menu dropdown-messages" ng-show="notifications[2].length > 0"> <ul class="dropdown-menu dropdown-messages" ng-show="notifications[2].length > 0">
<li ng-repeat="notify in notifications[2] | limitTo: '8'"> <li ng-repeat="notify in notifications[2] | limitTo: '8'">
<a> <a>
<div> <div ng-click="popModal(notify)">
<strong>{{notify.title}}</strong> <div>
<span class="pull-right text-muted"> <strong>{{notify.title}}</strong>
<em>22 Ekim 2015</em> <span class="pull-right text-muted">
</span> <em>22 Ekim 2015</em>
</span>
</div>
<div>{{notify.body}}...</div>
</div> </div>
<div>{{notify.body}}...</div>
<span ng-click="markAsRead(notify, 2, $index)" class="pull-right fa fa-times"></span> <span ng-click="markAsRead(notify, 2, $index)" class="pull-right fa fa-times"></span>
</a> </a>
</li> </li>
...@@ -26,23 +28,54 @@ ...@@ -26,23 +28,54 @@
</a> </a>
</li> </li>
</ul> </ul>
&lt;!&ndash; /.dropdown-messages &ndash;&gt;
</li>-->
<li uib-dropdown auto-close="outsideClick">
<a uib-dropdown-toggle>
<div class="badge" ng-show="notifications[2].length > 0">{{notifications[2].length}}</div>
<i class="fa fa-envelope fa-fw" tooltip-placement="bottom" uib-tooltip="Mesajlar"></i> <i
class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-messages" uib-dropdown-menu ng-show="notifications[2].length > 0">
<li ng-repeat="notify in notifications[2] | limitTo: '8'">
<a>
<div ng-click="popModal(notify)">
<div>
<strong>{{notify.title}}</strong>
<span class="pull-right text-muted">
<em>22 Ekim 2015</em>
</span>
</div>
<div>{{notify.body}}...</div>
</div>
<span ng-click="markAsRead($event,notify, 2, $index)" class="pull-right fa fa-times"></span>
</a>
</li>
<li class="divider"></li>
<li>
<a class="text-center">
<strong>Read All Messages</strong>
<i class="fa fa-angle-right"></i>
</a>
</li>
</ul>
<!-- /.dropdown-messages --> <!-- /.dropdown-messages -->
</li> </li>
<!-- /.dropdown --> <!-- /.dropdown -->
<li class="dropdown"> <li uib-dropdown auto-close="outsideClick">
<a class="dropdown-toggle" data-toggle="dropdown"> <a uib-dropdown-toggle>
<div class="badge" ng-if="notifications[1].length > 0">{{notifications[1].length}}</div> <div class="badge" ng-if="notifications[1].length > 0">{{notifications[1].length}}</div>
<i class="fa fa-tasks fa-fw" tooltip-placement="bottom" uib-tooltip="Görevler"></i> <i <i class="fa fa-tasks fa-fw" tooltip-placement="bottom" uib-tooltip="Görevler"></i> <i
class="fa fa-caret-down"></i> class="fa fa-caret-down"></i>
</a> </a>
<ul class="dropdown-menu dropdown-tasks" ng-if="notifications[1].length > 0"> <ul class="dropdown-tasks" uib-dropdown-menu ng-if="notifications[1].length > 0">
<li ng-repeat="notify in notifications[1] | limitTo: '8'"> <li ng-repeat="notify in notifications[1] | limitTo: '8'">
<a> <a>
<div> <div>
<p> <p>
<strong>{{notify.title}}</strong> <strong>{{notify.title}}</strong>
<span class="pull-right text-muted">{{notify.body}}</span> <span class="pull-right text-muted">{{notify.body}}</span>
<span ng-click="markAsRead(notify, 1, $index)" class="pull-right fa fa-times"></span> <span ng-click="markAsRead($event,notify, 1, $index)" class="pull-right fa fa-times"></span>
</p> </p>
<!-- todo: progress bar will be used in future developments--> <!-- todo: progress bar will be used in future developments-->
<!--<div class="progress progress-striped active">--> <!--<div class="progress progress-striped active">-->
...@@ -65,19 +98,19 @@ ...@@ -65,19 +98,19 @@
<!-- /.dropdown-tasks --> <!-- /.dropdown-tasks -->
</li> </li>
<!-- /.dropdown --> <!-- /.dropdown -->
<li class="dropdown"> <li uib-dropdown auto-close="outsideClick">
<a class="dropdown-toggle" data-toggle="dropdown"> <a uib-dropdown-toggle>
<div class="badge" ng-if="notifications[3].length > 0">{{notifications[3].length}}</div> <div class="badge" ng-if="notifications[3].length > 0">{{notifications[3].length}}</div>
<i class="fa fa-bell fa-fw" tooltip-placement="bottom" uib-tooltip="Duyurular"></i> <i <i class="fa fa-bell fa-fw" tooltip-placement="bottom" uib-tooltip="Duyurular"></i> <i
class="fa fa-caret-down"></i> class="fa fa-caret-down"></i>
</a> </a>
<ul class="dropdown-menu dropdown-alerts" ng-if="notifications[3].length > 0"> <ul class="dropdown-alerts" uib-dropdown-menu ng-if="notifications[3].length > 0">
<li ng-repeat="notify in notifications[3] | limitTo: '8'"> <li ng-repeat="notify in notifications[3] | limitTo: '8'">
<a role="button"> <a role="button">
<div> <div>
<i class="fa fa-comment fa-fw"></i> New Comment <i class="fa fa-comment fa-fw"></i> New Comment
<span class="pull-right text-muted small">4 minutes ago</span> <span class="pull-right text-muted small">4 minutes ago</span>
<span ng-click="markAsRead(notify, 3, $index)" class="pull-right fa fa-times"></span> <span ng-click="markAsRead($event,notify, 3, $index)" class="pull-right fa fa-times"></span>
</div> </div>
</a> </a>
</li> </li>
...@@ -102,4 +135,3 @@ ...@@ -102,4 +135,3 @@
</li> </li>
<!-- /.dropdown --> <!-- /.dropdown -->
</ul> </ul>
<div class="modal-body">
<h3>{{notification.title}}</h3>
{{notification.body}}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-warning" ng-click="cancel()">İptal</button>
</div>
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