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
06f9ed64
Commit
06f9ed64
authored
Nov 18, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Feature/issue47'
parents
6a8e69c5
67df9c6d
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
16 deletions
+36
-16
crud_controller.js
app/components/crud/crud_controller.js
+11
-7
list.html
app/components/crud/templates/list.html
+4
-2
form_service.js
app/zetalib/forms/form_service.js
+14
-2
interceptors.js
app/zetalib/interceptors.js
+2
-2
app.js
dist/app.js
+1
-1
templates.js
dist/templates.js
+4
-2
No files found.
app/components/crud/crud_controller.js
View file @
06f9ed64
...
@@ -18,7 +18,7 @@ crud.service('CrudUtility', function () {
...
@@ -18,7 +18,7 @@ crud.service('CrudUtility', function () {
// define api request url path
// define api request url path
scope
.
url
=
routeParams
.
wf
;
scope
.
url
=
routeParams
.
wf
;
angular
.
forEach
(
routeParams
,
function
(
value
,
key
)
{
angular
.
forEach
(
routeParams
,
function
(
value
,
key
)
{
if
(
key
.
indexOf
(
'_id'
)
>
-
1
)
{
if
(
key
.
indexOf
(
'_id'
)
>
-
1
&&
key
!==
'param_id'
)
{
scope
.
param
=
key
;
scope
.
param
=
key
;
scope
.
param_id
=
value
;
scope
.
param_id
=
value
;
}
}
...
@@ -26,16 +26,16 @@ crud.service('CrudUtility', function () {
...
@@ -26,16 +26,16 @@ crud.service('CrudUtility', function () {
scope
.
form_params
=
{
scope
.
form_params
=
{
cmd
:
cmd
,
cmd
:
cmd
,
model
:
routeParams
.
model
,
model
:
routeParams
.
model
,
param
:
scope
.
param
,
param
:
scope
.
param
||
routeParams
.
param
,
id
:
scope
.
param_id
,
id
:
scope
.
param_id
||
routeParams
.
param_id
,
wf
:
routeParams
.
wf
,
wf
:
routeParams
.
wf
,
object_id
:
routeParams
.
key
object_id
:
routeParams
.
key
};
};
return
scope
;
return
scope
;
},
},
listPageItems
:
function
(
scope
,
pageData
)
{
listPageItems
:
function
(
scope
,
pageData
)
{
angular
.
forEach
(
[
'objects'
,
'model'
,
'addLink'
]
,
function
(
value
,
key
)
{
angular
.
forEach
(
pageData
,
function
(
value
,
key
)
{
scope
[
value
]
=
pageData
[
value
]
;
scope
[
key
]
=
value
;
});
});
}
}
}
}
...
@@ -56,12 +56,12 @@ crud.controller('CRUDCtrl', function ($scope, $routeParams, Generator, CrudUtili
...
@@ -56,12 +56,12 @@ crud.controller('CRUDCtrl', function ($scope, $routeParams, Generator, CrudUtili
*/
*/
crud
.
controller
(
'CRUDAddEditCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$modal
,
$timeout
,
Generator
,
$routeParams
,
CrudUtility
)
{
crud
.
controller
(
'CRUDAddEditCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$modal
,
$timeout
,
Generator
,
$routeParams
,
CrudUtility
)
{
CrudUtility
.
generateParam
(
$scope
,
$routeParams
,
'form'
);
// get form with generator
// get form with generator
if
(
$routeParams
.
pageData
)
{
if
(
$routeParams
.
pageData
)
{
CrudUtility
.
generateParam
(
$scope
,
Generator
.
getPageData
(),
'form'
);
Generator
.
generate
(
$scope
,
Generator
.
getPageData
());
Generator
.
generate
(
$scope
,
Generator
.
getPageData
());
}
else
{
}
else
{
CrudUtility
.
generateParam
(
$scope
,
$routeParams
,
'form'
);
Generator
.
get_form
(
$scope
);
Generator
.
get_form
(
$scope
);
}
}
...
@@ -92,6 +92,10 @@ crud.controller('CRUDListCtrl', function ($scope, $rootScope, Generator, $routeP
...
@@ -92,6 +92,10 @@ crud.controller('CRUDListCtrl', function ($scope, $rootScope, Generator, $routeP
CrudUtility
.
listPageItems
(
$scope
,
res
.
Data
);
CrudUtility
.
listPageItems
(
$scope
,
res
.
Data
);
});
});
}
}
$scope
.
do_action
=
function
(
key
,
action
)
{
Generator
.
doItemAction
(
$scope
,
key
,
action
);
}
});
});
/**
/**
...
...
app/components/crud/templates/list.html
View file @
06f9ed64
...
@@ -43,9 +43,11 @@
...
@@ -43,9 +43,11 @@
</td>
</td>
<td>
<td>
<button
class=
"btn btn-primary"
style=
"margin-right: 5px;"
ng-repeat=
"action in object.actions"
<button
class=
"btn btn-primary"
style=
"margin-right: 5px;"
ng-repeat=
"action in object.actions"
ng-if=
"action.show_as==='button'"
ng-click=
"do_action(object)"
>
{{action.name}}
</button>
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"
<a
ng-href=
"javascript:void(0)"
ng-repeat=
"action in object.actions"
ng-if=
"action.show_as==='link'"
ng-click=
"do_action(object)"
>
{{action.name}}
</a>
ng-if=
"action.show_as==='link'"
ng-click=
"do_action(object
.key, action
)"
>
{{action.name}}
</a>
<br>
<br>
</td>
</td>
</tr>
</tr>
...
...
app/zetalib/forms/form_service.js
View file @
06f9ed64
...
@@ -89,6 +89,7 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, $c
...
@@ -89,6 +89,7 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, $c
// generically change _id fields model value
// generically change _id fields model value
if
(
'form_params'
in
scope
)
{
if
(
'form_params'
in
scope
)
{
debugger
;
if
(
k
==
scope
.
form_params
.
param
)
{
if
(
k
==
scope
.
form_params
.
param
)
{
scope
.
model
[
k
]
=
scope
.
form_params
.
id
;
scope
.
model
[
k
]
=
scope
.
form_params
.
id
;
scope
.
form
.
splice
(
scope
.
form
.
indexOf
(
k
),
1
);
scope
.
form
.
splice
(
scope
.
form
.
indexOf
(
k
),
1
);
...
@@ -276,8 +277,12 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, $c
...
@@ -276,8 +277,12 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, $c
return
newdatearray
.
join
(
'.'
);
return
newdatearray
.
join
(
'.'
);
}
}
};
};
generator
.
doItemAction
=
function
(
object
)
{
generator
.
doItemAction
=
function
(
$scope
,
key
,
action
)
{
debugger
;
$scope
.
form_params
.
cmd
=
action
.
cmd
;
$scope
.
form_params
.
object_id
=
key
;
$scope
.
form_params
.
param
=
$scope
.
param
;
$scope
.
form_params
.
id
=
$scope
.
param_id
;
generator
.
get_wf
(
$scope
);
};
};
/**
/**
* itemLinksGenerator function used for generic links for list items
* itemLinksGenerator function used for generic links for list items
...
@@ -449,6 +454,11 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, $c
...
@@ -449,6 +454,11 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, $c
$location
.
path
(
pathUrl
).
search
(
angular
.
fromJson
({
pageData
:
true
}));
$location
.
path
(
pathUrl
).
search
(
angular
.
fromJson
({
pageData
:
true
}));
}
}
if
(
client_cmd
.
indexOf
(
'form'
)
>
-
1
&&
client_cmd
.
indexOf
(
'list'
)
<
0
)
{
if
(
client_cmd
.
indexOf
(
'form'
)
>
-
1
&&
client_cmd
.
indexOf
(
'list'
)
<
0
)
{
data
[
$scope
.
form_params
.
param
]
=
$scope
.
form_params
.
id
;
data
[
'model'
]
=
$scope
.
form_params
.
model
;
data
[
'wf'
]
=
$scope
.
form_params
.
wf
;
data
[
'param'
]
=
$scope
.
form_params
.
param
;
data
[
'param_id'
]
=
$scope
.
form_params
.
id
;
generator
.
setPageData
(
data
);
generator
.
setPageData
(
data
);
redirectTo
(
$scope
,
'add'
);
redirectTo
(
$scope
,
'add'
);
}
}
...
@@ -457,6 +467,8 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, $c
...
@@ -457,6 +467,8 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, $c
data
[
$scope
.
form_params
.
param
]
=
$scope
.
form_params
.
id
;
data
[
$scope
.
form_params
.
param
]
=
$scope
.
form_params
.
id
;
data
[
'model'
]
=
$scope
.
form_params
.
model
;
data
[
'model'
]
=
$scope
.
form_params
.
model
;
data
[
'wf'
]
=
$scope
.
form_params
.
wf
;
data
[
'wf'
]
=
$scope
.
form_params
.
wf
;
data
[
'param'
]
=
$scope
.
form_params
.
param
;
data
[
'param_id'
]
=
$scope
.
form_params
.
id
;
generator
.
setPageData
(
data
);
generator
.
setPageData
(
data
);
generator
.
itemLinksGenerator
(
$scope
,
data
);
generator
.
itemLinksGenerator
(
$scope
,
data
);
...
...
app/zetalib/interceptors.js
View file @
06f9ed64
...
@@ -114,13 +114,13 @@ app.config(['$httpProvider', function ($httpProvider) {
...
@@ -114,13 +114,13 @@ app.config(['$httpProvider', function ($httpProvider) {
if
(
rejection
.
status
===
404
)
{
if
(
rejection
.
status
===
404
)
{
console
.
log
(
404
);
console
.
log
(
404
);
errorModal
();
errorModal
();
$location
.
path
(
"/error/404"
);
//
$location.path("/error/404");
}
}
// server 500 error returns with -1 on status.
// server 500 error returns with -1 on status.
//if (rejection.status === -1 && rejection.config.data.model) {
//if (rejection.status === -1 && rejection.config.data.model) {
if
(
rejection
.
status
===
500
)
{
if
(
rejection
.
status
===
500
)
{
errorModal
();
errorModal
();
$location
.
path
(
"/error/500"
);
//
$location.path("/error/500");
}
}
return
$q
.
reject
(
rejection
);
return
$q
.
reject
(
rejection
);
}
}
...
...
dist/app.js
View file @
06f9ed64
This diff is collapsed.
Click to expand it.
dist/templates.js
View file @
06f9ed64
...
@@ -122,9 +122,11 @@ angular.module("components/crud/templates/list.html", []).run(["$templateCache",
...
@@ -122,9 +122,11 @@ angular.module("components/crud/templates/list.html", []).run(["$templateCache",
" </td>
\n
"
+
" </td>
\n
"
+
" <td>
\n
"
+
" <td>
\n
"
+
" <button class=
\"
btn btn-primary
\"
style=
\"
margin-right: 5px;
\"
ng-repeat=
\"
action in object.actions
\"\n
"
+
" <button class=
\"
btn btn-primary
\"
style=
\"
margin-right: 5px;
\"
ng-repeat=
\"
action in object.actions
\"\n
"
+
" ng-if=
\"
action.show_as==='button'
\"
ng-click=
\"
do_action(object)
\"
>{{action.name}}</button>
\n
"
+
" ng-if=
\"
action.show_as==='button'
\"
ng-click=
\"
do_action(object.key, action)
\"
>{{action
\n
"
+
" .name}}
\n
"
+
" </button>
\n
"
+
" <a ng-href=
\"
javascript:void(0)
\"
ng-repeat=
\"
action in object.actions
\"\n
"
+
" <a ng-href=
\"
javascript:void(0)
\"
ng-repeat=
\"
action in object.actions
\"\n
"
+
" ng-if=
\"
action.show_as==='link'
\"
ng-click=
\"
do_action(object)
\"
>{{action.name}}</a>
\n
"
+
" ng-if=
\"
action.show_as==='link'
\"
ng-click=
\"
do_action(object
.key, action
)
\"
>{{action.name}}</a>
\n
"
+
" <br>
\n
"
+
" <br>
\n
"
+
" </td>
\n
"
+
" </td>
\n
"
+
" </tr>
\n
"
+
" </tr>
\n
"
+
...
...
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