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
12c7e1d1
Commit
12c7e1d1
authored
Nov 24, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do_action fix
sidebar pinned on cookie resolves #49
parent
2742b23c
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
43 deletions
+70
-43
crud_controller.js
app/components/crud/crud_controller.js
+18
-9
list.html
app/components/crud/templates/list.html
+2
-2
directives.js
app/shared/directives.js
+12
-8
form_service.js
app/zetalib/form_service.js
+10
-18
app.js
dist/app.js
+2
-2
components.js
dist/bower_components/components.js
+1
-1
templates.js
dist/templates.js
+25
-3
No files found.
app/components/crud/crud_controller.js
View file @
12c7e1d1
...
...
@@ -65,13 +65,17 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
scope
[
key
]
=
value
;
});
angular
.
forEach
(
scope
.
objects
,
function
(
value
,
key
)
{
if
(
value
!==
'-1'
)
{
if
(
key
>
0
)
{
var
linkIndexes
=
{};
angular
.
forEach
(
value
.
actions
,
function
(
v
,
k
)
{
if
(
v
.
show_as
===
'link'
)
{
linkIndexes
=
v
}
});
angular
.
forEach
(
value
.
fields
,
function
(
v
,
k
)
{
scope
.
objects
[
key
].
fields
[
k
]
=
{
type
:
linkIndexes
.
fields
.
indexOf
(
k
)
>
-
1
?
'link'
:
'str'
,
content
:
v
,
cmd
:
linkIndexes
.
cmd
};
if
(
value
.
actions
.
length
>
0
&&
linkIndexes
.
fields
){
scope
.
objects
[
key
].
fields
[
k
]
=
{
type
:
linkIndexes
.
fields
.
indexOf
(
k
)
>
-
1
?
'link'
:
'str'
,
content
:
v
,
cmd
:
linkIndexes
.
cmd
};
}
else
{
scope
.
objects
[
key
].
fields
[
k
]
=
{
type
:
'str'
,
content
:
v
};
}
});
}
});
...
...
@@ -112,6 +116,18 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
* @returns {object}
*/
.
controller
(
'CRUDListFormCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$modal
,
$timeout
,
Generator
,
$routeParams
,
CrudUtility
)
{
// reloadData must be a json object
$scope
.
reload
=
function
(
reloadData
)
{
$scope
.
form_params
.
cmd
=
$scope
.
reload_cmd
;
$scope
.
form_params
=
angular
.
extend
(
$scope
.
form_params
,
reloadData
);
$log
.
debug
(
'reload data'
,
$scope
);
Generator
.
get_wf
(
$scope
);
};
$scope
.
$on
(
'reload_cmd'
,
function
(
event
,
data
){
$scope
.
reload_cmd
=
data
;
$scope
.
reload
({});
});
if
(
$routeParams
.
cmd
===
'show'
)
{
CrudUtility
.
generateParam
(
$scope
,
$routeParams
,
$routeParams
.
cmd
);
// todo: refactor createListObjects func
...
...
@@ -197,13 +213,6 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
Generator
.
get_wf
(
$scope
);
}
// reloadData must be a json object
$scope
.
reload
=
function
(
reloadData
)
{
$scope
.
form_params
.
cmd
=
$scope
.
reload_cmd
;
$scope
.
form_params
=
angular
.
extend
(
$scope
.
form_params
,
reloadData
);
$log
.
debug
(
'reload data'
,
$scope
);
Generator
.
get_wf
(
$scope
);
};
})
.
directive
(
'crudListDirective'
,
function
()
{
...
...
app/components/crud/templates/list.html
View file @
12c7e1d1
...
...
@@ -17,7 +17,7 @@
Hepsini Seç
</label>
</td>
<td
ng-repeat=
"value in objects[0]"
ng-if=
"objects[0]!='-1'"
>
{{value
s
}}
</td>
<td
ng-repeat=
"value in objects[0]"
ng-if=
"objects[0]!='-1'"
>
{{value}}
</td>
<td
ng-if=
"objects[0]=='-1'"
>
{{ schema.title||model}}
</td>
<td>
action
</td>
</tr>
...
...
@@ -40,7 +40,7 @@
<td>
<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.key, action)"
>
{{action
ng-if=
"action.show_as==='button'"
ng-click=
"do_action(object.key, action
.cmd
)"
>
{{action
.name}}
</button>
<br>
...
...
app/shared/directives.js
View file @
12c7e1d1
...
...
@@ -130,7 +130,7 @@ app.directive('logout', function ($http, $location, RESTURL) {
* toggle collapses sidebar menu when clicked menu button
*/
.
directive
(
'collapseMenu'
,
function
(
$timeout
,
$window
)
{
.
directive
(
'collapseMenu'
,
function
(
$timeout
,
$window
,
$cookies
)
{
return
{
templateUrl
:
'shared/templates/directives/menuCollapse.html'
,
restrict
:
'E'
,
...
...
@@ -138,7 +138,8 @@ app.directive('logout', function ($http, $location, RESTURL) {
scope
:
{},
controller
:
function
(
$scope
,
$rootScope
)
{
$rootScope
.
collapsed
=
false
;
$rootScope
.
sidebarPinned
=
false
;
$rootScope
.
sidebarPinned
=
$cookies
.
get
(
'sidebarPinned'
)
||
0
;
var
cookieSidebar
=
{
1
:
0
,
0
:
1
};
$scope
.
collapseToggle
=
function
()
{
if
(
$window
.
innerWidth
>
'768'
)
{
...
...
@@ -146,21 +147,24 @@ app.directive('logout', function ($http, $location, RESTURL) {
jQuery
(
".sidebar"
).
css
(
"width"
,
"62px"
);
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 62px)"
);
$rootScope
.
collapsed
=
true
;
$rootScope
.
sidebarPinned
=
false
;
$rootScope
.
sidebarPinned
=
0
;
$cookies
.
put
(
'sidebarPinned'
,
cookieSidebar
[
$cookies
.
get
(
'sidebarPinned'
)]);
}
else
{
jQuery
(
"span.menu-text, span.arrow, .sidebar footer"
).
fadeIn
(
400
);
jQuery
(
".sidebar"
).
css
(
"width"
,
"250px"
);
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 250px)"
);
$rootScope
.
collapsed
=
false
;
$rootScope
.
sidebarPinned
=
true
;
$rootScope
.
sidebarPinned
=
1
;
$cookies
.
put
(
'sidebarPinned'
,
cookieSidebar
[
$cookies
.
get
(
'sidebarPinned'
)]);
}
}
};
$timeout
(
function
()
{
$scope
.
collapseToggle
();
if
(
$cookies
.
get
(
'sidebarPinned'
)
===
"0"
)
{
$scope
.
collapseToggle
();
}
});
}
};
...
...
@@ -287,7 +291,7 @@ app.directive('logout', function ($http, $location, RESTURL) {
$scope
.
openSidebar
=
function
()
{
if
(
$window
.
innerWidth
>
'768'
)
{
if
(
$rootScope
.
sidebarPinned
===
false
)
{
if
(
$rootScope
.
sidebarPinned
===
0
)
{
jQuery
(
"span.menu-text, span.arrow, .sidebar footer, #side-menu"
).
fadeIn
(
400
);
jQuery
(
".sidebar"
).
css
(
"width"
,
"250px"
);
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 250px)"
);
...
...
@@ -298,7 +302,7 @@ app.directive('logout', function ($http, $location, RESTURL) {
$scope
.
closeSidebar
=
function
()
{
if
(
$window
.
innerWidth
>
'768'
)
{
if
(
$rootScope
.
sidebarPinned
===
false
)
{
if
(
$rootScope
.
sidebarPinned
===
0
)
{
jQuery
(
".sidebar"
).
css
(
"width"
,
"62px"
);
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 62px)"
);
$rootScope
.
collapsed
=
true
;
...
...
app/zetalib/form_service.js
View file @
12c7e1d1
...
...
@@ -88,29 +88,19 @@ angular.module('formService', [])
return
formObject
;
};
/**
* @name prepareFormItems
* @description
* prepareFormItems looks up fields of schema objects and changes their types to proper type for schemaform
* for listnode, node and model types it uses templates to generate modal
* prepareforms checks input types and convert if necessary
*
* @param scope
* @returns {*}
*/
generator
.
prepareFormItems
=
function
(
scope
)
{
/**
* prepareforms checks input types and convert if necessary
*/
// todo: remove after backend fix
//angular.forEach(scope.form, function (value, key) {
// if (value.type === 'select') {
// scope.schema.properties[value.key].type = 'select';
// scope.schema.properties[value.key].titleMap = value.titleMap;
// scope.form[key] = value.key;
// }
//});
angular
.
forEach
(
scope
.
schema
.
properties
,
function
(
v
,
k
)
{
// generically change _id fields model value
if
(
'form_params'
in
scope
)
{
if
(
k
==
scope
.
form_params
.
param
)
{
scope
.
model
[
k
]
=
scope
.
form_params
.
id
;
...
...
@@ -210,10 +200,10 @@ angular.module('formService', [])
titleMap
:
generator
.
get_list
(
modelscope
).
then
(
function
(
res
)
{
formitem
.
titleMap
=
[];
angular
.
forEach
(
res
.
data
.
objects
,
function
(
item
)
{
if
(
item
!==
res
.
data
.
objects
[
0
]
)
{
if
(
item
!==
"-1"
)
{
formitem
.
titleMap
.
push
({
"value"
:
item
[
0
]
,
"name"
:
item
[
1
]
+
' '
+
(
item
[
2
]
?
item
[
2
]
:
''
)
+
'...'
"value"
:
item
.
key
,
"name"
:
item
.
value
});
}
});
...
...
@@ -301,6 +291,7 @@ angular.module('formService', [])
$scope
.
form_params
.
object_id
=
key
;
$scope
.
form_params
.
param
=
$scope
.
param
;
$scope
.
form_params
.
id
=
$scope
.
param_id
;
$scope
.
form_params
.
token
=
$scope
.
token
;
generator
.
get_wf
(
$scope
);
};
...
...
@@ -318,7 +309,7 @@ angular.module('formService', [])
*/
generator
.
get_list
=
function
(
scope
)
{
return
$http
.
get
(
generator
.
makeUrl
(
scope
)
)
.
post
(
generator
.
makeUrl
(
scope
),
scope
.
form_params
)
.
then
(
function
(
res
)
{
return
res
;
});
...
...
@@ -390,6 +381,7 @@ angular.module('formService', [])
* @param data
*/
generator
.
pathDecider
=
function
(
client_cmd
,
$scope
,
data
)
{
if
(
client_cmd
[
0
]
===
'reload'
||
client_cmd
[
0
]
===
'reset'
)
{
$rootScope
.
$broadcast
(
'reload_cmd'
,
client_cmd
[
0
]);
return
;}
/**
* @name redirectTo
* @description
...
...
dist/app.js
View file @
12c7e1d1
This diff is collapsed.
Click to expand it.
dist/bower_components/components.js
View file @
12c7e1d1
This diff is collapsed.
Click to expand it.
dist/templates.js
View file @
12c7e1d1
angular
.
module
(
'templates-prod'
,
[
'components/auth/login.html'
,
'components/crud/templates/crud.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'
,
'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/search.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/crud.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'
,
'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/search.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/
multiselect.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"
,
...
...
@@ -90,7 +90,7 @@ angular.module("components/crud/templates/list.html", []).run(["$templateCache",
" Hepsini Seç
\n
"
+
" </label>
\n
"
+
" </td>
\n
"
+
" <td ng-repeat=
\"
value in objects[0]
\"
ng-if=
\"
objects[0]!='-1'
\"
>{{value
s
}}</td>
\n
"
+
" <td ng-repeat=
\"
value in objects[0]
\"
ng-if=
\"
objects[0]!='-1'
\"
>{{value}}</td>
\n
"
+
" <td ng-if=
\"
objects[0]=='-1'
\"
>{{ schema.title||model}}</td>
\n
"
+
" <td>action</td>
\n
"
+
" </tr>
\n
"
+
...
...
@@ -113,7 +113,7 @@ angular.module("components/crud/templates/list.html", []).run(["$templateCache",
"
\n
"
+
" <td>
\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.key, action)
\"
>{{action
\n
"
+
" ng-if=
\"
action.show_as==='button'
\"
ng-click=
\"
do_action(object.key, action
.cmd
)
\"
>{{action
\n
"
+
" .name}}
\n
"
+
" </button>
\n
"
+
" <br>
\n
"
+
...
...
@@ -1508,6 +1508,28 @@ angular.module("shared/templates/modalContent.html", []).run(["$templateCache",
""
);
}]);
angular
.
module
(
"shared/templates/multiselect.html"
,
[]).
run
([
"$templateCache"
,
function
(
$templateCache
)
{
$templateCache
.
put
(
"shared/templates/multiselect.html"
,
"<div class=
\"
form-group {{form.htmlClass}} schema-form-select
\"\n
"
+
" ng-class=
\"
{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}
\"
>
\n
"
+
" <label class=
\"
control-label {{form.labelHtmlClass}}
\"
ng-show=
\"
showTitle()
\"
>
\n
"
+
" {{form.title}}
\n
"
+
" </label>
\n
"
+
" <select ng-model=
\"
$$value$$
\"\n
"
+
" ng-model-options=
\"
form.ngModelOptions
\"\n
"
+
" ng-disabled=
\"
form.readonly
\"\n
"
+
" sf-changed=
\"
form
\"\n
"
+
" class=
\"
form-control {{form.fieldHtmlClass}}
\"\n
"
+
" schema-validate=
\"
form
\"\n
"
+
" ng-options=
\"
item.value as item.name for item in form.titleMap
\"\n
"
+
" name=
\"
{{form.key.slice(-1)[0]}}
\"\n
"
+
" id=
\"
{{form.key.slice(-1)[0]}}
\"
multiple>
\n
"
+
" </select>
\n
"
+
"
\n
"
+
" <div class=
\"
help-block
\"
sf-message=
\"
form.description
\"
></div>
\n
"
+
"</div>"
);
}]);
angular
.
module
(
"shared/templates/nodeTable.html"
,
[]).
run
([
"$templateCache"
,
function
(
$templateCache
)
{
$templateCache
.
put
(
"shared/templates/nodeTable.html"
,
"<div class=
\"
tablescroll
\"
>
\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