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
d1c4af40
Commit
d1c4af40
authored
Nov 20, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Feature/issue44'
parents
06f9ed64
f48e927d
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
193 additions
and
848 deletions
+193
-848
Gruntfile.js
Gruntfile.js
+1
-1
app.js
app/app.js
+0
-1
app_routes.js
app/app_routes.js
+15
-30
crud_controller.js
app/components/crud/crud_controller.js
+95
-60
crud_controller_test.js
app/components/crud/crud_controller_test.js
+1
-34
crud.html
app/components/crud/templates/crud.html
+4
-0
edit.html
app/components/crud/templates/edit.html
+0
-6
form.html
app/components/crud/templates/form.html
+1
-1
list.html
app/components/crud/templates/list.html
+14
-11
add.html
app/components/wf/templates/add.html
+0
-35
edit.html
app/components/wf/templates/edit.html
+0
-6
list.html
app/components/wf/templates/list.html
+0
-65
show.html
app/components/wf/templates/show.html
+0
-51
wf_controller.js
app/components/wf/wf_controller.js
+0
-92
wf_controller_test.js
app/components/wf/wf_controller_test.js
+0
-61
main.js
app/main.js
+0
-1
form_service.js
app/zetalib/forms/form_service.js
+31
-127
form_service_test.js
app/zetalib/forms/form_service_test.js
+2
-58
interceptors.js
app/zetalib/interceptors.js
+0
-7
app.js
dist/app.js
+2
-2
components.js
dist/bower_components/components.js
+1
-1
templates.js
dist/templates.js
+26
-198
No files found.
Gruntfile.js
View file @
d1c4af40
...
...
@@ -330,7 +330,7 @@ module.exports = function (grunt) {
grunt
.
loadNpmTasks
(
'grunt-preprocess'
);
grunt
.
loadNpmTasks
(
'grunt-env'
);
grunt
.
registerTask
(
'dev'
,
[
'env:dev'
,
'preprocess:dev'
,
'html2js:dev'
,
'watch:dev'
]);
grunt
.
registerTask
(
'dev'
,
[
'env:dev'
,
'preprocess:dev'
,
'html2js:dev'
,
'
default'
,
'
watch:dev'
]);
grunt
.
registerTask
(
'test'
,
[
'bower'
,
'karma:continuous'
]);
grunt
.
registerTask
(
'i18n'
,
[
'nggettext_extract'
,
'nggettext_compile'
]);
grunt
.
registerTask
(
'local_prod'
,
[
'bower'
,
'env:prod'
,
'preprocess:prod'
,
'nggettext_compile'
,
'concat:js'
,
'concat:css'
,
'concat:components'
,
'copy:local_prod'
,
'html2js:prod'
,
'uglify:dist'
,
'connect:prod_server'
,
'watch:local_prod'
]);
...
...
app/app.js
View file @
d1c4af40
...
...
@@ -22,7 +22,6 @@ var app = angular.module(
'ulakbus.crud'
,
'ulakbus.debug'
,
'ulakbus.devSettings'
,
'ulakbus.wf'
,
'ulakbus.version'
,
//'schemaForm',
'gettext'
,
...
...
app/app_routes.js
View file @
d1c4af40
...
...
@@ -22,45 +22,30 @@ app.config(['$routeProvider', function ($routeProvider, $route) {
// use crud without selected user
// important: regex urls must be defined later than static ones
.
when
(
'/:wf/'
,
{
templateUrl
:
'components/
wf/templates/ad
d.html'
,
templateUrl
:
'components/
crud/templates/cru
d.html'
,
controller
:
'CRUDCtrl'
})
.
when
(
'/:wf/
list
'
,
{
templateUrl
:
'components/crud/templates/
list
.html'
,
controller
:
'CRUDListCtrl'
.
when
(
'/:wf/
do/:cmd
'
,
{
templateUrl
:
'components/crud/templates/
crud
.html'
,
controller
:
'CRUDList
Form
Ctrl'
})
.
when
(
'/:wf/add'
,
{
templateUrl
:
'components/crud/templates/add.html'
,
controller
:
'CRUDAddEditCtrl'
})
.
when
(
'/:wf/edit/:key'
,
{
templateUrl
:
'components/crud/templates/add.html'
,
controller
:
'CRUDAddEditCtrl'
})
.
when
(
'/:wf/detail/:key'
,
{
templateUrl
:
'components/crud/templates/show.html'
,
controller
:
'CRUDShowCtrl'
.
when
(
'/:wf/do/:cmd/:key'
,
{
templateUrl
:
'components/crud/templates/crud.html'
,
controller
:
'CRUDListFormCtrl'
})
.
when
(
'/:wf/:model'
,
{
templateUrl
:
'components/
wf/templates/ad
d.html'
,
templateUrl
:
'components/
crud/templates/cru
d.html'
,
controller
:
'CRUDCtrl'
})
.
when
(
'/:wf/:model/list'
,
{
templateUrl
:
'components/crud/templates/list.html'
,
controller
:
'CRUDListCtrl'
})
.
when
(
'/:wf/:model/add'
,
{
templateUrl
:
'components/crud/templates/add.html'
,
controller
:
'CRUDAddEditCtrl'
.
when
(
'/:wf/:model/do/:cmd'
,
{
templateUrl
:
'components/crud/templates/crud.html'
,
controller
:
'CRUDListFormCtrl'
})
.
when
(
'/:wf/:model/edit/:key'
,
{
templateUrl
:
'components/crud/templates/add.html'
,
controller
:
'CRUDAddEditCtrl'
})
.
when
(
'/:wf/:model/detail/:key'
,
{
templateUrl
:
'components/crud/templates/show.html'
,
controller
:
'CRUDShowCtrl'
.
when
(
'/:wf/:model/do/:cmd/:key'
,
{
templateUrl
:
'components/crud/templates/crud.html'
,
controller
:
'CRUDListFormCtrl'
})
.
otherwise
({
redirectTo
:
'/dashboard'
});
}])
.
run
(
function
(
$rootScope
)
{
...
...
app/components/crud/crud_controller.js
View file @
d1c4af40
...
...
@@ -17,6 +17,7 @@ crud.service('CrudUtility', function () {
generateParam
:
function
(
scope
,
routeParams
,
cmd
)
{
// define api request url path
scope
.
url
=
routeParams
.
wf
;
// why do this??
angular
.
forEach
(
routeParams
,
function
(
value
,
key
)
{
if
(
key
.
indexOf
(
'_id'
)
>
-
1
&&
key
!==
'param_id'
)
{
scope
.
param
=
key
;
...
...
@@ -31,6 +32,10 @@ crud.service('CrudUtility', function () {
wf
:
routeParams
.
wf
,
object_id
:
routeParams
.
key
};
scope
.
model
=
scope
.
form_params
.
model
;
scope
.
wf
=
scope
.
form_params
.
wf
;
scope
.
param
=
scope
.
form_params
.
param
;
scope
.
param_id
=
scope
.
form_params
.
id
;
return
scope
;
},
listPageItems
:
function
(
scope
,
pageData
)
{
...
...
@@ -51,80 +56,110 @@ crud.controller('CRUDCtrl', function ($scope, $routeParams, Generator, CrudUtili
});
/**
* CRUDAddEditCtrl is a controller
* which provide a form with form generator.
*
*/
crud
.
controller
(
'CRUDListFormCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$modal
,
$timeout
,
Generator
,
$routeParams
,
CrudUtility
)
{
if
(
$routeParams
.
cmd
===
'show'
)
{
CrudUtility
.
generateParam
(
$scope
,
$routeParams
,
$routeParams
.
cmd
);
// todo: refactor createListObjects func
var
createListObjects
=
function
()
{
angular
.
forEach
(
$scope
.
object
,
function
(
value
,
key
)
{
if
(
typeof
value
==
'object'
)
{
$scope
.
listobjects
[
key
]
=
value
;
delete
$scope
.
object
[
key
];
}
});
};
crud
.
controller
(
'CRUDAddEditCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$modal
,
$timeout
,
Generator
,
$routeParams
,
CrudUtility
)
{
// get form with generator
if
(
$routeParams
.
pageData
)
{
CrudUtility
.
generateParam
(
$scope
,
Generator
.
getPageData
(),
'form'
);
Generator
.
generate
(
$scope
,
Generator
.
getPageData
());
}
else
{
CrudUtility
.
generateParam
(
$scope
,
$routeParams
,
'form'
);
Generator
.
get_form
(
$scope
);
}
$scope
.
listobjects
=
{};
$scope
.
onSubmit
=
function
(
form
)
{
$scope
.
$broadcast
(
'schemaFormValidate'
);
if
(
form
.
$valid
)
{
Generator
.
s
ubmit
(
$scope
);
var
pageData
=
Generator
.
getPageData
();
if
(
pageData
.
pageData
===
true
)
{
$scope
.
object
=
pageData
.
object
;
Generator
.
s
etPageData
({
pageData
:
false
}
);
}
};
else
{
// call generator's get_single_item func
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
)
{
$scope
.
object
=
res
.
data
.
object
;
$scope
.
model
=
$routeParams
.
model
;
});
}
createListObjects
();
}
});
if
(
$routeParams
.
cmd
===
'form'
||
$routeParams
.
cmd
===
'list'
)
{
// function to set scope objects
var
setpageobjects
=
function
(
data
)
{
CrudUtility
.
listPageItems
(
$scope
,
data
);
Generator
.
generate
(
$scope
,
data
);
Generator
.
setPageData
({
pageData
:
false
});
};
/**
* CRUD List Controller
*/
// get pageData from service
var
pageData
=
Generator
.
getPageData
();
crud
.
controller
(
'CRUDListCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
,
CrudUtility
)
{
CrudUtility
.
generateParam
(
$scope
,
$routeParams
,
'list'
);
// if pageData exists do not call get_wf function and manipulate page with pageData
if
(
pageData
.
pageData
===
true
)
{
$log
.
debug
(
'pagedata'
,
pageData
.
pageData
);
CrudUtility
.
generateParam
(
$scope
,
pageData
,
$routeParams
.
cmd
);
setpageobjects
(
pageData
,
pageData
);
}
// if pageData didn't defined or is {pageData: false} go get data from api with get_wf function
if
(
pageData
.
pageData
===
undefined
||
pageData
.
pageData
===
false
)
{
CrudUtility
.
generateParam
(
$scope
,
$routeParams
,
$routeParams
.
cmd
);
Generator
.
get_wf
(
$scope
);
}
if
(
$routeParams
.
pageData
)
{
var
pageData
=
Generator
.
getPageData
();
CrudUtility
.
listPageItems
(
$scope
,
pageData
);
}
else
{
// call generator's get_list func
Generator
.
get_list
(
$scope
)
.
then
(
function
(
res
)
{
CrudUtility
.
listPageItems
(
$scope
,
res
.
Data
);
});
}
// we use form generator for generic forms. this makes form's scope to confuse on the path to generate form
// object by its name. to manage to locate the form to controllers scope we use a directive called form locator
// a bit dirty way to find form working on but solves our problem
$scope
.
$on
(
'formLocator'
,
function
(
event
)
{
$scope
.
formgenerated
=
event
.
targetScope
.
formgenerated
;
});
$scope
.
do_action
=
function
(
key
,
action
)
{
Generator
.
doItemAction
(
$scope
,
key
,
action
);
$scope
.
onSubmit
=
function
(
form
)
{
$scope
.
$broadcast
(
'schemaFormValidate'
);
if
(
form
.
$valid
)
{
Generator
.
submit
(
$scope
);
}
};
$scope
.
do_action
=
function
(
key
,
action
)
{
Generator
.
doItemAction
(
$scope
,
key
,
action
);
};
}
});
/**
* CRUD Show Controller
*/
crud
.
controller
(
'CRUDShowCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
Generator
,
$routeParams
,
CrudUtility
)
{
CrudUtility
.
generateParam
(
$scope
,
$routeParams
,
'show'
);
// todo: refactor createListObjects func
var
createListObjects
=
function
()
{
angular
.
forEach
(
$scope
.
object
,
function
(
value
,
key
)
{
if
(
typeof
value
==
'object'
)
{
$scope
.
listobjects
[
key
]
=
value
;
delete
$scope
.
object
[
key
];
}
});
crud
.
directive
(
'crudListDirective'
,
function
()
{
return
{
templateUrl
:
'components/crud/templates/list.html'
,
restrict
:
'E'
,
replace
:
true
};
});
crud
.
directive
(
'crudFormDirective'
,
function
(
)
{
return
{
templateUrl
:
'components/crud/templates/form.html'
,
restrict
:
'E'
,
replace
:
true
};
});
$scope
.
listobjects
=
{};
crud
.
directive
(
'crudShowDirective'
,
function
()
{
return
{
templateUrl
:
'components/crud/templates/show.html'
,
restrict
:
'E'
,
replace
:
true
};
});
if
(
$routeParams
.
pageData
)
{
var
pageData
=
Generator
.
getPageData
();
$scope
.
object
=
pageData
.
object
;
}
else
{
// call generator's get_single_item func
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
)
{
$scope
.
object
=
res
.
data
.
object
;
$scope
.
model
=
$routeParams
.
model
;
});
crud
.
directive
(
'formLocator'
,
function
()
{
return
{
link
:
function
(
scope
)
{
scope
.
$emit
(
'formLocator'
);
}
}
createListObjects
();
});
\ No newline at end of file
app/components/crud/crud_controller_test.js
View file @
d1c4af40
...
...
@@ -18,43 +18,10 @@ describe('crud controller module', function () {
$controller
=
_$controller_
;
}));
describe
(
'crud add controller'
,
function
()
{
it
(
'should get form'
,
function
()
{
var
$scope
=
{};
var
controller
=
$controller
(
'CRUDAddEditCtrl'
,
{
$scope
:
$scope
});
expect
(
$scope
).
not
.
toEqual
(
null
);
});
});
// todo: chack if needed for these tests
// describe('crud list controller', function() {
// it('should get list', function() {
// var $scope = {};
// var controller = $controller('CRUDListCtrl', { $scope: $scope });
// expect($scope).not.toEqual(null);
// });
// });
// describe('crud show controller', function() {
// it('should get single item', function() {
// var $scope = {};
// var controller = $controller('CRUDShowCtrl', { $scope: $scope });
// expect($scope).not.toEqual(null);
// });
// });
describe
(
'crud controller'
,
function
()
{
it
(
'should have CRUDAddEditCtrl'
,
inject
(
function
(
$controller
)
{
expect
(
$controller
).
toBeDefined
();
}));
it
(
'should have CRUDListCtrl'
,
inject
(
function
(
$controller
)
{
expect
(
$controller
).
toBeDefined
();
}));
it
(
'should have CRUDShowCtrl'
,
inject
(
function
(
$controller
)
{
it
(
'should have CRUDListFormCtrl'
,
inject
(
function
(
$controller
)
{
expect
(
$controller
).
toBeDefined
();
}));
});
...
...
app/components/crud/templates/crud.html
0 → 100644
View file @
d1c4af40
<crud-show-directive
ng-if=
"object"
></crud-show-directive>
<crud-form-directive
ng-if=
"forms"
></crud-form-directive>
<hr>
<crud-list-directive
ng-if=
"objects"
></crud-list-directive>
\ No newline at end of file
app/components/crud/templates/edit.html
deleted
100644 → 0
View file @
06f9ed64
<div
class=
"container"
ng-app=
"ulakbus.crud"
>
<div
class=
"col-md-6"
>
<h1>
{{ schema.title }}
</h1>
<form
name=
"formgenerated"
sf-schema=
"schema"
sf-form=
"form"
sf-model=
"model"
ng-submit=
"onSubmit(formgenerated)"
></form>
</div>
</div>
\ No newline at end of file
app/components/crud/templates/
add
.html
→
app/components/crud/templates/
form
.html
View file @
d1c4af40
...
...
@@ -2,7 +2,7 @@
<h1>
{{ schema.title }}
</h1>
<form
id=
"formgenerated"
name=
"formgenerated"
sf-schema=
"schema"
sf-form=
"form"
sf-model=
"model"
ng-submit=
"onSubmit(formgenerated)"
></form>
ng-submit=
"onSubmit(formgenerated)"
form-locator
></form>
<div
ng-repeat=
"node in Node"
>
<h3>
{{ node.title }}
...
...
app/components/crud/templates/list.html
View file @
d1c4af40
<div
class=
"starter-template container"
>
<
h1>
{{model}}
<
a
href=
"{{addLink}}"
>
<
button
type=
"button"
class=
"btn btn-primary"
>
Ekle
</button
>
<
/a
>
<
/h1
>
<
!--<h1>{{model}}-->
<
!--<a href="{{addLink}}">--
>
<
!--<button type="button" class="btn btn-primary">Ekle</button>--
>
<
!--</a>--
>
<
!--</h1>--
>
<div
class=
"row"
ng-if=
"!objects[1]"
>
<div
class=
"col-md-12"
>
<p
class=
"no-content"
>
Listelenecek içerik yok.
</p>
...
...
@@ -19,8 +19,8 @@
Hepsini Seç
</label>
</td>
<td
ng-repeat=
"value in objects[0]"
ng-if=
"objects[0]!='-1'"
>
{{
value
}}
</td>
<td
ng-if=
"objects[0]=='-1'"
>
{{
model || wf
}}
</td>
<td
ng-repeat=
"value in objects[0]"
ng-if=
"objects[0]!='-1'"
>
{{
objects
}}
</td>
<td
ng-if=
"objects[0]=='-1'"
>
{{
schema.title||model
}}
</td>
<td>
action
</td>
</tr>
</thead>
...
...
@@ -34,11 +34,14 @@
<td
scope=
"row"
style=
"text-align:center"
>
{{$index}}
</td>
<!-- below 2 of object will not be listed there for ng repeat loops 2 less -->
<td
ng-repeat=
"field in object.fields track by $index"
ng-if=
"objects[0]=='-1'"
>
<a
ng-href=
"{{object.detailLink}}"
>
{{field}}
</a>
<a
ng-repeat=
"action in object.actions"
ng-href=
"javascript:void(0)"
ng-if=
"action.show_as==='link'&&action.fields.indexOf($parent.$index)>-1"
ng-click=
"do_action(object.key, action)"
>
{{field}}
</a>
</td>
<td
ng-repeat=
"field in object.fields track by $index"
ng-if=
"objects[0]!='-1'"
>
<a
ng-href=
"{{object.detailLink}}"
ng-if=
"$index==1"
>
{{field}}
</a>
<a
ng-repeat=
"action in object.actions"
ng-href=
"javascript:void(0)"
ng-if=
"action.show_as==='link'&&action.fields.indexOf($index)>-1"
ng-click=
"do_action(object.key, action)"
>
{{field}}
</a>
<span
ng-if=
"$index!=1"
>
{{field}}
</span>
</td>
<td>
...
...
@@ -46,8 +49,8 @@
ng-if=
"action.show_as==='button'"
ng-click=
"do_action(object.key, action)"
>
{{action
.name}}
</button>
<
a
ng-href=
"javascript:void(0)"
ng-repeat=
"action in object.actions"
ng-if=
"action.show_as==='link'"
ng-click=
"do_action(object.key, action)"
>
{{action.name}}
</a
>
<
!--<a ng-href="javascript:void(0)" ng-repeat="action in object.actions"-->
<!--ng-if="action.show_as==='link'" ng-click="do_action(object.key, action)">{{action.name}}</a>--
>
<br>
</td>
</tr>
...
...
app/components/wf/templates/add.html
deleted
100644 → 0
View file @
06f9ed64
<div
class=
"container"
>
<h1>
{{ schema.title }}
</h1>
<form
id=
"formgenerated"
name=
"formgenerated"
sf-schema=
"schema"
sf-form=
"form"
sf-model=
"model"
ng-submit=
"onSubmit(formgenerated)"
></form>
<div
ng-repeat=
"node in Node"
>
<h3>
{{ node.title }}
<span
ng-if=
"node.lengthModels < 1"
>
<a
href=
"javascript:void(0);"
modal-for-nodes=
"{{node.schema.model_name}},Node"
>
<i
class=
"fa fa-plus-circle fa-fw"
></i>
</a>
</span>
</h3>
<div
class=
"node-table"
>
<ng-include
src=
"'shared/templates/nodeTable.html'"
></ng-include>
</div>
<hr>
</div>
<div
ng-repeat=
"node in ListNode"
>
<h3>
{{ node.title }}
<span>
<a
href=
"javascript:void(0);"
modal-for-nodes=
"{{node.schema.model_name}},ListNode,add"
>
<i
class=
"fa fa-plus-circle fa-fw"
></i>
</a>
</span>
</h3>
<div
class=
"list-node-table"
>
<ng-include
src=
"'shared/templates/nodeTable.html'"
></ng-include>
</div>
<hr>
</div>
</div>
\ No newline at end of file
app/components/wf/templates/edit.html
deleted
100644 → 0
View file @
06f9ed64
<div
class=
"container"
ng-app=
"ulakbus.crud"
>
<div
class=
"col-md-6"
>
<h1>
{{ schema.title }}
</h1>
<form
name=
"formgenerated"
sf-schema=
"schema"
sf-form=
"form"
sf-model=
"model"
ng-submit=
"onSubmit(formgenerated)"
></form>
</div>
</div>
\ No newline at end of file
app/components/wf/templates/list.html
deleted
100644 → 0
View file @
06f9ed64
<div
class=
"starter-template container"
>
<h1>
{{model}}
<a
href=
"#/crud/{{model}}/add"
><button
type=
"button"
class=
"btn btn-primary"
>
Ekle
</button></a></h1>
<div
class=
"row"
ng-if=
"!nobjects[1]"
>
<div
class=
"col-md-12"
>
<p
class=
"no-content"
>
Listelenecek içerik yok.
</p>
</div>
</div>
<div
class=
"tablescroll"
ng-if=
"nobjects[1]"
>
<table
class=
"table table-bordered"
style=
"background-color:#fff;"
>
<thead>
<tr>
<th
colspan=
"2"
>
<label>
<input
type=
"checkbox"
style=
"zoom:1.5; margin:5px 0 0 8px;"
>
Hepsini Seç
</label>
</th>
<th
ng-repeat=
"value in nobjects[0]"
ng-if=
"nobjects[0]!='-1'"
>
{{ value }}
</th>
<th
ng-if=
"nobjects[0]=='-1'"
>
{{ model }}
</th>
<th>
action
</th>
</tr>
</thead>
<tbody>
<tr
ng-repeat=
"object in nobjects"
ng-if=
"$index>0"
>
<td
width=
"60"
>
<label>
<input
type=
"checkbox"
style=
"zoom:1.5; margin:5px 0 0 8px;"
>
</label>
</td>
<th
scope=
"row"
style=
"text-align:center"
>
{{$index}}
</th>
<td
ng-repeat=
"k in object track by $index"
ng-if=
"nobjects[0]=='-1' && $index>0"
>
<a
ng-href=
"#/crud/{{model}}/{{object[0]}}"
>
{{object[1]}}
</a>
</td>
<td
ng-repeat=
"(key,value) in object track by $index"
ng-if=
"nobjects[0]!='-1' && $index>0"
>
<a
ng-href=
"#/crud/{{model}}/{{object[0]}}"
ng-if=
"$index==1"
>
{{object[key]}}
</a>
<span
ng-if=
"$index!=1"
>
{{object[key]}}
</span>
</td>
<td>
<a
ng-href=
"#/crud/{{model}}/edit/{{object[0]}}"
>
Edit
</a><br>
</td>
</tr>
</tbody>
</table>
</div>
<br/>
<hr/>
<div
class=
"btn-group"
ng-if=
"nobjects[1]"
>
<button
type=
"button"
class=
"btn btn-default dropdown-toggle"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
İşlemler
<span
class=
"caret"
></span>
</button>
<ul
class=
"dropdown-menu"
>
<li><a
href=
""
>
İşlem 1
</a></li>
<li><a
href=
""
>
İşlem 2
</a></li>
<li><a
href=
""
>
İşlem 3
</a></li>
<li
role=
"separator"
class=
"divider"
></li>
<li><a
href=
""
>
İşlem 4
</a></li>
</ul>
</div>
<hr>
</div>
\ No newline at end of file
app/components/wf/templates/show.html
deleted
100644 → 0
View file @
06f9ed64
<div
class=
"starter-template container"
>
<div
class=
"personnel-info-container"
>
<div
class=
"personnel-info-left"
>
<!--<div class="generic-profile-picture">-->
<!--<img src="../../img/sample-profile-pic.jpg" />-->
<!--</div>-->
<div
class=
"info-block"
>
<div
class=
"info-block-header"
>
<h1>
{{model}}
</h1>
</div>
<!-- end of info-block-header -->
<div
class=
"info-block-body"
ng-repeat=
"(key, value) in object"
>
<dl
class=
"dl-horizontal"
>
<dt>
{{ key }}
</dt>
<dd>
{{value}}
</dd>
</dl>
</div>
<!-- end of info-block-body -->
</div>
<!--<ul>-->
<!--<li ng-repeat="(key, value) in object"><span class="col-md-3">{{ key }}:</span>{{value}}</li>-->
<!--<li>Pozisyon</li>-->
<!--<li><i class="fa fa-phone"></i> (+90) 123 456 7890</li>-->
<!--<li><i class="fa fa-envelope"></i> samplemail@mail.com</li>-->
<!--<li><i class="fa fa-map-marker"></i> Gülbahçe Mah. İzmir Teknoloji Geliştirme Bölgesi A9 Blok 215/A IYTE Campus, URLA/IZMIR</li></li>-->
<!--</ul>-->
</div>
<!-- end of personnel-info-left -->
<div
class=
"personnel-info-right"
>
<div
class=
"info-block"
ng-repeat=
"(key, value) in listobjects"
>
<div
class=
"info-block-header"
>
<h2>
{{key}}
</h2>
</div>
<!-- end of info-block-header -->
<div
class=
"info-block-body"
ng-repeat=
"(k, v) in value"
>
<dl
class=
"dl-horizontal"
>
<dt>
{{k}}
</dt>
<dd>
{{v}}
</dd>
</dl>
</div>
<!-- end of info-block-body -->
</div>
<!-- end of info block -->
<!-- end of info block -->
</div>
<!-- personnel-info-left -->
</div>
<!-- end of personnel-info-container -->
</div>
\ No newline at end of file
app/components/wf/wf_controller.js
deleted
100644 → 0
View file @
06f9ed64
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
'use strict'
;
var
wf
=
angular
.
module
(
'ulakbus.wf'
,
[
'ui.bootstrap'
,
'schemaForm'
,
'formService'
]);
/**
* CRUDAddEditCtrl is a controller
* which provide a form with form generator.
*/
wf
.
controller
(
'WFAddEditCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$modal
,
$timeout
,
Generator
,
$routeParams
)
{
$scope
.
url
=
""
;
$scope
.
form_params
=
{
'model'
:
$routeParams
.
model
};
//if ($routeParams.id) {
// $scope.form_params['object_id'] = $routeParams.id;
// $scope.form_params['cmd'] = 'edit';
//}
//else {
// $scope.form_params['cmd'] = 'add';
//}
// get form with generator
if
(
$routeParams
.
model
)
{
Generator
.
get_form
(
$scope
);
}
$scope
.
onSubmit
=
function
(
form
)
{
$scope
.
$broadcast
(
'schemaFormValidate'
);
if
(
form
.
$valid
)
{
Generator
.
submit
(
$scope
)
.
success
(
function
(
data
){
})
.
error
(
function
(
data
){
//$scope.message = data.title;
});
}
};
});
/**
* WorkFlow List Controller
*/
wf
.
controller
(
'WFListCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
$scope
.
url
=
""
;
$scope
.
form_params
=
$routeParams
;
if
(
$routeParams
.
nobjects
){
$scope
.
nobjects
=
$routeParams
.
nobjects
;
$scope
.
model
=
$routeParams
.
model
;
}
else
{
// call generator's get_list func
Generator
.
get_list
(
$scope
)
.
then
(
function
(
res
)
{
$scope
.
nobjects
=
res
.
data
.
nobjects
;
$scope
.
model
=
$routeParams
.
model
;
});
}
});
/**
* WorkFlow Show Controller
*/
wf
.
controller
(
'WFShowCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
$scope
.
url
=
""
;
$scope
.
form_params
=
{
"object_id"
:
$routeParams
.
id
,
"cmd"
:
"show"
,
"model"
:
$routeParams
.
model
};
// call generator's get_single_itemfunc
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
)
{
$scope
.
listobjects
=
{};
$scope
.
object
=
res
.
data
.
object
;
angular
.
forEach
(
$scope
.
object
,
function
(
value
,
key
)
{
if
(
typeof
value
==
'object'
){
$scope
.
listobjects
[
key
]
=
value
;
delete
$scope
.
object
[
key
];
}
});
$scope
.
model
=
$routeParams
.
model
;
})
});
\ No newline at end of file
app/components/wf/wf_controller_test.js
deleted
100644 → 0
View file @
06f9ed64
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
'use strict'
;
describe
(
'crud controller module'
,
function
()
{
beforeEach
(
module
(
'ulakbus'
));
beforeEach
(
module
(
'ulakbus.crud'
));
var
$controller
;
beforeEach
(
inject
(
function
(
_$controller_
)
{
$controller
=
_$controller_
;
}));
describe
(
'crud add controller'
,
function
()
{
it
(
'should get form'
,
function
()
{
var
$scope
=
{};
var
controller
=
$controller
(
'CRUDAddEditCtrl'
,
{
$scope
:
$scope
});
expect
(
$scope
).
not
.
toEqual
(
null
);
});
});
// todo: chack if needed for these tests
// describe('crud list controller', function() {
// it('should get list', function() {
// var $scope = {};
// var controller = $controller('CRUDListCtrl', { $scope: $scope });
// expect($scope).not.toEqual(null);
// });
// });
// describe('crud show controller', function() {
// it('should get single item', function() {
// var $scope = {};
// var controller = $controller('CRUDShowCtrl', { $scope: $scope });
// expect($scope).not.toEqual(null);
// });
// });
describe
(
'crud controller'
,
function
()
{
it
(
'should have CRUDAddEditCtrl'
,
inject
(
function
(
$controller
)
{
expect
(
$controller
).
toBeDefined
();
}));
it
(
'should have CRUDListCtrl'
,
inject
(
function
(
$controller
)
{
expect
(
$controller
).
toBeDefined
();
}));
it
(
'should have CRUDShowCtrl'
,
inject
(
function
(
$controller
)
{
expect
(
$controller
).
toBeDefined
();
}));
});
});
\ No newline at end of file
app/main.js
View file @
d1c4af40
...
...
@@ -22,7 +22,6 @@ var app = angular.module(
'ulakbus.crud'
,
'ulakbus.debug'
,
'ulakbus.devSettings'
,
'ulakbus.wf'
,
'ulakbus.version'
,
//'schemaForm',
'gettext'
,
...
...
app/zetalib/forms/form_service.js
View file @
d1c4af40
This diff is collapsed.
Click to expand it.
app/zetalib/forms/form_service_test.js
View file @
d1c4af40
...
...
@@ -22,7 +22,7 @@ describe('form service module', function () {
function
(
Generator
)
{
expect
(
Generator
.
group
).
not
.
toBe
(
null
);
var
generated_url
=
Generator
.
makeUrl
({
url
:
'test'
,
form_params
:
{}});
expect
(
generated_url
).
toEqual
(
"
http://
api.ulakbus.net/test/"
);
expect
(
generated_url
).
toEqual
(
"
//nightly.
api.ulakbus.net/test/"
);
}])
);
...
...
@@ -197,32 +197,6 @@ describe('form service module', function () {
})
);
it
(
'should get single item'
,
inject
(
function
(
Generator
,
$httpBackend
,
RESTURL
)
{
$httpBackend
.
expectPOST
(
RESTURL
.
url
+
'test/personel?personel_id=123'
)
.
respond
(
200
,
{
items
:
{
"client_cmd"
:
"show_object"
,
"object"
:
{
"ad"
:
"name"
,
"soyad"
:
"lastname"
,
},
"token"
:
"da73993f439549e7855fd82deafbbc99"
,
"is_login"
:
true
}
});
var
cred
=
{
cmd
:
'show'
,
model
:
'personel'
,
param
:
'personel_id'
,
id
:
'123'
};
Generator
.
get_single_item
({
url
:
'test'
,
form_params
:
cred
})
.
then
(
function
(
data
)
{
expect
(
data
.
data
.
items
.
token
).
toEqual
(
"da73993f439549e7855fd82deafbbc99"
);
});
$httpBackend
.
flush
();
})
);
it
(
'should submit form'
,
inject
(
function
(
Generator
,
$httpBackend
,
RESTURL
)
{
...
...
@@ -333,9 +307,8 @@ describe('form service module', function () {
"token"
:
"da73993f439549e7855fd82deafbbc99"
,
"is_login"
:
true
});
console
.
log
(
32131
);
scope
.
url
=
'test'
;
//
scope.url = 'test';
scope
.
form_params
=
{
param
:
'test'
,
id
:
'xyz123'
,
...
...
@@ -361,35 +334,6 @@ describe('form service module', function () {
ctrl
=
$controller
(
"CRUDCtrl"
,
{
$scope
:
scope
});
}));
it
(
'should generate itemlinks of objects in response data'
,
inject
(
function
(
Generator
)
{
var
responseObject
=
{
"objects"
:
[
"-1"
,
{
"fields"
:
[
"test object"
],
"actions"
:
[{
"cmd"
:
"delete"
,
"name"
:
"Sil"
},
{
"wf"
:
"manage_permissions"
,
"name"
:
"Yetkilendir"
,
"mode"
:
"modal"
}],
"do_list"
:
true
,
"key"
:
"xx10"
},
{
"fields"
:
[
"test object 2"
],
"actions"
:
[{
"cmd"
:
"delete"
,
"name"
:
"Sil"
},
{
"wf"
:
"manage_permissions"
,
"name"
:
"Yetkilendir"
,
"mode"
:
"modal"
}],
"do_list"
:
true
,
"key"
:
"xx11"
}
]
};
scope
.
url
=
'test'
;
scope
.
form_params
=
{
param
:
'test'
,
id
:
'xyz123'
,
model
:
'testModel'
,
object_id
:
'xxx11'
,
wf
:
'testModel'
};
Generator
.
itemLinksGenerator
(
scope
,
responseObject
);
expect
(
responseObject
.
objects
[
1
].
detailLink
).
toEqual
(
'#test/testModel/detail/xx10?test=xyz123'
);
})
);
});
var
$controller
;
...
...
app/zetalib/interceptors.js
View file @
d1c4af40
...
...
@@ -13,7 +13,6 @@ app.config(['$httpProvider', function ($httpProvider) {
$httpProvider
.
interceptors
.
push
(
function
(
$q
,
$rootScope
,
$location
,
$timeout
)
{
return
{
'request'
:
function
(
config
)
{
// todo: delete console logs
if
(
config
.
method
===
"POST"
)
{
// to prevent OPTIONS preflight request
config
.
headers
[
"Content-Type"
]
=
"text/plain"
;
...
...
@@ -100,7 +99,6 @@ app.config(['$httpProvider', function ($httpProvider) {
}
}
if
(
rejection
.
status
===
403
)
{
console
.
log
(
403
);
if
(
rejection
.
data
.
is_login
===
true
)
{
$rootScope
.
loggedInUser
=
true
;
if
(
$location
.
path
()
===
"/login"
)
{
...
...
@@ -112,15 +110,10 @@ app.config(['$httpProvider', function ($httpProvider) {
$rootScope
.
$broadcast
(
'show_notifications'
,
rejection
.
data
);
if
(
rejection
.
status
===
404
)
{
console
.
log
(
404
);
errorModal
();
//$location.path("/error/404");
}
// server 500 error returns with -1 on status.
//if (rejection.status === -1 && rejection.config.data.model) {
if
(
rejection
.
status
===
500
)
{
errorModal
();
//$location.path("/error/500");
}
return
$q
.
reject
(
rejection
);
}
...
...
dist/app.js
View file @
d1c4af40
This diff is collapsed.
Click to expand it.
dist/bower_components/components.js
View file @
d1c4af40
This diff is collapsed.
Click to expand it.
dist/templates.js
View file @
d1c4af40
This diff is collapsed.
Click to expand it.
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