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
9b3991ac
Commit
9b3991ac
authored
Nov 18, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dynamic dispatch with function dispatchClientCmd
routes identical with client_cmd
parent
06f9ed64
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
41 additions
and
80 deletions
+41
-80
app_routes.js
app/app_routes.js
+16
-16
crud_controller.js
app/components/crud/crud_controller.js
+1
-1
edit.html
app/components/crud/templates/edit.html
+0
-6
form.html
app/components/crud/templates/form.html
+0
-0
form_service.js
app/zetalib/forms/form_service.js
+20
-36
interceptors.js
app/zetalib/interceptors.js
+0
-7
app.js
dist/app.js
+1
-1
templates.js
dist/templates.js
+3
-13
No files found.
app/app_routes.js
View file @
9b3991ac
...
...
@@ -22,42 +22,42 @@ 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/add
.html'
,
templateUrl
:
'components/
crud/templates/form
.html'
,
controller
:
'CRUDCtrl'
})
.
when
(
'/:wf/list'
,
{
templateUrl
:
'components/crud/templates/list.html'
,
controller
:
'CRUDListCtrl'
})
.
when
(
'/:wf/
add
'
,
{
templateUrl
:
'components/crud/templates/
add
.html'
,
controller
:
'CRUD
AddEdit
Ctrl'
.
when
(
'/:wf/
form
'
,
{
templateUrl
:
'components/crud/templates/
form
.html'
,
controller
:
'CRUD
Form
Ctrl'
})
.
when
(
'/:wf/
edit
/:key'
,
{
templateUrl
:
'components/crud/templates/
add
.html'
,
controller
:
'CRUD
AddEdit
Ctrl'
.
when
(
'/:wf/
form
/:key'
,
{
templateUrl
:
'components/crud/templates/
form
.html'
,
controller
:
'CRUD
Form
Ctrl'
})
.
when
(
'/:wf/
detail
/:key'
,
{
.
when
(
'/:wf/
show
/:key'
,
{
templateUrl
:
'components/crud/templates/show.html'
,
controller
:
'CRUDShowCtrl'
})
.
when
(
'/:wf/:model'
,
{
templateUrl
:
'components/
wf/templates/add
.html'
,
templateUrl
:
'components/
crud/templates/form
.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
:
'CRUD
AddEdit
Ctrl'
.
when
(
'/:wf/:model/
form
'
,
{
templateUrl
:
'components/crud/templates/
form
.html'
,
controller
:
'CRUD
Form
Ctrl'
})
.
when
(
'/:wf/:model/
edit
/:key'
,
{
templateUrl
:
'components/crud/templates/
add
.html'
,
controller
:
'CRUD
AddEdit
Ctrl'
.
when
(
'/:wf/:model/
form
/:key'
,
{
templateUrl
:
'components/crud/templates/
form
.html'
,
controller
:
'CRUD
Form
Ctrl'
})
.
when
(
'/:wf/:model/
detail
/:key'
,
{
.
when
(
'/:wf/:model/
show
/:key'
,
{
templateUrl
:
'components/crud/templates/show.html'
,
controller
:
'CRUDShowCtrl'
})
...
...
app/components/crud/crud_controller.js
View file @
9b3991ac
...
...
@@ -55,7 +55,7 @@ crud.controller('CRUDCtrl', function ($scope, $routeParams, Generator, CrudUtili
* which provide a form with form generator.
*/
crud
.
controller
(
'CRUD
AddEdit
Ctrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$modal
,
$timeout
,
Generator
,
$routeParams
,
CrudUtility
)
{
crud
.
controller
(
'CRUD
Form
Ctrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$modal
,
$timeout
,
Generator
,
$routeParams
,
CrudUtility
)
{
// get form with generator
if
(
$routeParams
.
pageData
)
{
CrudUtility
.
generateParam
(
$scope
,
Generator
.
getPageData
(),
'form'
);
...
...
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 @
9b3991ac
File moved
app/zetalib/forms/form_service.js
View file @
9b3991ac
...
...
@@ -206,12 +206,6 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, $c
// get model objects from db and add to select list
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
formitem
;
//scope.$broadcast('schemaFormRedraw');
// todo: make lines below work properly
//if (scope.model[v].indexOf("TMP_") > -1) {
// scope.model[v] = null;
//}
}
if
(
v
.
type
===
'ListNode'
||
v
.
type
===
'Node'
)
{
...
...
@@ -307,7 +301,7 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, $c
link
+=
"/"
+
page
;
if
(
page
===
'edit/'
||
page
===
'detail/'
)
{
if
(
value
.
key
)
{
link
+=
value
.
key
;
}
...
...
@@ -321,12 +315,12 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, $c
// call add link once
if
(
!
itemlist
.
addLink
)
{
itemlist
.
addLink
=
makelink
(
"
add
/"
);
itemlist
.
addLink
=
makelink
(
"
form
/"
);
}
if
(
value
!==
'-1'
)
{
value
.
detailLink
=
makelink
(
"
detail
/"
);
value
.
editLink
=
makelink
(
"
edit
/"
);
value
.
detailLink
=
makelink
(
"
show
/"
);
value
.
editLink
=
makelink
(
"
form
/"
);
}
});
};
...
...
@@ -453,41 +447,31 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, $c
}
$location
.
path
(
pathUrl
).
search
(
angular
.
fromJson
({
pageData
:
true
}));
}
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
);
redirectTo
(
$scope
,
'add'
);
}
if
(
client_cmd
.
indexOf
(
'list'
)
>
-
1
&&
client_cmd
.
indexOf
(
'form'
)
<
0
)
{
// client_cmd can be in ['list', 'form', 'show', 'reload', 'reset']
function
dispatchClientCmd
()
{
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
);
if
(
client_cmd
[
0
]
===
'list'
)
{
generator
.
itemLinksGenerator
(
$scope
,
data
);
redirectTo
(
$scope
,
'list'
);
}
if
(
client_cmd
.
indexOf
(
'form'
)
>
-
1
&&
client_cmd
.
indexOf
(
'list'
)
>
-
1
)
{
// todo: will be tested
generator
.
generate
(
$scope
,
data
);
generator
.
itemLinksGenerator
(
$scope
,
data
);
data
[
$scope
.
form_params
.
param
]
=
$scope
.
form_params
.
id
;
redirectTo
(
$scope
,
'formwithlist'
);
redirectTo
(
$scope
,
client_cmd
[
0
]);
}
dispatchClientCmd
();
if
(
client_cmd
.
indexOf
(
'show'
)
>
-
1
)
{
generator
.
setPageData
(
data
);
redirectTo
(
$scope
,
'detail'
);
}
//if (client_cmd.indexOf('form') > -1 && client_cmd.indexOf('list') > -1) {
// // todo: controller will be created and tested
// generator.generate($scope, data);
// generator.itemLinksGenerator($scope, data);
// data[$scope.form_params.param] = $scope.form_params.id;
// redirectTo($scope, 'formwithlist');
//}
};
/**
...
...
app/zetalib/interceptors.js
View file @
9b3991ac
...
...
@@ -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 @
9b3991ac
This diff is collapsed.
Click to expand it.
dist/templates.js
View file @
9b3991ac
angular
.
module
(
'templates-prod'
,
[
'components/auth/login.html'
,
'components/crud/templates/
add.html'
,
'components/crud/templates/edit
.html'
,
'components/crud/templates/list.html'
,
'components/crud/templates/show.html'
,
'components/dashboard/dashboard.html'
,
'components/debug/debug.html'
,
'components/devSettings/devSettings.html'
,
'components/error_pages/404.html'
,
'components/error_pages/500.html'
,
'components/uitemplates/404.html'
,
'components/uitemplates/500.html'
,
'components/wf/templates/add.html'
,
'components/wf/templates/edit.html'
,
'components/wf/templates/list.html'
,
'components/wf/templates/show.html'
,
'shared/templates/add.html'
,
'shared/templates/datefield.html'
,
'shared/templates/directives/chat.html'
,
'shared/templates/directives/header-breadcrumb.html'
,
'shared/templates/directives/header-notification.html'
,
'shared/templates/directives/header-sub-menu.html'
,
'shared/templates/directives/menuCollapse.html'
,
'shared/templates/directives/msgbox.html'
,
'shared/templates/directives/notifications.html'
,
'shared/templates/directives/selected-user.html'
,
'shared/templates/directives/sidebar-notification.html'
,
'shared/templates/directives/sidebar-search.html'
,
'shared/templates/directives/sidebar.html'
,
'shared/templates/directives/stats.html'
,
'shared/templates/directives/timeline.html'
,
'shared/templates/fieldset.html'
,
'shared/templates/foreignKey.html'
,
'shared/templates/linkedModelModalContent.html'
,
'shared/templates/listnodeModalContent.html'
,
'shared/templates/modalContent.html'
,
'shared/templates/nodeTable.html'
,
'shared/templates/select.html'
]);
angular
.
module
(
'templates-prod'
,
[
'components/auth/login.html'
,
'components/crud/templates/
form
.html'
,
'components/crud/templates/list.html'
,
'components/crud/templates/show.html'
,
'components/dashboard/dashboard.html'
,
'components/debug/debug.html'
,
'components/devSettings/devSettings.html'
,
'components/error_pages/404.html'
,
'components/error_pages/500.html'
,
'components/uitemplates/404.html'
,
'components/uitemplates/500.html'
,
'components/wf/templates/add.html'
,
'components/wf/templates/edit.html'
,
'components/wf/templates/list.html'
,
'components/wf/templates/show.html'
,
'shared/templates/add.html'
,
'shared/templates/datefield.html'
,
'shared/templates/directives/chat.html'
,
'shared/templates/directives/header-breadcrumb.html'
,
'shared/templates/directives/header-notification.html'
,
'shared/templates/directives/header-sub-menu.html'
,
'shared/templates/directives/menuCollapse.html'
,
'shared/templates/directives/msgbox.html'
,
'shared/templates/directives/notifications.html'
,
'shared/templates/directives/selected-user.html'
,
'shared/templates/directives/sidebar-notification.html'
,
'shared/templates/directives/sidebar-search.html'
,
'shared/templates/directives/sidebar.html'
,
'shared/templates/directives/stats.html'
,
'shared/templates/directives/timeline.html'
,
'shared/templates/fieldset.html'
,
'shared/templates/foreignKey.html'
,
'shared/templates/linkedModelModalContent.html'
,
'shared/templates/listnodeModalContent.html'
,
'shared/templates/modalContent.html'
,
'shared/templates/nodeTable.html'
,
'shared/templates/select.html'
]);
angular
.
module
(
"components/auth/login.html"
,
[]).
run
([
"$templateCache"
,
function
(
$templateCache
)
{
$templateCache
.
put
(
"components/auth/login.html"
,
...
...
@@ -20,8 +20,8 @@ angular.module("components/auth/login.html", []).run(["$templateCache", function
"</div>"
);
}]);
angular
.
module
(
"components/crud/templates/
add
.html"
,
[]).
run
([
"$templateCache"
,
function
(
$templateCache
)
{
$templateCache
.
put
(
"components/crud/templates/
add
.html"
,
angular
.
module
(
"components/crud/templates/
form
.html"
,
[]).
run
([
"$templateCache"
,
function
(
$templateCache
)
{
$templateCache
.
put
(
"components/crud/templates/
form
.html"
,
"<div class=
\"
container
\"
>
\n
"
+
" <h1>{{ schema.title }}</h1>
\n
"
+
"
\n
"
+
...
...
@@ -65,16 +65,6 @@ angular.module("components/crud/templates/add.html", []).run(["$templateCache",
"</div>"
);
}]);
angular
.
module
(
"components/crud/templates/edit.html"
,
[]).
run
([
"$templateCache"
,
function
(
$templateCache
)
{
$templateCache
.
put
(
"components/crud/templates/edit.html"
,
"<div class=
\"
container
\"
ng-app=
\"
ulakbus.crud
\"
>
\n
"
+
" <div class=
\"
col-md-6
\"
>
\n
"
+
" <h1>{{ schema.title }}</h1>
\n
"
+
" <form name=
\"
formgenerated
\"
sf-schema=
\"
schema
\"
sf-form=
\"
form
\"
sf-model=
\"
model
\"
ng-submit=
\"
onSubmit(formgenerated)
\"
></form>
\n
"
+
" </div>
\n
"
+
"</div>"
);
}]);
angular
.
module
(
"components/crud/templates/list.html"
,
[]).
run
([
"$templateCache"
,
function
(
$templateCache
)
{
$templateCache
.
put
(
"components/crud/templates/list.html"
,
"<div class=
\"
starter-template container
\"
>
\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