Commit 7694ca14 authored by Evren Kutar's avatar Evren Kutar

reload and reset commands first implementation

parent 4360b1a5
...@@ -81,7 +81,13 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService']) ...@@ -81,7 +81,13 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
}) })
/** /**
* @name CRUDCtrl
* @description
* CRUDCtrl controller is base controller for crud module to redirect to related controller
* This controller play an empty role for api calls.
* With response data, location path change to related controller
* *
* @returns {object}
*/ */
.controller('CRUDCtrl', function ($scope, $routeParams, Generator, CrudUtility) { .controller('CRUDCtrl', function ($scope, $routeParams, Generator, CrudUtility) {
// get required params by calling CrudUtility.generateParam function // get required params by calling CrudUtility.generateParam function
...@@ -97,6 +103,12 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService']) ...@@ -97,6 +103,12 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
* client_cmd can be in ['show', 'list', 'form', 'reload', 'refresh'] * client_cmd can be in ['show', 'list', 'form', 'reload', 'refresh']
* There are 3 directives to manipulate controllers scope objects in crud.html * There are 3 directives to manipulate controllers scope objects in crud.html
* *
* The controller works in 2 ways, with and without pageData.
* If pageData has set, using Generator's getPageData() function, sets its scope items. After getting pageData
* pageData must be set to `{pageData: false}` for clear scope of next job.
*
* If pageData has not set using Generator's get_wf() function gets scope items from api call.
*
* @returns {object} * @returns {object}
*/ */
.controller('CRUDListFormCtrl', function ($scope, $rootScope, $location, $http, $log, $modal, $timeout, Generator, $routeParams, CrudUtility) { .controller('CRUDListFormCtrl', function ($scope, $rootScope, $location, $http, $log, $modal, $timeout, Generator, $routeParams, CrudUtility) {
...@@ -184,6 +196,16 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService']) ...@@ -184,6 +196,16 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
//} //}
} }
if ($routeParams.cmd === 'reload') {
$scope.cmd = 'reload';
Generator.get_wf($scope);
}
if ($routeParams.cmd === 'reset') {
delete $scope.token;
$scope.cmd = 'reset';
Generator.get_wf($scope);
}
}) })
.directive('crudListDirective', function () { .directive('crudListDirective', function () {
......
...@@ -99,13 +99,13 @@ angular.module('formService', []) ...@@ -99,13 +99,13 @@ angular.module('formService', [])
*/ */
// todo: remove after backend fix // todo: remove after backend fix
angular.forEach(scope.form, function (value, key) { //angular.forEach(scope.form, function (value, key) {
if (value.type === 'select') { // if (value.type === 'select') {
scope.schema.properties[value.key].type = 'select'; // scope.schema.properties[value.key].type = 'select';
scope.schema.properties[value.key].titleMap = value.titleMap; // scope.schema.properties[value.key].titleMap = value.titleMap;
scope.form[key] = value.key; // scope.form[key] = value.key;
} // }
}); //});
angular.forEach(scope.schema.properties, function (v, k) { angular.forEach(scope.schema.properties, function (v, k) {
......
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