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
f9984444
Commit
f9984444
authored
Jan 20, 2016
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ADD refs GH-6 add docstring details
FIX rrefs #5044 refs zetaops/ulakbusGH-153 refs GH-75
parent
608cfdac
Changes
43
Show whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
1665 additions
and
967 deletions
+1665
-967
nodeTable.html
app/shared/templates/nodeTable.html
+2
-2
form_service.js
app/zetalib/form_service.js
+61
-34
ulakbus.formService.Generator.html
docs/html/source/ulakbus.formService.Generator.html
+61
-35
ulakbus.formService.ModalCtrl.html
docs/html/source/ulakbus.formService.ModalCtrl.html
+61
-35
ulakbus.formService.addModalForLinkedModel.html
...ml/source/ulakbus.formService.addModalForLinkedModel.html
+61
-35
ulakbus.formService.dateformatter.html
docs/html/source/ulakbus.formService.dateformatter.html
+61
-35
ulakbus.formService.dispatchClientCmd.html
docs/html/source/ulakbus.formService.dispatchClientCmd.html
+61
-35
ulakbus.formService.doItemAction.html
docs/html/source/ulakbus.formService.doItemAction.html
+61
-35
ulakbus.formService.generate.html
docs/html/source/ulakbus.formService.generate.html
+61
-35
ulakbus.formService.get_diff.html
docs/html/source/ulakbus.formService.get_diff.html
+61
-35
ulakbus.formService.get_diff_array.html
docs/html/source/ulakbus.formService.get_diff_array.html
+61
-35
ulakbus.formService.get_form.html
docs/html/source/ulakbus.formService.get_form.html
+61
-35
ulakbus.formService.get_list.html
docs/html/source/ulakbus.formService.get_list.html
+61
-35
ulakbus.formService.get_wf.html
docs/html/source/ulakbus.formService.get_wf.html
+61
-35
ulakbus.formService.group.html
docs/html/source/ulakbus.formService.group.html
+61
-35
ulakbus.formService.isValidDate.html
docs/html/source/ulakbus.formService.isValidDate.html
+61
-35
ulakbus.formService.isValidEmail.html
docs/html/source/ulakbus.formService.isValidEmail.html
+61
-35
ulakbus.formService.isValidTCNo.html
docs/html/source/ulakbus.formService.isValidTCNo.html
+61
-35
ulakbus.formService.item_from_array.html
docs/html/source/ulakbus.formService.item_from_array.html
+61
-35
ulakbus.formService.makeUrl.html
docs/html/source/ulakbus.formService.makeUrl.html
+61
-35
ulakbus.formService.modalForNodes.html
docs/html/source/ulakbus.formService.modalForNodes.html
+61
-35
ulakbus.formService.modalFormLocator.html
docs/html/source/ulakbus.formService.modalFormLocator.html
+61
-35
ulakbus.formService.pageData.html
docs/html/source/ulakbus.formService.pageData.html
+61
-35
ulakbus.formService.pathDecider.html
docs/html/source/ulakbus.formService.pathDecider.html
+61
-35
ulakbus.formService.prepareFormItems.html
docs/html/source/ulakbus.formService.prepareFormItems.html
+61
-35
ulakbus.formService.submit.html
docs/html/source/ulakbus.formService.submit.html
+61
-35
ulakbus.formService~pathDecider.redirectTo.html
...ml/source/ulakbus.formService~pathDecider.redirectTo.html
+61
-35
ulakbus.formService-pathDecider.redirectTo.html
docs/html/ulakbus.formService-pathDecider.redirectTo.html
+2
-2
ulakbus.formService.ModalCtrl.html
docs/html/ulakbus.formService.ModalCtrl.html
+5
-5
ulakbus.formService.addModalForLinkedModel.html
docs/html/ulakbus.formService.addModalForLinkedModel.html
+5
-5
ulakbus.formService.dateformatter.html
docs/html/ulakbus.formService.dateformatter.html
+1
-1
ulakbus.formService.dispatchClientCmd.html
docs/html/ulakbus.formService.dispatchClientCmd.html
+1
-1
ulakbus.formService.doItemAction.html
docs/html/ulakbus.formService.doItemAction.html
+2
-2
ulakbus.formService.get_diff.html
docs/html/ulakbus.formService.get_diff.html
+3
-3
ulakbus.formService.get_diff_array.html
docs/html/ulakbus.formService.get_diff_array.html
+4
-4
ulakbus.formService.get_form.html
docs/html/ulakbus.formService.get_form.html
+1
-1
ulakbus.formService.item_from_array.html
docs/html/ulakbus.formService.item_from_array.html
+3
-3
ulakbus.formService.modalForNodes.html
docs/html/ulakbus.formService.modalForNodes.html
+3
-3
ulakbus.formService.modalFormLocator.html
docs/html/ulakbus.formService.modalFormLocator.html
+1
-1
ulakbus.formService.pathDecider.html
docs/html/ulakbus.formService.pathDecider.html
+2
-2
ulakbus.formService.prepareFormItems.html
docs/html/ulakbus.formService.prepareFormItems.html
+1
-1
ulakbus.formService.submit.html
docs/html/ulakbus.formService.submit.html
+24
-5
index.rst
docs/index.rst
+19
-17
No files found.
app/shared/templates/nodeTable.html
View file @
f9984444
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
<span
ng-if=
"value.verbose_name"
>
{{ value.verbose_name }}
</span>
<span
ng-if=
"value.verbose_name"
>
{{ value.verbose_name }}
</span>
<span
ng-if=
"!value.verbose_name"
>
{{key}}
</span>
<span
ng-if=
"!value.verbose_name"
>
{{key}}
</span>
</th>
</th>
<th
ng-if=
"
action!==F
alse"
>
İşlem
</th>
<th
ng-if=
"
meta.allow_actions!==f
alse"
>
İşlem
</th>
</tr>
</tr>
</thead>
</thead>
<tbody
ng-class=
"{hidden: node.lengthModels < 1}"
>
<tbody
ng-class=
"{hidden: node.lengthModels < 1}"
>
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
ng-model=
"node.model[outerIndex][k]"
ng-model=
"node.model[outerIndex][k]"
ng-change=
"nodeModelChange(this)"
>
ng-change=
"nodeModelChange(this)"
>
</td>
</td>
<td
ng-if=
"
action!==F
alse"
>
<td
ng-if=
"
meta.allow_actions!==f
alse"
>
<button
modal-for-nodes=
"{{node.schema.model_name}},{{node.schema.formType}},edit,{{$index}}"
>
Düzenle
<button
modal-for-nodes=
"{{node.schema.model_name}},{{node.schema.formType}},edit,{{$index}}"
>
Düzenle
</button>
</button>
<br>
<br>
...
...
app/zetalib/form_service.js
View file @
f9984444
...
@@ -192,7 +192,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -192,7 +192,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -204,7 +204,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -204,7 +204,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator
.
prepareFormItems
=
function
(
scope
)
{
generator
.
prepareFormItems
=
function
(
scope
)
{
...
@@ -663,7 +663,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -663,7 +663,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator
.
dateformatter
=
function
(
formObject
)
{
generator
.
dateformatter
=
function
(
formObject
)
{
...
@@ -684,9 +684,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -684,9 +684,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -727,7 +727,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -727,7 +727,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator
.
get_form
=
function
(
scope
)
{
generator
.
get_form
=
function
(
scope
)
{
...
@@ -836,8 +836,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -836,8 +836,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator
.
pathDecider
=
function
(
client_cmd
,
$scope
,
data
)
{
generator
.
pathDecider
=
function
(
client_cmd
,
$scope
,
data
)
{
if
(
client_cmd
[
0
]
===
'reload'
||
client_cmd
[
0
]
===
'reset'
)
{
if
(
client_cmd
[
0
]
===
'reload'
||
client_cmd
[
0
]
===
'reset'
)
{
...
@@ -851,7 +851,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -851,7 +851,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -902,9 +902,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -902,9 +902,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator
.
get_diff
=
function
(
obj1
,
obj2
)
{
generator
.
get_diff
=
function
(
obj1
,
obj2
)
{
var
result
=
{};
var
result
=
{};
...
@@ -926,10 +926,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -926,10 +926,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator
.
get_diff_array
=
function
(
array1
,
array2
,
way
)
{
generator
.
get_diff_array
=
function
(
array1
,
array2
,
way
)
{
var
result
=
[];
var
result
=
[];
...
@@ -951,8 +951,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -951,8 +951,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator
.
item_from_array
=
function
(
item
,
array
)
{
generator
.
item_from_array
=
function
(
item
,
array
)
{
...
@@ -970,14 +970,40 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -970,14 +970,40 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator
.
submit
=
function
(
$scope
,
redirectTo
)
{
generator
.
submit
=
function
(
$scope
,
redirectTo
)
{
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var
convertDate
=
function
(
model
)
{
var
convertDate
=
function
(
model
)
{
angular
.
forEach
(
model
,
function
(
value
,
key
)
{
angular
.
forEach
(
model
,
function
(
value
,
key
)
{
if
(
value
&&
value
.
constructor
===
Date
)
{
if
(
value
&&
value
.
constructor
===
Date
)
{
...
@@ -1039,11 +1065,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1039,11 +1065,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.
controller
(
'ModalCtrl'
,
function
(
$scope
,
$uibModalInstance
,
Generator
,
items
)
{
.
controller
(
'ModalCtrl'
,
function
(
$scope
,
$uibModalInstance
,
Generator
,
items
)
{
angular
.
forEach
(
items
,
function
(
value
,
key
)
{
angular
.
forEach
(
items
,
function
(
value
,
key
)
{
...
@@ -1091,9 +1117,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1091,9 +1117,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.
directive
(
'modalForNodes'
,
function
(
$uibModal
,
Generator
)
{
.
directive
(
'modalForNodes'
,
function
(
$uibModal
,
Generator
)
{
...
@@ -1212,11 +1238,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,11 +1238,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.
directive
(
'addModalForLinkedModel'
,
function
(
$uibModal
,
$rootScope
,
$route
,
Generator
)
{
.
directive
(
'addModalForLinkedModel'
,
function
(
$uibModal
,
$rootScope
,
$route
,
Generator
)
{
return
{
return
{
...
@@ -1292,6 +1318,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1292,6 +1318,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.
directive
(
'modalFormLocator'
,
function
()
{
.
directive
(
'modalFormLocator'
,
function
()
{
return
{
return
{
...
...
docs/html/source/ulakbus.formService.Generator.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.ModalCtrl.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.addModalForLinkedModel.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.dateformatter.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.dispatchClientCmd.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.doItemAction.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.generate.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.get_diff.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.get_diff_array.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.get_form.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.get_list.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.get_wf.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.group.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.isValidDate.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.isValidEmail.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.isValidTCNo.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.item_from_array.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.makeUrl.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.modalForNodes.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.modalFormLocator.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.pageData.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.pathDecider.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.prepareFormItems.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService.submit.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/source/ulakbus.formService~pathDecider.redirectTo.html
View file @
f9984444
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -508,7 +508,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @ngdoc function
* @ngdoc function
* @name prepareFormItems
* @name prepareFormItems
* @param scope {
o
bject} given scope on which form items prepared
* @param scope {
O
bject} given scope on which form items prepared
* @description
* @description
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* It looks up fields of schema objects and changes their types to proper type for schemaform.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
* To prepare items for schemaform loop items of scope.schema.properties by checking index value's `type` key.
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -520,7 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* For listnode, node and model types it uses templates to generate modal. The modal is aa instance of
* ui.bootstraps modal directive.
* ui.bootstraps modal directive.
*
*
* @returns scope {
o
bject}
* @returns scope {
O
bject}
*/
*/
generator.prepareFormItems = function (scope) {
generator.prepareFormItems = function (scope) {
angular.forEach(scope.form, function (value, key) {
angular.forEach(scope.form, function (value, key) {
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -932,7 +932,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name dateformatter
* @name dateformatter
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @description dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* @param {
o
bject} formObject
* @param {
O
bject} formObject
* @returns {*}
* @returns {*}
*/
*/
generator.dateformatter = function (formObject) {
generator.dateformatter = function (formObject) {
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -953,9 +953,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* on same
* on same
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
* will be open new page with response data
* will be open new page with response data
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {string} key
* @param {string} key
* @param {
o
bject} todo
* @param {
O
bject} todo
* @param {string} mode
* @param {string} mode
* @returns {*}
* @returns {*}
*/
*/
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -995,7 +995,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_form
* @name get_form
* @description Communicates with api with given scope object.
* @description Communicates with api with given scope object.
* @param {
o
bject} scope
* @param {
O
bject} scope
* @returns {*}
* @returns {*}
*/
*/
generator.get_form = function (scope) {
generator.get_form = function (scope) {
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1097,13 +1097,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
* @constructor
* @ngdoc function
* @ngdoc function
* @name pathDecider
* @name pathDecider
* @description pathDecider is used to redirect related path by looking up the data in response
* @description pathDecider is used to redirect related path by looking up the data in response
* @param {string} client_cmd
* @param {string} client_cmd
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} data
* @param {
O
bject} data
*/
*/
generator.pathDecider = function (client_cmd, $scope, data) {
generator.pathDecider = function (client_cmd, $scope, data) {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
if (client_cmd[0] === 'reload' || client_cmd[0] === 'reset') {
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1117,7 +1116,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description redirectTo function redirects to related controller and path with given data
* @description redirectTo function redirects to related controller and path with given data
* before redirect setPageData must be called and pageData need to be defined
* before redirect setPageData must be called and pageData need to be defined
* otherwise redirected path will call api for its data
* otherwise redirected path will call api for its data
* @param {
o
bject} scope
* @param {
O
bject} scope
* @param {string} page
* @param {string} page
* @return {*}
* @return {*}
*/
*/
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1163,9 +1162,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff
* @name get_diff
* @description returns diff of the second param to first param
* @description returns diff of the second param to first param
* @param {
o
bject} obj1
* @param {
O
bject} obj1
* @param {
o
bject} obj2
* @param {
O
bject} obj2
* @returns {
{object}
} diff object of two given objects
* @returns {
Object
} diff object of two given objects
*/
*/
generator.get_diff = function (obj1, obj2) {
generator.get_diff = function (obj1, obj2) {
var result = {};
var result = {};
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1187,10 +1186,10 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name get_diff_array
* @name get_diff_array
* @description extracts items of second array from the first array
* @description extracts items of second array from the first array
* @param {
object} array1
* @param {
Array} array1
* @param {
object} array2
* @param {
Array} array2
* @param {
n
umber} way
* @param {
N
umber} way
* @returns {Array}
* @returns {Array}
diff of arrays
*/
*/
generator.get_diff_array = function (array1, array2, way) {
generator.get_diff_array = function (array1, array2, way) {
var result = [];
var result = [];
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1212,8 +1211,8 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name item_from_array
* @name item_from_array
* @description gets item unicode name from titleMap
* @description gets item unicode name from titleMap
* @param {
o
bject} item
* @param {
O
bject} item
* @param {
a
rray} array
* @param {
A
rray} array
* @returns {*}
* @returns {*}
*/
*/
generator.item_from_array = function (item, array) {
generator.item_from_array = function (item, array) {
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1230,13 +1229,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc function
* @ngdoc function
* @name submit
* @name submit
* @description Submit function is generic function for submiting forms.
* @description Submit function is generic function for submiting forms.
* redirectTo param is used for redirect if return value will be evaluated in a new page.
* - redirectTo param is used for redirect if return value will be evaluated in a new page.
* @param {object} $scope
* - In case of unformatted date object in any key recursively, it must be converted by convertDate function.
* @param {object} redirectTo
* - ListNode and Node objects get seperated from model in
* {@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
* key of scope first.
* - Backend API waits form as model value. So `data.form` key must be set to `$scope.model`
* - Other parameters we pass to backend API are shown in the example below
* ```
* var data = {
"form": $scope.model,
"token": $scope.token,
"model": $scope.form_params.model,
"cmd": $scope.form_params.cmd,
"flow": $scope.form_params.flow,
"object_id": $scope.object_id,
"filter": $scope.filter,
"query": $scope.form_params.query
};
* ```
* ### Special response object process
* - If response object is a downloadable pdf file, checking from headers `headers('content-type') ===
* "application/pdf"` download using Blob object.
*
* @param {Object} $scope
* @param {Object} redirectTo
* @returns {*}
* @returns {*}
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
*/
generator.submit = function ($scope, redirectTo) {
generator.submit = function ($scope, redirectTo) {
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
*/
var convertDate = function (model) {
var convertDate = function (model) {
angular.forEach(model, function (value, key) {
angular.forEach(model, function (value, key) {
if (value
&&
value.constructor === Date) {
if (value
&&
value.constructor === Date) {
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1295,11 +1320,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc controller
* @ngdoc controller
* @name ModalCtrl
* @name ModalCtrl
* @description controller for listnode, node and linkedmodel modal and save data of it
* @description controller for listnode, node and linkedmodel modal and save data of it
* @param {
o
bject} items
* @param {
O
bject} items
* @param {
o
bject} $scope
* @param {
O
bject} $scope
* @param {
o
bject} $uibModalInstance
* @param {
O
bject} $uibModalInstance
* @param {
o
bject} $route
* @param {
O
bject} $route
* @returns returns value for modal
* @returns
{Object}
returns value for modal
*/
*/
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
.controller('ModalCtrl', function ($scope, $uibModalInstance, Generator, items) {
angular.forEach(items, function (value, key) {
angular.forEach(items, function (value, key) {
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1339,9 +1364,9 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalForNodes
* @name modalForNodes
* @description add modal directive for nodes
* @description add modal directive for nodes
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('modalForNodes', function ($uibModal, Generator) {
.directive('modalForNodes', function ($uibModal, Generator) {
return {
return {
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1446,11 +1471,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name addModalForLinkedModel
* @name addModalForLinkedModel
* @description add modal directive for linked models
* @description add modal directive for linked models
* @param {
m
odule} $uibModal
* @param {
M
odule} $uibModal
* @param {
o
bject} $rootScope
* @param {
O
bject} $rootScope
* @param {
m
odule} $route
* @param {
M
odule} $route
* @param {
s
ervice} Generator
* @param {
S
ervice} Generator
* @returns openmodal directive
* @returns
{Object}
openmodal directive
*/
*/
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
.directive('addModalForLinkedModel', function ($uibModal, $rootScope, $route, Generator) {
return {
return {
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -1524,6 +1549,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @ngdoc directive
* @ngdoc directive
* @name modalFormLocator
* @name modalFormLocator
* @description This directive helps to locate form object in modal.
* @description This directive helps to locate form object in modal.
* @returns {Object} form object
*/
*/
.directive('modalFormLocator', function () {
.directive('modalFormLocator', function () {
return {
return {
...
...
docs/html/ulakbus.formService-pathDecider.redirectTo.html
View file @
f9984444
...
@@ -333,7 +333,7 @@
...
@@ -333,7 +333,7 @@
</h3>
</h3>
<h1
class=
"title"
>
<h1
class=
"title"
>
redirectTo
redirectTo
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService~pathDecider.redirectTo.html#line84
8
"
>
source
</a>
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService~pathDecider.redirectTo.html#line84
7
"
>
source
</a>
</h1>
</h1>
<div
id=
"main"
class=
"big-container"
>
<div
id=
"main"
class=
"big-container"
>
<!-- source code html -->
<!-- source code html -->
...
@@ -359,7 +359,7 @@ otherwise redirected path will call api for its data</p>
...
@@ -359,7 +359,7 @@ otherwise redirected path will call api for its data</p>
<tr>
<tr>
<td
class=
"name"
nowrap=
""
>
scope
</td>
<td
class=
"name"
nowrap=
""
>
scope
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
...
...
docs/html/ulakbus.formService.ModalCtrl.html
View file @
f9984444
...
@@ -333,7 +333,7 @@
...
@@ -333,7 +333,7 @@
</h3>
</h3>
<h1
class=
"title"
>
<h1
class=
"title"
>
ModalCtrl
ModalCtrl
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.ModalCtrl.html#line10
38
"
>
source
</a>
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.ModalCtrl.html#line10
63
"
>
source
</a>
</h1>
</h1>
<div
id=
"main"
class=
"big-container"
>
<div
id=
"main"
class=
"big-container"
>
<!-- source code html -->
<!-- source code html -->
...
@@ -357,25 +357,25 @@
...
@@ -357,25 +357,25 @@
<tr>
<tr>
<td
class=
"name"
nowrap=
""
>
items
</td>
<td
class=
"name"
nowrap=
""
>
items
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
$scope
</td>
<td
class=
"name"
nowrap=
""
>
$scope
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
$uibModalInstance
</td>
<td
class=
"name"
nowrap=
""
>
$uibModalInstance
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
$route
</td>
<td
class=
"name"
nowrap=
""
>
$route
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr>
</tr>
...
...
docs/html/ulakbus.formService.addModalForLinkedModel.html
View file @
f9984444
...
@@ -333,7 +333,7 @@
...
@@ -333,7 +333,7 @@
</h3>
</h3>
<h1
class=
"title"
>
<h1
class=
"title"
>
addModalForLinkedModel
addModalForLinkedModel
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.addModalForLinkedModel.html#line12
11
"
>
source
</a>
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.addModalForLinkedModel.html#line12
36
"
>
source
</a>
<a
class=
"name-link signature-attributes"
href=
"templates/shared_templates_filefield.html"
>
template
</a>
<a
class=
"name-link signature-attributes"
href=
"templates/shared_templates_filefield.html"
>
template
</a>
</h1>
</h1>
<div
id=
"main"
class=
"big-container"
>
<div
id=
"main"
class=
"big-container"
>
...
@@ -358,25 +358,25 @@
...
@@ -358,25 +358,25 @@
<tr>
<tr>
<td
class=
"name"
nowrap=
""
>
$uibModal
</td>
<td
class=
"name"
nowrap=
""
>
$uibModal
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
m
odule
M
odule
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
$rootScope
</td>
<td
class=
"name"
nowrap=
""
>
$rootScope
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
$route
</td>
<td
class=
"name"
nowrap=
""
>
$route
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
m
odule
M
odule
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
Generator
</td>
<td
class=
"name"
nowrap=
""
>
Generator
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
s
ervice
S
ervice
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr>
</tr>
...
...
docs/html/ulakbus.formService.dateformatter.html
View file @
f9984444
...
@@ -357,7 +357,7 @@
...
@@ -357,7 +357,7 @@
<tr>
<tr>
<td
class=
"name"
nowrap=
""
>
formObject
</td>
<td
class=
"name"
nowrap=
""
>
formObject
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr>
</tr>
...
...
docs/html/ulakbus.formService.dispatchClientCmd.html
View file @
f9984444
...
@@ -333,7 +333,7 @@
...
@@ -333,7 +333,7 @@
</h3>
</h3>
<h1
class=
"title"
>
<h1
class=
"title"
>
dispatchClientCmd
dispatchClientCmd
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.dispatchClientCmd.html#line87
8
"
>
source
</a>
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.dispatchClientCmd.html#line87
7
"
>
source
</a>
</h1>
</h1>
<div
id=
"main"
class=
"big-container"
>
<div
id=
"main"
class=
"big-container"
>
<!-- source code html -->
<!-- source code html -->
...
...
docs/html/ulakbus.formService.doItemAction.html
View file @
f9984444
...
@@ -360,7 +360,7 @@ will be open new page with response data</p>
...
@@ -360,7 +360,7 @@ will be open new page with response data</p>
<tr>
<tr>
<td
class=
"name"
nowrap=
""
>
$scope
</td>
<td
class=
"name"
nowrap=
""
>
$scope
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
...
@@ -372,7 +372,7 @@ will be open new page with response data</p>
...
@@ -372,7 +372,7 @@ will be open new page with response data</p>
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
todo
</td>
<td
class=
"name"
nowrap=
""
>
todo
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
...
...
docs/html/ulakbus.formService.get_diff.html
View file @
f9984444
...
@@ -333,7 +333,7 @@
...
@@ -333,7 +333,7 @@
</h3>
</h3>
<h1
class=
"title"
>
<h1
class=
"title"
>
get_diff
get_diff
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.get_diff.html#line90
1
"
>
source
</a>
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.get_diff.html#line90
0
"
>
source
</a>
</h1>
</h1>
<div
id=
"main"
class=
"big-container"
>
<div
id=
"main"
class=
"big-container"
>
<!-- source code html -->
<!-- source code html -->
...
@@ -357,13 +357,13 @@
...
@@ -357,13 +357,13 @@
<tr>
<tr>
<td
class=
"name"
nowrap=
""
>
obj1
</td>
<td
class=
"name"
nowrap=
""
>
obj1
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
obj2
</td>
<td
class=
"name"
nowrap=
""
>
obj2
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr>
</tr>
...
...
docs/html/ulakbus.formService.get_diff_array.html
View file @
f9984444
...
@@ -333,7 +333,7 @@
...
@@ -333,7 +333,7 @@
</h3>
</h3>
<h1
class=
"title"
>
<h1
class=
"title"
>
get_diff_array
get_diff_array
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.get_diff_array.html#line92
5
"
>
source
</a>
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.get_diff_array.html#line92
4
"
>
source
</a>
</h1>
</h1>
<div
id=
"main"
class=
"big-container"
>
<div
id=
"main"
class=
"big-container"
>
<!-- source code html -->
<!-- source code html -->
...
@@ -357,19 +357,19 @@
...
@@ -357,19 +357,19 @@
<tr>
<tr>
<td
class=
"name"
nowrap=
""
>
array1
</td>
<td
class=
"name"
nowrap=
""
>
array1
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
object
Array
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
array2
</td>
<td
class=
"name"
nowrap=
""
>
array2
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
object
Array
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
way
</td>
<td
class=
"name"
nowrap=
""
>
way
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
n
umber
N
umber
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr>
</tr>
...
...
docs/html/ulakbus.formService.get_form.html
View file @
f9984444
...
@@ -357,7 +357,7 @@
...
@@ -357,7 +357,7 @@
<tr>
<tr>
<td
class=
"name"
nowrap=
""
>
scope
</td>
<td
class=
"name"
nowrap=
""
>
scope
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr>
</tr>
...
...
docs/html/ulakbus.formService.item_from_array.html
View file @
f9984444
...
@@ -333,7 +333,7 @@
...
@@ -333,7 +333,7 @@
</h3>
</h3>
<h1
class=
"title"
>
<h1
class=
"title"
>
item_from_array
item_from_array
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.item_from_array.html#line9
50
"
>
source
</a>
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.item_from_array.html#line9
49
"
>
source
</a>
</h1>
</h1>
<div
id=
"main"
class=
"big-container"
>
<div
id=
"main"
class=
"big-container"
>
<!-- source code html -->
<!-- source code html -->
...
@@ -357,13 +357,13 @@
...
@@ -357,13 +357,13 @@
<tr>
<tr>
<td
class=
"name"
nowrap=
""
>
item
</td>
<td
class=
"name"
nowrap=
""
>
item
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
array
</td>
<td
class=
"name"
nowrap=
""
>
array
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
a
rray
A
rray
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr>
</tr>
...
...
docs/html/ulakbus.formService.modalForNodes.html
View file @
f9984444
...
@@ -333,7 +333,7 @@
...
@@ -333,7 +333,7 @@
</h3>
</h3>
<h1
class=
"title"
>
<h1
class=
"title"
>
modalForNodes
modalForNodes
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.modalForNodes.html#line1
090
"
>
source
</a>
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.modalForNodes.html#line1
115
"
>
source
</a>
<a
class=
"name-link signature-attributes"
href=
"templates/shared_templates_filefield.html"
>
template
</a>
<a
class=
"name-link signature-attributes"
href=
"templates/shared_templates_filefield.html"
>
template
</a>
</h1>
</h1>
<div
id=
"main"
class=
"big-container"
>
<div
id=
"main"
class=
"big-container"
>
...
@@ -358,13 +358,13 @@
...
@@ -358,13 +358,13 @@
<tr>
<tr>
<td
class=
"name"
nowrap=
""
>
$uibModal
</td>
<td
class=
"name"
nowrap=
""
>
$uibModal
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
m
odule
M
odule
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
Generator
</td>
<td
class=
"name"
nowrap=
""
>
Generator
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
s
ervice
S
ervice
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr>
</tr>
...
...
docs/html/ulakbus.formService.modalFormLocator.html
View file @
f9984444
...
@@ -333,7 +333,7 @@
...
@@ -333,7 +333,7 @@
</h3>
</h3>
<h1
class=
"title"
>
<h1
class=
"title"
>
modalFormLocator
modalFormLocator
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.modalFormLocator.html#line1
291
"
>
source
</a>
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.modalFormLocator.html#line1
316
"
>
source
</a>
<a
class=
"name-link signature-attributes"
href=
"templates/shared_templates_filefield.html"
>
template
</a>
<a
class=
"name-link signature-attributes"
href=
"templates/shared_templates_filefield.html"
>
template
</a>
</h1>
</h1>
<div
id=
"main"
class=
"big-container"
>
<div
id=
"main"
class=
"big-container"
>
...
...
docs/html/ulakbus.formService.pathDecider.html
View file @
f9984444
...
@@ -363,13 +363,13 @@
...
@@ -363,13 +363,13 @@
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
$scope
</td>
<td
class=
"name"
nowrap=
""
>
$scope
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
data
</td>
<td
class=
"name"
nowrap=
""
>
data
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr>
</tr>
...
...
docs/html/ulakbus.formService.prepareFormItems.html
View file @
f9984444
...
@@ -362,7 +362,7 @@ ui.bootstraps modal directive.</p>
...
@@ -362,7 +362,7 @@ ui.bootstraps modal directive.</p>
<tr>
<tr>
<td
class=
"name"
nowrap=
""
>
scope
</td>
<td
class=
"name"
nowrap=
""
>
scope
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
><p>
given scope on which form items prepared
</p></td>
<td
class=
"description last"
><p>
given scope on which form items prepared
</p></td>
</tr>
</tr>
...
...
docs/html/ulakbus.formService.submit.html
View file @
f9984444
...
@@ -333,7 +333,7 @@
...
@@ -333,7 +333,7 @@
</h3>
</h3>
<h1
class=
"title"
>
<h1
class=
"title"
>
submit
submit
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.submit.html#line96
9
"
>
source
</a>
<a
class=
"name-link signature-attributes"
href=
"source/ulakbus.formService.submit.html#line96
8
"
>
source
</a>
</h1>
</h1>
<div
id=
"main"
class=
"big-container"
>
<div
id=
"main"
class=
"big-container"
>
<!-- source code html -->
<!-- source code html -->
...
@@ -344,8 +344,27 @@
...
@@ -344,8 +344,27 @@
<dt></dt>
<dt></dt>
<dd>
<dd>
<div
class=
"description"
>
<div
class=
"description"
>
<p>
Submit function is generic function for submiting forms.
<p>
Submit function is generic function for submiting forms.
</p>
redirectTo param is used for redirect if return value will be evaluated in a new page.
</p>
<ul>
<li>
redirectTo param is used for redirect if return value will be evaluated in a new page.
</li>
<li>
In case of unformatted date object in any key recursively, it must be converted by convertDate function.
</li>
<li>
ListNode and Node objects get seperated from model in
{@link prepareFormItems module:ulakbus.formService.function:prepareFormItems} They must be concat to model
key of scope first.
</li>
<li>
Backend API waits form as model value. So
<code>
data.form
</code>
key must be set to
<code>
$scope.model
</code></li>
<li>
Other parameters we pass to backend API are shown in the example below
<pre
class=
"prettyprint source"
><code>
var data = {
"
form
"
: $scope.model,
"
token
"
: $scope.token,
"
model
"
: $scope.form_params.model,
"
cmd
"
: $scope.form_params.cmd,
"
flow
"
: $scope.form_params.flow,
"
object_id
"
: $scope.object_id,
"
filter
"
: $scope.filter,
"
query
"
: $scope.form_params.query
};
</code></pre><h3>
Special response object process
</h3></li>
<li>
If response object is a downloadable pdf file, checking from headers
<code>
headers('content-type') ===
"
application/pdf
"
</code>
download using Blob object.
</li>
</ul>
</div>
</div>
<div
class=
"details"
></div>
<div
class=
"details"
></div>
<div>
<div>
...
@@ -358,13 +377,13 @@ redirectTo param is used for redirect if return value will be evaluated in a new
...
@@ -358,13 +377,13 @@ redirectTo param is used for redirect if return value will be evaluated in a new
<tr>
<tr>
<td
class=
"name"
nowrap=
""
>
$scope
</td>
<td
class=
"name"
nowrap=
""
>
$scope
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr><tr>
</tr><tr>
<td
class=
"name"
nowrap=
""
>
redirectTo
</td>
<td
class=
"name"
nowrap=
""
>
redirectTo
</td>
<td
class=
"type"
><span
class=
"param-type"
>
<td
class=
"type"
><span
class=
"param-type"
>
o
bject
O
bject
</span></td>
</span></td>
<td
class=
"description last"
></td>
<td
class=
"description last"
></td>
</tr>
</tr>
...
...
docs/index.rst
View file @
f9984444
ULAKBUS API-UI Etkileşimi
ULAKBUS API-UI Etkileşimi
=========================
=========================
.. figure:: http://ulakbus.net/img/brand-logo.png
.. figure:: http://ulakbus.net/img/brand-logo.png :alt: Ulakbus_logo
:alt: Ulakbus logo
Ulakbus logo
Bu belge **Ulakbus API ve UI** bileşenlerinin etkileşimini göstermek
için hazırlanmıştır. API kullanılarak hazırlanan view, model ve jenerik fonksiyonlarda hangi tip verinin kullanıcı
arayüzünde nasıl gösterildiğini bu belgede bulabilirsiniz.
Bu belge **Ulakbus** API ve UI bileşenlerinin etkileşimini göstermek
için hazırlanmıştır.
Ulakbüs UI Sayfa Tipleri
Ulakbüs UI Sayfa Tipleri
------------------------
------------------------
...
@@ -18,10 +17,9 @@ Ulakbüs kullanıcı arayüzünde sunulan temel içerik türleri şunlardır;
...
@@ -18,10 +17,9 @@ Ulakbüs kullanıcı arayüzünde sunulan temel içerik türleri şunlardır;
- Liste sayfası
- Liste sayfası
- Detay sayfası
- Detay sayfası
Bu içerik türleri API'ın iş akışlarında sunduğu temel içerik türleridir.
Bu içerik türleri API'ın iş akışlarında sunduğu temel içerik türleridir. Bu içerik türlerinin kullanıcı arayüzünde
Bu içerik türlerinin kullanıcı arayüzünde doğru biçimde yorumlanması
doğru biçimde yorumlanması için ``response`` nesnesinde gönderilecek anahtar değerler belirlenmiştir. Bu anahtarlar
için ``response`` nesnesinde gönderilecek anahtar değerler
aşağıdaki tablodaki gibidir;
belirlenmiştir. Bu anahtarlar aşağıdaki tablodaki gibidir;
+---------------+---------------+
+---------------+---------------+
| İçerik türü | Anahtar |
| İçerik türü | Anahtar |
...
@@ -37,22 +35,26 @@ belirlenmiştir. Bu anahtarlar aşağıdaki tablodaki gibidir;
...
@@ -37,22 +35,26 @@ belirlenmiştir. Bu anahtarlar aşağıdaki tablodaki gibidir;
yukarıdan aşağıya doğru detay - form - liste olacak şekilde aynı
yukarıdan aşağıya doğru detay - form - liste olacak şekilde aynı
sayfada yorumlanırlar.
sayfada yorumlanırlar.
Her sayfaya ait alt özellikler ilgili başlık altında anlatılacaktır.
Form sayfası
Form sayfası
~~~~~~~~~~~~
~~~~~~~~~~~~
Örnek bir forms nesnesi aşağıdaki gibidir:
Ulakbus UI form işlemlerini gerçekleştirmek için angular-schemaform_ Örnek bir ``forms`` nesnesi aşağıdaki gibidir:
.. _angular-schemaform:
.. code:: json
.. code:: json
{
{
forms
: {
"forms"
: {
form
: [],
"form"
: [],
schema
: {
"schema"
: {
properties
: {},
"properties"
: {},
type: o
bject,
"type": O
bject,
required
: []
"required"
: []
},
},
model
: {}
"model"
: {}
}
}
}
}
...
...
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