Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
ulakbus-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ulakbus
ulakbus-ui
Commits
b25164ab
Commit
b25164ab
authored
Nov 05, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue28'
parents
efef9849
75197418
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
directives.js
app/shared/directives.js
+13
-8
No files found.
app/shared/directives.js
View file @
b25164ab
...
...
@@ -32,16 +32,19 @@ app.directive('headerNotification', function ($http, $rootScope, $interval, REST
restrict
:
'E'
,
replace
:
true
,
link
:
function
(
$scope
)
{
$scope
.
getNotifications
=
function
()
{
// ignore loading bar here
$http
.
get
(
RESTURL
.
url
+
"notify"
,
{
ignoreLoadingBar
:
true
}).
success
(
function
(
data
)
{
$scope
.
groupNotifications
=
function
(
notifications
)
{
// notification categories:
// 1: tasks, 2: messages, 3: announcements, 4: recents
$scope
.
notifications
=
{
1
:
[],
2
:
[],
3
:
[],
4
:
[]};
angular
.
forEach
(
data
.
notifications
,
function
(
value
,
key
)
{
angular
.
forEach
(
notifications
,
function
(
value
,
key
)
{
$scope
.
notifications
[
value
.
type
].
push
(
value
);
});
};
$scope
.
getNotifications
=
function
()
{
// ignore loading bar here
$http
.
get
(
RESTURL
.
url
+
"notify"
,
{
ignoreLoadingBar
:
true
}).
success
(
function
(
data
)
{
$scope
.
groupNotifications
(
data
.
notifications
);
$rootScope
.
$broadcast
(
"notifications"
,
$scope
.
notifications
);
});
};
...
...
@@ -50,6 +53,7 @@ app.directive('headerNotification', function ($http, $rootScope, $interval, REST
// check notifications every 5 seconds
$interval
(
function
()
{
console
.
log
(
'get notification call - interval'
);
$scope
.
getNotifications
();
},
5000
);
...
...
@@ -58,7 +62,8 @@ app.directive('headerNotification', function ($http, $rootScope, $interval, REST
$scope
.
markAsRead
=
function
(
items
)
{
$http
.
post
(
RESTURL
.
url
+
"notify"
,
{
ignoreLoadingBar
:
true
,
read
:
[
items
]})
.
success
(
function
(
data
)
{
console
.
log
(
data
);
$scope
.
groupNotifications
(
data
.
notifications
);
$rootScope
.
$broadcast
(
"notifications"
,
$scope
.
notifications
);
});
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment