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
9744ccd7
Commit
9744ccd7
authored
Nov 03, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show notifications on header
notifications mark as read when clicked
parent
60b9cca1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
94 deletions
+81
-94
dashboard.html
app/components/dashboard/dashboard.html
+6
-4
dashboard_controller.js
app/components/dashboard/dashboard_controller.js
+4
-0
wf_controller.js
app/components/wf/wf_controller.js
+1
-1
directives.js
app/shared/directives.js
+22
-1
header-notification.html
app/shared/templates/directives/header-notification.html
+40
-81
form_service.js
app/zetalib/forms/form_service.js
+8
-7
No files found.
app/components/dashboard/dashboard.html
View file @
9744ccd7
...
...
@@ -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 -->
...
...
app/components/dashboard/dashboard_controller.js
View file @
9744ccd7
...
...
@@ -73,6 +73,10 @@ angular.module('ulakbus.dashboard', ['ngRoute'])
$scope
.
notifications
=
data
;
});
$scope
.
markAsRead
=
function
(
items
)
{
$rootScope
.
$broadcast
(
"markasread"
,
items
);
}
})
.
directive
(
'sidebarNotifications'
,
function
()
{
...
...
app/components/wf/wf_controller.js
View file @
9744ccd7
...
...
@@ -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;
...
...
app/shared/directives.js
View file @
9744ccd7
...
...
@@ -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
);
});
}
};
});
...
...
app/shared/templates/directives/header-notification.html
View file @
9744ccd7
...
...
@@ -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>
...
...
app/zetalib/forms/form_service.js
View file @
9744ccd7
...
...
@@ -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
);
}
...
...
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