Commit 12e3097e authored by Evren Kutar's avatar Evren Kutar

Merge branch 'issue14_notifications'

parents 60b9cca1 bc2bedf1
......@@ -68,7 +68,7 @@
<!-- end of right-sidebar-title -->
<div class="right-sidebar-message-block" ng-repeat="notify in notifications[2] | limitTo:5">
<a class="clearfix" href="javascript:void(0)">
<a class="clearfix" href="javascript:void(0)" ng-click="markAsRead(notify)">
<img src="../../../img/sample-profile-pic.jpg">
<div class="right-sidebar-message-content">
<div>{{notify.title}}</div>
......@@ -110,8 +110,8 @@
<!-- end of right-sidebar-task-block -->
<div class="right-sidebar-task-block">
<div class="task-type">Onay Bekleyen Görevler</div>
<a href="javascript:void(0)" ng-repeat="notify in notifications[1] | limitTo:5">
<!--<div class="task-type">Onay Bekleyen Görevler</div>-->
<a href="javascript:void(0)" ng-click="markAsRead(notify)" ng-repeat="notify in notifications[1] | limitTo:5">
<div class="task-title">{{notify.title}}</div>
</a>
</div>
......@@ -133,7 +133,9 @@
<!-- end of right-sidebar-title -->
<div class="right-sidebar-announcement-block">
<a href="javascript:void(0)" ng-repeat="notify in notifications[3] | limitTo:5">{{notify.body}}</a>
<a href="javascript:void(0)" ng-click="markAsRead(notify)"
ng-repeat="notify in notifications[3] | limitTo:5">{{notify
.body}}</a>
</div>
<!-- end of right-sidebar-status-block -->
......@@ -152,10 +154,10 @@
</div>
<!-- end of right-sidebar-title -->
<div class="right-sidebar-last-action-block">
<a href="javascript:void(0)">Birinci dönem bitimine 10 gün kaldı.</a>
<a href="javascript:void(0)">Ders seçimi işlemleri xx tarihinde başlayacaktır.</a>
</div>
<!--<div class="right-sidebar-last-action-block">-->
<!--<a href="javascript:void(0)">Birinci dönem bitimine 10 gün kaldı.</a>-->
<!--<a href="javascript:void(0)">Ders seçimi işlemleri xx tarihinde başlayacaktır.</a>-->
<!--</div>-->
<!-- end of right-sidebar-status-block -->
</div>
......
......@@ -73,6 +73,10 @@ angular.module('ulakbus.dashboard', ['ngRoute'])
$scope.notifications = data;
});
$scope.markAsRead = function (items) {
$rootScope.$broadcast("markasread", items);
}
})
.directive('sidebarNotifications', function () {
......
......@@ -17,7 +17,7 @@ var wf = angular.module('ulakbus.wf', ['ui.bootstrap', 'schemaForm', 'formServic
*/
wf.controller('WFAddEditCtrl', function ($scope, $rootScope, $location, $http, $log, $modal, $timeout, Generator, $routeParams) {
$scope.url = ""; debugger;
$scope.url = "";
$scope.form_params = {'model': $routeParams.model};
//if ($routeParams.id) {
// $scope.form_params['object_id'] = $routeParams.id;
......
......@@ -32,7 +32,7 @@ app.directive('headerNotification', function ($http, $rootScope, $interval, REST
restrict: 'E',
replace: true,
link: function ($scope) {
$interval(function () {
$scope.getNotifications = function () {
// ignore loading bar here
$http.get(RESTURL.url+"notify", {ignoreLoadingBar: true}).success(function (data) {
// notification categories:
......@@ -44,7 +44,28 @@ app.directive('headerNotification', function ($http, $rootScope, $interval, REST
});
$rootScope.$broadcast("notifications", $scope.notifications);
});
};
$scope.getNotifications();
// check notifications every 5 seconds
$interval(function () {
$scope.getNotifications();
}, 5000);
// when clicked mark as read notification
// it can be list of notifications
$scope.markAsRead = function (items) {
$http.post(RESTURL.url+"notify", {ignoreLoadingBar: true, read: items})
.success(function (data) {
console.log(data);
});
};
// if markasread triggered outside the directive
$scope.$on("markasread", function (event, data) {
$scope.markAsRead(data);
});
}
};
});
......
......@@ -4,21 +4,21 @@
<div class="badge" ng-if="notifications[2].length > 0">{{notifications[2].length}}</div>
<i class="fa fa-envelope fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-messages">
<li>
<a href="#">
<ul class="dropdown-menu dropdown-messages" ng-if="notifications[2].length > 0">
<li ng-repeat="notify in notifications[2] | limitTo: '8'">
<a href="javascript:void(0)" ng-click="markAsRead(notify)">
<div>
<strong>John Smith</strong>
<strong>{{notify.title}}</strong>
<span class="pull-right text-muted">
<em>Yesterday</em>
<em>22 Ekim 2015</em>
</span>
</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...</div>
<div>{{notify.body}}...</div>
</a>
</li>
<li class="divider"></li>
<li>
<a class="text-center" href="#">
<a class="text-center" href="javascript:void(0)">
<strong>Read All Messages</strong>
<i class="fa fa-angle-right"></i>
</a>
......@@ -32,30 +32,32 @@
<div class="badge" ng-if="notifications[1].length > 0">{{notifications[1].length}}</div>
<i class="fa fa-tasks fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<!--<ul class="dropdown-menu dropdown-tasks">-->
<!--<li>-->
<!--<a href="#">-->
<!--<div>-->
<!--<p>-->
<!--<strong>Task 1</strong>-->
<!--<span class="pull-right text-muted">40% Complete</span>-->
<!--</p>-->
<ul class="dropdown-menu dropdown-tasks" ng-if="notifications[1].length > 0">
<li ng-repeat="notify in notifications[1] | limitTo: '8'">
<a href="javascript:void(0)" ng-click="markAsRead(notify)">
<div>
<p>
<strong>{{notify.title}}</strong>
<span class="pull-right text-muted">{{notify.body}}</span>
</p>
<!-- todo: progress bar will be used in future developments-->
<!--<div class="progress progress-striped active">-->
<!--<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: 40%">-->
<!--<span class="sr-only">40% Complete (success)</span>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</a>-->
<!--</li>-->
<!--<li class="divider"></li>-->
<!--<li>-->
<!--<a class="text-center" href="#">-->
<!--<strong>See All Tasks</strong>-->
<!--<i class="fa fa-angle-right"></i>-->
<!--</a>-->
<!--</li>-->
<!--</ul>-->
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a class="text-center" href="javascript:void(0)">
<strong>See All Tasks</strong>
<i class="fa fa-angle-right"></i>
</a>
</li>
</ul>
<!-- /.dropdown-tasks -->
</li>
<!-- /.dropdown -->
......@@ -64,59 +66,16 @@
<div class="badge" ng-if="notifications[3].length > 0">{{notifications[3].length}}</div>
<i class="fa fa-bell fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<!--<ul class="dropdown-menu dropdown-alerts">-->
<!--<li>-->
<!--<a href="#">-->
<!--<div>-->
<!--<i class="fa fa-comment fa-fw"></i> New Comment-->
<!--<span class="pull-right text-muted small">4 minutes ago</span>-->
<!--</div>-->
<!--</a>-->
<!--</li>-->
<!--<li class="divider"></li>-->
<!--<li>-->
<!--<a href="#">-->
<!--<div>-->
<!--<i class="fa fa-twitter fa-fw"></i> 3 New Followers-->
<!--<span class="pull-right text-muted small">12 minutes ago</span>-->
<!--</div>-->
<!--</a>-->
<!--</li>-->
<!--<li class="divider"></li>-->
<!--<li>-->
<!--<a href="#">-->
<!--<div>-->
<!--<i class="fa fa-envelope fa-fw"></i> Message Sent-->
<!--<span class="pull-right text-muted small">4 minutes ago</span>-->
<!--</div>-->
<!--</a>-->
<!--</li>-->
<!--<li class="divider"></li>-->
<!--<li>-->
<!--<a href="#">-->
<!--<div>-->
<!--<i class="fa fa-tasks fa-fw"></i> New Task-->
<!--<span class="pull-right text-muted small">4 minutes ago</span>-->
<!--</div>-->
<!--</a>-->
<!--</li>-->
<!--<li class="divider"></li>-->
<!--<li>-->
<!--<a href="#">-->
<!--<div>-->
<!--<i class="fa fa-upload fa-fw"></i> Server Rebooted-->
<!--<span class="pull-right text-muted small">4 minutes ago</span>-->
<!--</div>-->
<!--</a>-->
<!--</li>-->
<!--<li class="divider"></li>-->
<!--<li>-->
<!--<a class="text-center" href="#">-->
<!--<strong>See All Alerts</strong>-->
<!--<i class="fa fa-angle-right"></i>-->
<!--</a>-->
<!--</li>-->
<!--</ul>-->
<ul class="dropdown-menu dropdown-alerts" ng-if="notifications[3].length > 0">
<li>
<a href="javascript:void(0)">
<div>
<i class="fa fa-comment fa-fw"></i> New Comment
<span class="pull-right text-muted small">4 minutes ago</span>
</div>
</a>
</li>
</ul>
<!-- /.dropdown-alerts -->
</li>
<!-- /.dropdown -->
......@@ -125,9 +84,9 @@
<i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a href="#"><i class="fa fa-user fa-fw"></i> Profil</a>
<li><a href="javascript:void(0)"><i class="fa fa-user fa-fw"></i> Profil</a>
</li>
<li><a href="#"><i class="fa fa-gear fa-fw"></i> Ayarlar</a>
<li><a href="javascript:void(0)"><i class="fa fa-gear fa-fw"></i> Ayarlar</a>
</li>
<li class="divider"></li>
<li><a ui-sref="login" href="javascript:void(0);" logout><i class="fa fa-sign-out fa-fw"></i> Çıkış</a>
......
......@@ -56,12 +56,12 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
if (v.type === 'submit' || v.type === 'button') {
//k.type = 'button';
angular.forEach(scope.form, function (value, key) {
if (value === v) {
v.type = 'button';
scope.form[key] = {type: v.type, title: v.title, onClick: function(){scope.model[v]=1;generator.submit(scope);}};
}
});
debugger;
scope.form[scope.form.indexOf(k)] = {
type: v.type,
title: v.title,
onClick: function(){scope.model[v]=1;generator.submit(scope);}
};
}
if (v.type === 'date') {
......@@ -185,7 +185,8 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
// generically change _id fields model value
if (k == scope.form_params.param) {
if (k == scope.form_params.param) { debugger;
scope.model[k] = scope.form_params.id;
scope.form.splice(scope.form.indexOf(k), 1);
}
......
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