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
340d9636
Commit
340d9636
authored
Oct 28, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
if selected user add it to cookies
parent
827706c0
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
144 deletions
+100
-144
dashboard.html
app/components/dashboard/dashboard.html
+2
-2
dashboard_controller.js
app/components/dashboard/dashboard_controller.js
+25
-75
directives.js
app/shared/directives.js
+30
-25
selected-user.html
app/shared/templates/directives/selected-user.html
+41
-1
sidebar.html
app/shared/templates/directives/sidebar.html
+2
-41
No files found.
app/components/dashboard/dashboard.html
View file @
340d9636
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
<div
class=
"dashboard-search-results"
>
<div
class=
"dashboard-search-results"
>
<ul
ng-if=
"students.length > 0"
>
<ul
ng-if=
"students.length > 0"
>
<li
ng-repeat=
"student in students"
>
<li
ng-repeat=
"student in students"
>
<a
href=
"javascript:void(0)"
ng-click=
"select(student)"
>
{{student}}
</a>
<a
href=
"javascript:void(0)"
ng-click=
"select(student
, 'ogrenci'
)"
>
{{student}}
</a>
</li>
</li>
</ul>
</ul>
</div>
</div>
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
<div
class=
"dashboard-search-results"
>
<div
class=
"dashboard-search-results"
>
<ul
ng-if=
"staffs.length > 0"
>
<ul
ng-if=
"staffs.length > 0"
>
<li
ng-repeat=
"staff in staffs"
>
<li
ng-repeat=
"staff in staffs"
>
<a
href=
"javascript:void(0)"
ng-click=
"select(staff)"
>
{{staff[0]}}
</a>
<a
href=
"javascript:void(0)"
ng-click=
"select(staff
, 'personel'
)"
>
{{staff[0]}}
</a>
</li>
</li>
</ul>
</ul>
</div>
</div>
...
...
app/components/dashboard/dashboard_controller.js
View file @
340d9636
...
@@ -9,11 +9,16 @@
...
@@ -9,11 +9,16 @@
angular
.
module
(
'ulakbus.dashboard'
,
[
'ngRoute'
])
angular
.
module
(
'ulakbus.dashboard'
,
[
'ngRoute'
])
.
controller
(
'DashCtrl'
,
function
(
$scope
,
$rootScope
,
$timeout
,
$http
,
RESTURL
)
{
.
controller
(
'DashCtrl'
,
function
(
$scope
,
$rootScope
,
$timeout
,
$http
,
$cookies
,
RESTURL
)
{
$scope
.
section
=
function
(
section_index
)
{
$scope
.
section
=
function
(
section_index
)
{
$rootScope
.
section
=
section_index
;
$rootScope
.
section
=
section_index
;
};
};
// to show search box based on authz
$scope
.
$on
(
"authz"
,
function
(
event
,
data
)
{
$scope
.
menuitems
=
data
;
});
$scope
.
student_kw
=
""
;
$scope
.
student_kw
=
""
;
$scope
.
staff_kw
=
""
;
$scope
.
staff_kw
=
""
;
...
@@ -47,81 +52,26 @@ angular.module('ulakbus.dashboard', ['ngRoute'])
...
@@ -47,81 +52,26 @@ angular.module('ulakbus.dashboard', ['ngRoute'])
//});
//});
};
};
$scope
.
select
=
function
(
who
)
{
$scope
.
select
=
function
(
who
,
type
)
{
$rootScope
.
selectedUser
=
{
name
:
who
[
0
],
tcno
:
who
[
1
],
key
:
who
[
2
]};
$rootScope
.
selectedUser
=
{
name
:
who
[
0
],
tcno
:
who
[
1
],
key
:
who
[
2
]};
// todo: get 'who's related transactions and manipulate sidebar menu
};
// when select a user from list
// get 'who's related transactions and manipulate sidebar menu
$rootScope
.
$broadcast
(
"menuitems"
,
type
);
//$http.post(RESTURL.url + 'crud/').success(function (data) {
// save selected user and type to cookie
// $scope.allMenuItems = angular.copy(data.app_models);
$cookies
.
put
(
"selectedUserName"
,
who
[
0
]);
// $scope.menuItems = []; // angular.copy($scope.allMenuItems);
$cookies
.
put
(
"selectedUserTcNo"
,
who
[
1
]);
// // at start define breadcrumblinks for breadcrumb
$cookies
.
put
(
"selectedUserKey"
,
who
[
2
]);
// angular.forEach(data.app_models, function (value, key) {
$cookies
.
put
(
"selectedUserType"
,
type
);
// angular.forEach(value[1], function (v, k) {
console
.
log
(
$cookies
.
getAll
());
// if (v[1] === $location.path().split('/')[2]) {
// $rootScope.breadcrumblinks = [value[0], v[0]];
// $scope.menuItems = [$scope.allMenuItems[key]];
// } else {
// $rootScope.breadcrumblinks = ['Panel'];
// }
// });
// });
//});
//$rootScope.$watch(function ($rootScope) {
};
// return $rootScope.section;
// },
// if selected user in cookie, set selectedUser
// function (newindex, oldindex) {
if
(
$cookies
.
getAll
()[
"selectedUser"
])
{
// if (newindex > -1) {
$rootScope
.
selectedUser
=
{
name
:
$cookies
.
get
(
"selectedUserName"
),
tcno
:
$cookies
.
get
(
"selectedUserTcNo"
),
key
:
$cookies
.
get
(
"selectedUserKey"
)};
// $scope.menuItems = [$scope.allMenuItems[newindex]];
//$rootScope.$broadcast("menuitems", $cookies.get("selectedUserType"));
// $scope.collapseVar = 1;
console
.
log
(
$cookies
.
getAll
());
// $timeout(function () {
}
// $('#side-menu').metisMenu();
// });
});
// }
// });
//
//$scope.selectedMenu = $location.path();
//$scope.collapseVar = 0;
//$scope.multiCollapseVar = 0;
//
//$scope.check = function (x) {
//
// if (x === $scope.collapseVar) {
// $scope.collapseVar = 0;
// } else {
// $scope.collapseVar = x;
// }
//
//};
//
//// breadcrumb function changes breadcrumb items and itemlist must be list
//$scope.breadcrumb = function (itemlist) {
// $rootScope.breadcrumblinks = itemlist;
// // showSaveButton is used for to show or not to show save button on top of the page
// $rootScope.showSaveButton = false;
//};
//
//$scope.multiCheck = function (y) {
//
// if (y === $scope.multiCollapseVar) {
// $scope.multiCollapseVar = 0;
// } else {
// $scope.multiCollapseVar = y;
// }
//};
})
//.directive('sidebar', ['$location', function () {
// return {
// templateUrl: 'shared/templates/directives/sidebar.html',
// restrict: 'E',
// replace: true,
// scope: {},
// controller: function ($scope, $rootScope, $http, RESTURL, $location, $timeout) {
//
//
// }
// };
//}]);
app/shared/directives.js
View file @
340d9636
...
@@ -59,19 +59,14 @@ app.directive('collapseMenu', function ($timeout) {
...
@@ -59,19 +59,14 @@ app.directive('collapseMenu', function ($timeout) {
$scope
.
collapseToggle
=
function
()
{
$scope
.
collapseToggle
=
function
()
{
if
(
$rootScope
.
collapsed
===
false
)
{
if
(
$rootScope
.
collapsed
===
false
)
{
//jQuery("span.menu-text, span.arrow, .sidebar footer").css("display" , "none");
jQuery
(
".sidebar"
).
css
(
"width"
,
"62px"
);
jQuery
(
".sidebar"
).
css
(
"width"
,
"62px"
);
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 62px)"
);
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 62px)"
);
//jQuery(".sidebar footer").css("display" , "none");
//jQuery(".menu-text").hide();
$rootScope
.
collapsed
=
true
;
$rootScope
.
collapsed
=
true
;
$rootScope
.
sidebarPinned
=
false
;
$rootScope
.
sidebarPinned
=
false
;
}
else
{
}
else
{
jQuery
(
"span.menu-text, span.arrow, .sidebar footer"
).
fadeIn
(
400
);
jQuery
(
"span.menu-text, span.arrow, .sidebar footer"
).
fadeIn
(
400
);
jQuery
(
".sidebar"
).
css
(
"width"
,
"250px"
);
jQuery
(
".sidebar"
).
css
(
"width"
,
"250px"
);
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 250px)"
);
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 250px)"
);
//jQuery(".sidebar footer").fadeIn(400);
//jQuery(".menu-text").show();
$rootScope
.
collapsed
=
false
;
$rootScope
.
collapsed
=
false
;
$rootScope
.
sidebarPinned
=
true
;
$rootScope
.
sidebarPinned
=
true
;
}
}
...
@@ -126,7 +121,10 @@ app.directive('selectedUser', function () {
...
@@ -126,7 +121,10 @@ app.directive('selectedUser', function () {
return
{
return
{
templateUrl
:
'shared/templates/directives/selected-user.html'
,
templateUrl
:
'shared/templates/directives/selected-user.html'
,
restrict
:
'E'
,
restrict
:
'E'
,
replace
:
true
replace
:
false
,
link
:
function
(
$scope
,
$rootScope
)
{
$scope
.
selectedUser
=
$rootScope
.
selectedUser
;
}
};
};
});
});
...
@@ -134,6 +132,7 @@ app.directive('selectedUser', function () {
...
@@ -134,6 +132,7 @@ app.directive('selectedUser', function () {
* sidebar directive
* sidebar directive
* changes breadcrumb when an item selected
* changes breadcrumb when an item selected
* consists of menu items of related user or transaction
* consists of menu items of related user or transaction
* controller communicates with dashboard controller to shape menu items and authz
*/
*/
app
.
directive
(
'sidebar'
,
[
'$location'
,
function
()
{
app
.
directive
(
'sidebar'
,
[
'$location'
,
function
()
{
...
@@ -142,25 +141,32 @@ app.directive('sidebar', ['$location', function () {
...
@@ -142,25 +141,32 @@ app.directive('sidebar', ['$location', function () {
restrict
:
'E'
,
restrict
:
'E'
,
replace
:
true
,
replace
:
true
,
scope
:
{},
scope
:
{},
controller
:
function
(
$scope
,
$rootScope
,
$http
,
RESTURL
,
$location
,
$timeout
)
{
controller
:
function
(
$scope
,
$rootScope
,
$cookies
,
$http
,
RESTURL
,
$location
,
$timeout
)
{
$
(
'#side-menu'
).
metisMenu
();
var
sidebarmenu
=
$
(
'#side-menu'
);
sidebarmenu
.
metisMenu
();
$http
.
get
(
RESTURL
.
url
+
'menu/'
).
success
(
function
(
data
)
{
$http
.
get
(
RESTURL
.
url
+
'menu/'
).
success
(
function
(
data
)
{
//$scope.allMenuItems = angular.copy(data.generic);
$scope
.
allMenuItems
=
angular
.
copy
(
data
);
$scope
.
menuItems
=
data
;
// $scope.menuItems = []; // angular.copy($scope.allMenuItems);
// broadcast for authorized menu items, consume in dashboard
$rootScope
.
$broadcast
(
"authz"
,
data
);
// at start define breadcrumblinks for breadcrumb
//angular.forEach(data.app_models, function (value, key) {
$scope
.
menuItems
=
{
"other"
:
$scope
.
allMenuItems
.
other
};
// angular.forEach(value[1], function (v, k) {
// if (v[1] === $location.path().split('/')[2]) {
// if selecteduser on cookie then add related part to the menu
// $rootScope.breadcrumblinks = [value[0], v[0]];
// $scope.menuItems = [$scope.allMenuItems[key]];
if
(
$cookies
.
get
(
"selectedUserType"
))
{
// } else {
$scope
.
menuItems
[
$cookies
.
get
(
"selectedUserType"
)]
=
$scope
.
allMenuItems
[
$cookies
.
get
(
"selectedUserType"
)];
// $rootScope.breadcrumblinks = ['Panel'];
}
// }
// });
$timeout
(
function
(){
sidebarmenu
.
metisMenu
()});
//});
});
$timeout
(
function
(){
$
(
'#side-menu'
).
metisMenu
()});
// changing menu items by listening for broadcast
$scope
.
$on
(
"menuitems"
,
function
(
event
,
data
)
{
$scope
.
menuItems
[
data
]
=
$scope
.
allMenuItems
[
data
];
$scope
.
menuItems
[
"other"
]
=
$scope
.
allMenuItems
[
'other'
];
$timeout
(
function
(){
sidebarmenu
.
metisMenu
()});
});
});
$scope
.
openSidebar
=
function
()
{
$scope
.
openSidebar
=
function
()
{
...
@@ -218,7 +224,6 @@ app.directive('sidebar', ['$location', function () {
...
@@ -218,7 +224,6 @@ app.directive('sidebar', ['$location', function () {
$scope
.
multiCollapseVar
=
y
;
$scope
.
multiCollapseVar
=
y
;
}
}
};
};
}
}
};
};
}]);
}]);
...
...
app/shared/templates/directives/selected-user.html
View file @
340d9636
<p
ng-if=
"$root.selectedUser.name"
>
İşlem: {{$root.selectedUser.name}}
</p>
<a
href=
"#"
data-toggle=
"tooltip"
data-placement=
"bottom"
title=
"Tooltip on left"
>
İşlem: {{$root.selectedUser.name}}
</a>
\ No newline at end of file
<!-- sidebar-person-info -->
<div
class=
"tooltip"
role=
"tooltip"
>
<!--<button class="btn btn-primary close-sidebar-person-info">Profili Kapat</button>-->
<div
class=
"identity"
>
<div
class=
"identity-header clearfix"
>
<img
src=
"../../../img/sample-profile-pic.jpg"
>
<div
class=
"pull-left"
>
<p
class=
"identity-name"
>
{{$root.selectedUser.name}}
</p>
<!--<p class="identity-surname">Öğümsöğütlü</p>-->
</div>
</div>
<!-- end of identity-header -->
<div
class=
"identity-info"
>
<div
class=
"clearfix"
>
<span
class=
"fa fa-phone"
></span>
<div>
539 241 65 08
</div>
</div>
<div
class=
"clearfix"
>
<span
class=
"fa fa-envelope"
></span>
<div>
erkanogum@gmail.com
</div>
</div>
<div
class=
"clearfix"
>
<span
class=
"fa fa-home"
></span>
<div>
İşçi Blokları Mah. 1524. sokak B Blok 6. Kat A Kanat 27 numara
</div>
</div>
</div>
</div>
<!-- end of identity -->
<div
class=
"person-actions"
>
<ul>
<li><a
href=
"#"
><span
class=
"fa fa-trash"
></span>
Action 1
</a></li>
<li><a
href=
"#"
><span
class=
"fa fa-trash"
></span>
Action 2
</a></li>
<li><a
href=
"#"
><span
class=
"fa fa-trash"
></span>
Action 3
</a></li>
<li><a
href=
"#"
><span
class=
"fa fa-trash"
></span>
Action 4
</a></li>
<li><a
href=
"#"
><span
class=
"fa fa-trash"
></span>
Action 5
</a></li>
</ul>
</div>
<!-- end of person-actions -->
</div>
<!-- end of sidebar-person-info -->
\ No newline at end of file
app/shared/templates/directives/sidebar.html
View file @
340d9636
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
<div
class=
"brand"
>
<div
class=
"brand"
>
<a
href=
""
class=
"logo"
><img
src=
"/img/brand-logo.png"
/></a>
<a
href=
""
class=
"logo"
><img
src=
"/img/brand-logo.png"
/></a>
</div>
</div>
<div
class=
"sidebar-nav navbar-collapse"
>
<div
class=
"sidebar-nav navbar-collapse"
>
<ul
class=
"nav in"
id=
"side-menu"
ng-class=
"{hidden: $root.loggedInUser != true}"
>
<ul
class=
"nav in"
id=
"side-menu"
ng-class=
"{hidden: $root.loggedInUser != true}"
>
<!--<sidebar-search></sidebar-search>-->
<!--<sidebar-search></sidebar-search>-->
...
@@ -34,46 +35,6 @@
...
@@ -34,46 +35,6 @@
<!-- /.sidebar-collapse -->
<!-- /.sidebar-collapse -->
<!-- sidebar-person-info -->
<div
class=
"sidebar-person-info"
>
<button
class=
"btn btn-primary close-sidebar-person-info"
>
Profili Kapat
</button>
<div
class=
"identity"
>
<div
class=
"identity-header clearfix"
>
<img
src=
"../../../img/sample-profile-pic.jpg"
>
<div
class=
"pull-left"
>
<p
class=
"identity-name"
>
Erkan
</p>
<p
class=
"identity-surname"
>
Öğümsöğütlü
</p>
</div>
</div>
<!-- end of identity-header -->
<div
class=
"identity-info"
>
<div
class=
"clearfix"
>
<span
class=
"fa fa-phone"
></span>
<div>
539 241 65 08
</div>
</div>
<div
class=
"clearfix"
>
<span
class=
"fa fa-envelope"
></span>
<div>
erkanogum@gmail.com
</div>
</div>
<div
class=
"clearfix"
>
<span
class=
"fa fa-home"
></span>
<div>
İşçi Blokları Mah. 1524. sokak B Blok 6. Kat A Kanat 27 numara
</div>
</div>
</div>
</div>
<!-- end of identity -->
<div
class=
"person-actions"
>
<ul>
<li><a
href=
"#"
><span
class=
"fa fa-trash"
></span>
Action 1
</a></li>
<li><a
href=
"#"
><span
class=
"fa fa-trash"
></span>
Action 2
</a></li>
<li><a
href=
"#"
><span
class=
"fa fa-trash"
></span>
Action 3
</a></li>
<li><a
href=
"#"
><span
class=
"fa fa-trash"
></span>
Action 4
</a></li>
<li><a
href=
"#"
><span
class=
"fa fa-trash"
></span>
Action 5
</a></li>
</ul>
</div>
<!-- end of person-actions -->
</div>
<!-- end of sidebar-person-info -->
<footer
ng-class=
"{hidden: $root.collapsed}"
>
<footer
ng-class=
"{hidden: $root.collapsed}"
>
<span>
v
<app-version></app-version>
©
ZetaOps
</span>
<span>
v
<app-version></app-version>
©
ZetaOps
</span>
...
...
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