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 @@
<div class="row">
<div class="major-buttons">
<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 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 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>
......
......@@ -12,6 +12,7 @@
angular.module('ulakbus.dashboard', ['ngRoute'])
.controller('DashCtrl', function ($scope, $rootScope, $location) {
//if($rootScope.loggedInUser){$location.path("/login");}
$scope.testData = "<h1>This is main Dashboard</h1>";
$scope.section = function(section_index){
$rootScope.section = section_index;
}
});
\ No newline at end of file
......@@ -39,8 +39,8 @@ app.directive('headerSubMenu', function () {
restrict: 'E',
controller: "CRUDAddEditCtrl",
replace: true,
link: function($scope){
$scope.triggerSubmit = function() {
link: function ($scope) {
$scope.triggerSubmit = function () {
// todo: double make it but single not solve this!
angular.element($('#submitbutton')).triggerHandler('click');
angular.element($('#submitbutton')).triggerHandler('click');
......@@ -64,28 +64,38 @@ app.directive('sidebar', ['$location', function () {
replace: true,
scope: {},
controller: function ($scope, $rootScope, $http, RESTURL, $location, $timeout) {
$rootScope.$watch(
$rootScope.loggedInUser, function(){
$http.post(RESTURL.url + 'crud/').success(function (data) {
$scope.menuItems = data.app_models;
// at start define breadcrumblinks for breadcrumb
angular.forEach(data.app_models, function (value, key) {
angular.forEach(value[1], function (v, k) {
if(v[1] == $location.path().split('/')[1]){
$rootScope.breadcrumblinks = [value[0], v[0]];
} else {
$rootScope.breadcrumblinks = ['Panel'];
}
});
});
$http.post(RESTURL.url + 'crud/').success(function (data) {
$scope.allMenuItems = data.app_models;
$scope.menuItems = []; // angular.copy($scope.allMenuItems);
// at start define breadcrumblinks for breadcrumb
angular.forEach(data.app_models, function (value, key) {
angular.forEach(value[1], function (v, k) {
if (v[1] == $location.path().split('/')[1]) {
$rootScope.breadcrumblinks = [value[0], v[0]];
$scope.menuItems = [$scope.allMenuItems[key]];
} else {
$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
$timeout(function(){
$('#side-menu').metisMenu();
}, 2000);
//$timeout(function () {
// $('#side-menu').metisMenu();
//}, 2000);
$scope.selectedMenu = $location.path();
$scope.collapseVar = 0;
......@@ -101,7 +111,7 @@ app.directive('sidebar', ['$location', function () {
};
// breadcrumb function changes breadcrumb items and itemlist must be list
$scope.breadcrumb = function(itemlist){
$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;
......
This diff is collapsed.
This diff is collapsed.
......@@ -200,13 +200,16 @@ angular.module("components/dashboard/dashboard.html", []).run(["$templateCache",
" <div class=\"row\">\n" +
" <div class=\"major-buttons\">\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 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 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" +
......
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