Commit e9ec4287 authored by Evren Kutar's avatar Evren Kutar

documenting and inline commenting

generate dist
parent 7fb39794
......@@ -8,6 +8,16 @@
*/
angular.module('ulakbus.crud')
/**
* this is a directive for quick add widget of listnodes
* quick add widget does simply that; no need to add listnode item with model,
* simply add an item to listnode searching related ulakbus model
* needs that keys in listnode schema:
* quick_add: true
* quick_add_model: <modelname>
* quick_add_field: to which field the data found will be added
* thanks u.u
*/
.directive('quickAdd', function (Generator) {
return {
templateUrl: 'components/crud/templates/quick_add.html',
......
<div ng-app="ulakbus.dashboard" class="dashboard academician-dashboard">
<div class="starter-template">
<academic-calendar></academic-calendar>
<!--<user-tasks></user-tasks>-->
<ng-include src="'components/dashboard/user-templates/student.html'" ng-if="$root.current_user.is_student"></ng-include>
<ng-include src="'components/dashboard/user-templates/staff.html'" ng-if="!$root.current_user.is_student"></ng-include>
<ng-include src="'components/dashboard/user-templates/academician.html'" ng-if="$root.current_user.is_staff && $root.current_user.is_academic"></ng-include>
<user-tasks></user-tasks>
</div>
</div>
\ No newline at end of file
......@@ -40,6 +40,11 @@ angular.module('ulakbus.dashboard', [])
$scope.students = [];
$scope.staffs = [];
/**
* this function is for searchin student or personel
* uses $scope.keyword objects
* @param where
*/
$scope.search = function (where) {
if ($scope.keyword.staff.length > 2 || $scope.keyword.student.length > 2) {
$timeout(function () {
......@@ -66,16 +71,27 @@ angular.module('ulakbus.dashboard', [])
$scope.userPopover = {templateUrl: 'components/dashboard/user-info.html'};
/**
* when student or personel search results appear,
* user can see the sample info of student/personel before to select it
* this function triggered onhover the item
* @param type
* @param key
*/
$scope.get_info = function (type, key) {
Generator.get_list({url: 'crud', form_params: {wf: 'crud', model: type, object_id: key, cmd: 'show'}})
.then(function (data) {
$scope.userPopover.name = data.data.object.unicode;
$scope.userPopover.tcno = data.data.object.tckn;
//debugger;
$scope.userPopover.name = data.object['Ad'] + " " + data.object['Soyad'];
$scope.userPopover.tcno = data.object['TC Kimlik No'];
$scope.userPopover.image = data.object['Avatar'] || 'img/sample-profile-pic.jpg';
})
};
/**
* @description selecting
* @param who - who is the data of selected person in search results
* @param type - type can be 'ogrenci' or 'personel'
*/
$scope.select = function (who, type) {
$rootScope.$broadcast('selectedUser', {name: who[0], tcno: who[1], key: who[2]});
// get 'who's related transactions and manipulate sidebar menu
......@@ -84,6 +100,9 @@ angular.module('ulakbus.dashboard', [])
};
/**
* dashboard also catches notifications to use in widgets
*/
$scope.$on("notifications", function (event, data) {
$scope.notifications = data;
});
......@@ -92,11 +111,16 @@ angular.module('ulakbus.dashboard', [])
$scope.selectedUser = data;
});
/**
* removes selected user
*/
$scope.deselectUser = function () {
delete $scope.selectedUser;
delete $scope.selectedMenuItems;
};
// this function needed by tasks widget
// if a user wants to dismiss a task it broadcasts the item to markasread
$scope.markAsRead = function (items) {
$rootScope.$broadcast("markasread", items);
};
......@@ -105,19 +129,4 @@ angular.module('ulakbus.dashboard', [])
// $route.reload();
//}
})
.directive('sidebarNotifications', function () {
return {
templateUrl: 'shared/templates/directives/sidebar-notification.html',
restrict: 'E',
replace: true,
link: function ($scope) {
// sidebar notifications from rootScope broadcast
//$scope.$on("notifications", function (event, data) {
// $scope.notifications = data;
//});
}
}
});
......@@ -21,12 +21,17 @@ angular.module('ulakbus.dashboard')
replace: true,
scope: {},
controller: function ($scope) {
// todo: below are for test, will be removed
$scope.task_list = [
{WFToken: "yfuialhfuial", title: "sample 1 workflow", description: "sample 1", wf_type: "type x", date: '02.05.2016'},
{WFToken: "yfuialhfuial", title: "sample 2 workflow", description: "sample 2", wf_type: "type x", date: '02.05.2016'},
{WFToken: "yfuialhfuial", title: "sample 3 workflow", description: "sample 3", wf_type: "type y", date: '02.05.2016'},
{WFToken: "yfuialhfuial", title: "sample 4 workflow", description: "sample 4", wf_type: "type y", date: '02.05.2016'}
];
/**
* tasks need to be regrouped by wf_type
* @returns {{}}
*/
var regroup_tasks = function () {
var grouped_tasks = {};
angular.forEach($scope.task_list, function (value, key) {
......@@ -37,9 +42,14 @@ angular.module('ulakbus.dashboard')
};
$scope.task_list = regroup_tasks();
$scope.$on("task_list", function (event, data) {
$scope.task_list = data;
regroup_tasks();
$scope.task_list = regroup_tasks(data);
});
/**
* this will send the websocket that we need to go certain workflow
* and websocket will send the wf data with cmd in it
* @param wf_token
*/
$scope.gototask = function (wf_token) {
WSOps.doSend({view: "open_wf", wf_token: wf_token});
}
......
<div style="width:400px;">
<div class="row">
<div class="col-md-6">
<img src="img/sample-profile-pic.jpg" alt="{{userPopover.name}}" class="img-thumbnail">
<img ng-src="userPopover.image" alt="{{userPopover.name}}" class="img-thumbnail">
</div>
</div>
......
......@@ -11,10 +11,10 @@
</td>
</tr>
<tr>
<td>Notifications:</td>
<td>KeepAlive Ping:</td>
<td>
<button class="btn"
ng-class="{'btn-success':notificate=='on', 'btn-danger':notificate=='off'}" ng-click="setnotification()">{{notificate}}</button>
ng-class="{'btn-success':keepAlive=='on', 'btn-danger':keepAlive=='off'}" ng-click="setKeepAlive()">{{keepAlive}}</button>
</td>
</tr>
<tr>
......
......@@ -7,12 +7,20 @@
*/
'use strict';
angular.module('ulakbus')
.factory('DevSettings', function ($cookies) {
var devSettings = {};
devSettings.settings = {
keepAlive: $cookies.get("keepAlive") || 'on'
};
return devSettings;
});
angular.module('ulakbus.devSettings', ['ngRoute'])
.controller('DevSettingsController', function ($scope, $cookies, $rootScope, RESTURL) {
.controller('DevSettingsController', function ($scope, $cookies, $rootScope, RESTURL, DevSettings) {
$scope.backendurl = $cookies.get("backendurl");
$scope.notificate = $cookies.get("notificate") || "on";
$scope.keepAlive = $cookies.get("keepAlive") || "on";
//$scope.querydebug = $cookies.get("querydebug") || "on";
$scope.changeSettings = function (what, set) {
......@@ -30,8 +38,9 @@ angular.module('ulakbus.devSettings', ['ngRoute'])
RESTURL.url = $scope.backendurl;
};
$scope.setnotification = function () {
$scope.changeSettings("notificate", $scope.switchOnOff($scope.notificate));
$scope.setKeepAlive = function () {
$scope.changeSettings("keepAlive", $scope.switchOnOff($scope.keepAlive));
DevSettings.settings.keepAlive = $cookies.get("keepAlive");
};
//$scope.setquerydebug = function () {
......
......@@ -122,6 +122,7 @@
<script src="components/dashboard/dashboard_controller.js"></script>
<script src="components/dashboard/dashboard_widgets_directives.js"></script>
<script src="components/crud/crud_controller.js"></script>
<script src="components/crud/crud_widgets.js"></script>
<script src="components/debug/debug_controller.js"></script>
<script src="components/devSettings/devSettings_controller.js"></script>
<script src="components/error_pages/error_controller.js"></script>
......
......@@ -130,6 +130,7 @@
<script src="components/dashboard/dashboard_controller.js"></script>
<script src="components/dashboard/dashboard_widgets_directives.js"></script>
<script src="components/crud/crud_controller.js"></script>
<script src="components/crud/crud_widgets.js"></script>
<script src="components/debug/debug_controller.js"></script>
<script src="components/devSettings/devSettings_controller.js"></script>
<script src="components/error_pages/error_controller.js"></script>
......
<div class="right-sidebar">
<div class="right-sidebar-box">
<div class="right-sidebar-messages">
<div class="right-sidebar-title clearfix">
<h3>Mesajlar</h3>
<span><a role="button">Tüm Mesajlar</a></span>
</div>
<!-- end of right-sidebar-title -->
<div class="right-sidebar-message-block" ng-repeat="notify in notifications[2] | limitTo:5">
<a class="clearfix">
<img src="../../../img/sample-profile-pic.jpg">
<div class="right-sidebar-message-content">
<div>{{notify.title}}</div>
<div>{{notify.body}}</div>
<div>16:05</div>
</div>
<!-- end of right-sidebar-message-content -->
</a>
</div>
<!-- end of right-sidebar-message-block -->
</div>
<!-- end of right-sidebar-messages -->
</div>
<!-- end of right-sidebar-box -->
<div class="right-sidebar-box">
<div class="right-sidebar-tasks">
<div class="right-sidebar-title clearfix">
<h3>Görevler</h3>
<span><a role="button">Tüm Görevler</a></span>
</div>
<!-- end of right-sidebar-title -->
<!--<div class="right-sidebar-task-block">-->
<!--<div class="task-type">Devam Eden Görevler</div>-->
<!--<a role="button">-->
<!--<div class="task-title">Öğrenci Kayıt</div>-->
<!--<div class="progress">-->
<!--<div class="progress-bar" role="progressbar" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100" style="min-width: 2em; width:25%;">-->
<!--25%-->
<!--</div>-->
<!--</div>-->
<!--&lt;!&ndash; end of progress &ndash;&gt;-->
<!--</a>-->
<!--</div>-->
<!-- end of right-sidebar-task-block -->
<div class="right-sidebar-task-block">
<div class="task-type">Onay Bekleyen Görevler</div>
<a ng-repeat="notify in notifications[1] | limitTo:5">
<div class="task-title">{{notify.title}}</div>
</a>
</div>
<!-- end of right-sidebar-task-block -->
</div>
<!-- end of right-sidebar-tasks -->
</div>
<!-- end of right-sidebar-box -->
<div class="right-sidebar-box">
<div class="right-sidebar-announcements">
<div class="right-sidebar-title clearfix">
<h3>Duyurular</h3>
<span><a role="button">Tüm Duyurular</a></span>
</div>
<!-- end of right-sidebar-title -->
<div class="right-sidebar-announcement-block">
<a ng-repeat="notify in notifications[3] | limitTo:5">{{notify.body}}</a>
</div>
<!-- end of right-sidebar-status-block -->
</div>
<!-- end of right-sidebar-status -->
</div>
<!-- end of right-sidebar-box -->
<div class="right-sidebar-box">
<div class="right-sidebar-last-actions">
<div class="right-sidebar-title clearfix">
<h3>Son İşlemler</h3>
<span><a role="button">Tüm İşlemler</a></span>
</div>
<!-- end of right-sidebar-title -->
<div class="right-sidebar-last-action-block">
<a role="button">Birinci dönem bitimine 10 gün kaldı.</a>
<a role="button">Ders seçimi işlemleri xx tarihinde başlayacaktır.</a>
</div>
<!-- end of right-sidebar-status-block -->
</div>
<!-- end of right-sidebar-status -->
</div>
<!-- end of right-sidebar-box -->
</div>
<!-- end of right-sidebar -->
\ No newline at end of file
......@@ -309,7 +309,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
inline_edit: scope.inline_edit
},
url: scope.url,
wf: scope.wf,
wf: v.wf || scope.wf,
quick_add: v.quick_add,
quick_add_field: v.quick_add_field,
quick_add_model: v.quick_add_model,
nodeModelChange: function (item) {
}
......@@ -318,6 +321,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
angular.forEach(v.schema, function (item) {
scope[v.type][k].schema.properties[item.name] = angular.copy(item);
if (angular.isDefined(item.wf)) {
scope[v.type][k].schema.properties[item.name]['wf'] = angular.copy(item.wf);
}
// prepare required fields
if (item.required === true && item.name !== 'idx') {
scope[v.type][k].schema.required.push(angular.copy(item.name));
......@@ -1286,7 +1293,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
scope.node.schema.wf = scope.node.url;
angular.forEach(scope.node.schema.properties, function (value, key) {
scope.node.schema.properties[key].wf = scope.node.url;
if (angular.isDefined(scope.node.schema.properties[key].wf)){}
else {
scope.node.schema.properties[key].wf = scope.node.url;
}
scope.node.schema.properties[key].list_cmd = 'select_list';
});
......
......@@ -18,7 +18,7 @@ angular.module('ulakbus')
/**
* WSOps operates all websocket interactions
*/
.factory('WSOps', function (WSUri, $q, $log, $rootScope, $timeout, $document, ErrorService, WS, IsOnline) {
.factory('WSOps', function (WSUri, $q, $log, $rootScope, $timeout, $document, ErrorService, WS, IsOnline, DevSettings) {
$rootScope.$on('ws_turn_on', function () {
generate_ws();
});
......@@ -87,14 +87,10 @@ angular.module('ulakbus')
};
var keepAlivePing = function (interval) {
return setInterval(function () {
if ($rootScope.websocketIsOpen && IsOnline.get_status()) {
if ($rootScope.websocketIsOpen && IsOnline.get_status() && DevSettings.settings.keepAlive === 'on') {
wsOps.doSend(angular.toJson({data: {view: "ping"}}));
pingCounter += 1;
checkPing();
} else {
$timeout(function () {
this(interval);
}, 1000);
}
}, interval);
};
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
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