Commit 5b6df6ca authored by Evren Kutar's avatar Evren Kutar

v0.0.3 change sidebar links according to section

parent 89b7aa09
...@@ -4,13 +4,16 @@ ...@@ -4,13 +4,16 @@
<div class="row"> <div class="row">
<div class="major-buttons"> <div class="major-buttons">
<div class="col-md-4"> <div class="col-md-4">
<a href=""><button type="button" class="btn btn-personnel brand-bg"><i class="fa fa-user"></i> PERSONEL İŞLERİ</button></a> <a href=""><button type="button" class="btn btn-personnel brand-bg" ng-click="section(2)"><i class="fa fa-user"></i>
PERSONEL İŞLERİ</button></a>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<a href=""><button type="button" class="btn btn-student brand-bg"><i class="fa fa-graduation-cap"></i> ÖĞRENCİ İŞLERİ</button></a> <a href=""><button type="button" class="btn btn-student brand-bg" ng-click="section(0)"><i
class="fa fa-graduation-cap"></i> ÖĞRENCİ İŞLERİ</button></a>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<a href=""><button type="button" class="btn btn-system brand-bg"><i class="fa fa-gears"></i> SİSTEM</button></a> <a href=""><button type="button" class="btn btn-system brand-bg" ng-click="section(3)"><i class="fa fa-gears"></i>
SİSTEM</button></a>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
angular.module('ulakbus.dashboard', ['ngRoute']) angular.module('ulakbus.dashboard', ['ngRoute'])
.controller('DashCtrl', function ($scope, $rootScope, $location) { .controller('DashCtrl', function ($scope, $rootScope, $location) {
//if($rootScope.loggedInUser){$location.path("/login");} $scope.section = function(section_index){
$scope.testData = "<h1>This is main Dashboard</h1>"; $rootScope.section = section_index;
}
}); });
\ No newline at end of file
...@@ -39,8 +39,8 @@ app.directive('headerSubMenu', function () { ...@@ -39,8 +39,8 @@ app.directive('headerSubMenu', function () {
restrict: 'E', restrict: 'E',
controller: "CRUDAddEditCtrl", controller: "CRUDAddEditCtrl",
replace: true, replace: true,
link: function($scope){ link: function ($scope) {
$scope.triggerSubmit = function() { $scope.triggerSubmit = function () {
// todo: double make it but single not solve this! // todo: double make it but single not solve this!
angular.element($('#submitbutton')).triggerHandler('click'); angular.element($('#submitbutton')).triggerHandler('click');
angular.element($('#submitbutton')).triggerHandler('click'); angular.element($('#submitbutton')).triggerHandler('click');
...@@ -64,28 +64,38 @@ app.directive('sidebar', ['$location', function () { ...@@ -64,28 +64,38 @@ app.directive('sidebar', ['$location', function () {
replace: true, replace: true,
scope: {}, scope: {},
controller: function ($scope, $rootScope, $http, RESTURL, $location, $timeout) { controller: function ($scope, $rootScope, $http, RESTURL, $location, $timeout) {
$rootScope.$watch( $http.post(RESTURL.url + 'crud/').success(function (data) {
$rootScope.loggedInUser, function(){ $scope.allMenuItems = data.app_models;
$http.post(RESTURL.url + 'crud/').success(function (data) { $scope.menuItems = []; // angular.copy($scope.allMenuItems);
$scope.menuItems = data.app_models; // at start define breadcrumblinks for breadcrumb
// at start define breadcrumblinks for breadcrumb angular.forEach(data.app_models, function (value, key) {
angular.forEach(data.app_models, function (value, key) { angular.forEach(value[1], function (v, k) {
angular.forEach(value[1], function (v, k) { if (v[1] == $location.path().split('/')[1]) {
if(v[1] == $location.path().split('/')[1]){ $rootScope.breadcrumblinks = [value[0], v[0]];
$rootScope.breadcrumblinks = [value[0], v[0]]; $scope.menuItems = [$scope.allMenuItems[key]];
} else { } else {
$rootScope.breadcrumblinks = ['Panel']; $rootScope.breadcrumblinks = ['Panel'];
} }
});
});
}); });
});
});
$rootScope.$watch(function($rootScope) {return $rootScope.section},
function(newindex, oldindex){
if(newindex > -1){
$scope.menuItems = [$scope.allMenuItems[newindex]];
$scope.collapseVar = 1;
$timeout(function () {
$('#side-menu').metisMenu();
});
}
} }
); );
// todo: change to $watch to init // todo: change to $watch to init
$timeout(function(){ //$timeout(function () {
$('#side-menu').metisMenu(); // $('#side-menu').metisMenu();
}, 2000); //}, 2000);
$scope.selectedMenu = $location.path(); $scope.selectedMenu = $location.path();
$scope.collapseVar = 0; $scope.collapseVar = 0;
...@@ -101,7 +111,7 @@ app.directive('sidebar', ['$location', function () { ...@@ -101,7 +111,7 @@ app.directive('sidebar', ['$location', function () {
}; };
// breadcrumb function changes breadcrumb items and itemlist must be list // breadcrumb function changes breadcrumb items and itemlist must be list
$scope.breadcrumb = function(itemlist){ $scope.breadcrumb = function (itemlist) {
$rootScope.breadcrumblinks = itemlist; $rootScope.breadcrumblinks = itemlist;
// showSaveButton is used for to show or not to show save button on top of the page // showSaveButton is used for to show or not to show save button on top of the page
$rootScope.showSaveButton = false; $rootScope.showSaveButton = false;
......
This diff is collapsed.
This diff is collapsed.
...@@ -200,13 +200,16 @@ angular.module("components/dashboard/dashboard.html", []).run(["$templateCache", ...@@ -200,13 +200,16 @@ angular.module("components/dashboard/dashboard.html", []).run(["$templateCache",
" <div class=\"row\">\n" + " <div class=\"row\">\n" +
" <div class=\"major-buttons\">\n" + " <div class=\"major-buttons\">\n" +
" <div class=\"col-md-4\">\n" + " <div class=\"col-md-4\">\n" +
" <a href=\"\"><button type=\"button\" class=\"btn btn-personnel brand-bg\"><i class=\"fa fa-user\"></i> PERSONEL İŞLERİ</button></a>\n" + " <a href=\"\"><button type=\"button\" class=\"btn btn-personnel brand-bg\" ng-click=\"section(2)\"><i class=\"fa fa-user\"></i>\n" +
" PERSONEL İŞLERİ</button></a>\n" +
" </div>\n" + " </div>\n" +
" <div class=\"col-md-4\">\n" + " <div class=\"col-md-4\">\n" +
" <a href=\"\"><button type=\"button\" class=\"btn btn-student brand-bg\"><i class=\"fa fa-graduation-cap\"></i> ÖĞRENCİ İŞLERİ</button></a>\n" + " <a href=\"\"><button type=\"button\" class=\"btn btn-student brand-bg\" ng-click=\"section(0)\"><i\n" +
" class=\"fa fa-graduation-cap\"></i> ÖĞRENCİ İŞLERİ</button></a>\n" +
" </div>\n" + " </div>\n" +
" <div class=\"col-md-4\">\n" + " <div class=\"col-md-4\">\n" +
" <a href=\"\"><button type=\"button\" class=\"btn btn-system brand-bg\"><i class=\"fa fa-gears\"></i> SİSTEM</button></a>\n" + " <a href=\"\"><button type=\"button\" class=\"btn btn-system brand-bg\" ng-click=\"section(3)\"><i class=\"fa fa-gears\"></i>\n" +
" SİSTEM</button></a>\n" +
" </div>\n" + " </div>\n" +
" </div>\n" + " </div>\n" +
" </div>\n" + " </div>\n" +
......
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