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
38722004
Commit
38722004
authored
Sep 17, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edit page model to form implementation
parent
1d1ea4c4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
31 deletions
+49
-31
add.html
app/shared/templates/add.html
+2
-2
sidebar.html
app/shared/templates/directives/sidebar.html
+4
-4
foreignKey.html
app/shared/templates/foreignKey.html
+2
-2
nodeTable.html
app/shared/templates/nodeTable.html
+12
-7
form_service.js
app/zetalib/forms/form_service.js
+29
-16
No files found.
app/shared/templates/add.html
View file @
38722004
...
...
@@ -8,7 +8,7 @@
</a>
</span>
</h3>
<ng-include
src=
"'shared/templates/nodeTable.html'"
ng-if=
"node.lengthModels > 0"
></ng-include>
<ng-include
src=
"'shared/templates/nodeTable.html'"
></ng-include>
<hr>
</div>
<div
ng-repeat=
"node in ListNode"
>
...
...
@@ -19,7 +19,7 @@
</a>
</span>
</h3>
<ng-include
src=
"'shared/templates/nodeTable.html'"
ng-if=
"node.lengthModels > 0"
ng-bind=
"node.lengthModels"
></ng-include>
<ng-include
src=
"'shared/templates/nodeTable.html'"
></ng-include>
<hr>
</div>
...
...
app/shared/templates/directives/sidebar.html
View file @
38722004
...
...
@@ -6,17 +6,17 @@
<ul
class=
"nav in"
id=
"side-menu"
>
<!--<sidebar-search></sidebar-search>-->
<li
ui-sref-active=
"active"
>
<a
href=
"#/dashboard"
><i
class=
"fa fa-dashboard fa-fw"
></i>
Dashboard
</a>
<a
href=
"#/dashboard"
><i
class=
"fa fa-dashboard fa-fw"
></i>
Panel
</a>
</li>
<li
ng-repeat=
"(key, item) in menuItems"
ng-class=
"{active: collapseVar == key}"
>
<a
href=
""
ng-click=
"check(key)"
><i
class=
"fa fa-wrench fa-fw"
></i>
{{ item }}
<span
<a
href=
""
ng-click=
"check(key)"
><i
class=
"fa fa-wrench fa-fw"
></i>
{{ item
[0]
}}
<span
class=
"fa arrow"
></span></a>
<ul
class=
"nav nav-second-level"
collapse=
"collapseVar!={{key}}"
>
<li
ui-sref-active=
"active"
>
<a
href=
"#/{{item
}}"
>
List
</a>
<a
href=
"#/{{item
[1]}}"
>
Listele
</a>
</li>
<li
ui-sref-active=
"active"
>
<a
href=
"#/{{item
}}/add"
>
Add
</a>
<a
href=
"#/{{item
[1]}}/add"
>
Ekle
</a>
</li>
</ul>
<!-- /.nav-second-level -->
...
...
app/shared/templates/foreignKey.html
View file @
38722004
...
...
@@ -6,16 +6,16 @@
</label>
<select
ng-model=
"$$value$$"
value=
"$$value$$"
ng-model-options=
"form.ngModelOptions"
ng-disabled=
"form.readonly"
sf-changed=
"form"
class=
"form-control {{form.fieldHtmlClass}}"
schema-validate=
"form"
ng-options=
"item.value as item.name
group by item.group
for item in form.titleMap"
ng-options=
"item.value as item.name for item in form.titleMap"
name=
"{{form.key.slice(-1)[0]}}"
>
</select>
<div
class=
"help-block"
sf-message=
"form.description"
></div>
</div>
<div
class=
"col-md-4"
>
...
...
app/shared/templates/nodeTable.html
View file @
38722004
<table
class=
"table table-bordered"
style=
"background-color:#fff;"
>
<thead>
<tr>
<th
colspan=
"2"
>
#
</th>
<th
ng-repeat=
"(key,value) in node.fields"
>
{{ value.title }}
</th>
<th
colspan=
"2"
>
<label>
<input
type=
"checkbox"
style=
"zoom:1.5; margin:5px 0 0 8px;"
>
Hepsini Seç
</label>
</th>
<th
ng-repeat=
"(key,value) in node.form"
>
{{ value }}
</th>
<th>
action
</th>
</tr>
</thead>
<tbody>
<tbody
ng-class=
"{true: '', false: 'hidden'}[node.lengthModels > 0]"
>
<tr>
<td
width=
"60"
>
<label>
...
...
@@ -14,11 +19,11 @@
</label>
</td>
<th
scope=
"row"
style=
"text-align:center"
>
1
</th>
<td
ng-repeat=
"
(key,value) in node.models"
>
{{ value.
value }}
</td>
<td
ng-repeat=
"
value in node.model"
>
{{
value }}
</td>
<td>
<
a
ng-href=
"#/crud/{{model}}/edit/{{object.key}}"
>
Edit
</a
><br>
<
a
ng-href=
"#/crud/{{model}}/{{object.key}}"
>
Show
</a
>
<
a
ng-href=
"#/crud/{{model}}/{{object.key}}"
>
Delete
</a
>
<
button
modal-for-nodes=
"{{node.title}},ListNode"
>
Edit
</button
><br>
<
button>
Show
</button
>
<
button>
Delete
</button
>
</td>
</tr>
</tbody>
...
...
app/zetalib/forms/form_service.js
View file @
38722004
...
...
@@ -70,29 +70,35 @@ form_generator.factory('Generator', function ($http, $q, $log, $location, $modal
if
(
k
.
type
==
'model'
)
{
var
formitem
=
scope
.
form
[
scope
.
form
.
indexOf
(
v
)];
var
modelscope
=
{
"url"
:
scope
.
url
,
"form_params"
:
{
model
:
k
.
title
}};
formitem
=
{
"type"
:
"template"
,
"templateUrl"
:
"shared/templates/foreignKey.html"
,
"title"
:
k
.
title
"title"
:
k
.
title
,
"titleMap"
:
generator
.
get_list
(
modelscope
).
then
(
function
(
res
)
{
formitem
.
titleMap
=
[];
angular
.
forEach
(
res
.
data
.
objects
,
function
(
item
)
{
formitem
.
titleMap
.
push
({
"value"
:
item
.
key
,
"name"
:
item
.
data
.
name
?
item
.
data
.
name
:
item
.
data
.
username
});
});
}),
onChange
:
function
(
modelValue
,
form
)
{
scope
.
model
[
v
]
=
modelValue
;
}
};
var
modelscope
=
{
"url"
:
scope
.
url
,
"form_params"
:
{
model
:
k
.
title
}};
// get model objects from db and add to select list
generator
.
get_list
(
modelscope
).
then
(
function
(
res
)
{
formitem
.
titleMap
=
[];
angular
.
forEach
(
res
.
data
.
objects
,
function
(
item
)
{
formitem
.
titleMap
.
push
({
"value"
:
item
.
key
,
"name"
:
item
.
data
.
name
?
item
.
data
.
name
:
item
.
data
.
username
});
});
});
scope
.
form
[
scope
.
form
.
indexOf
(
v
)]
=
formitem
;
scope
.
$broadcast
(
'schemaFormRedraw'
);
// todo: make lines below work properly
//if (scope.model[v].indexOf("TMP_") > -1) {
// scope.model[v] = null;
//}
}
if
(
k
.
type
==
'ListNode'
||
k
.
type
==
'Node'
)
{
...
...
@@ -103,13 +109,20 @@ form_generator.factory('Generator', function ($http, $q, $log, $location, $modal
title
:
k
.
title
,
form
:
[],
schema
:
{
properties
:
{},
required
:
[],
title
:
k
.
title
,
type
:
"object"
,
formType
:
k
.
type
},
model
:
{},
url
:
scope
.
url
};
debugger
;
scope
[
k
.
type
][
k
.
title
].
model
=
scope
.
model
[
v
]
!=
null
?
scope
.
model
[
v
]
:
{};
angular
.
forEach
(
k
.
schema
,
function
(
item
)
{
scope
[
k
.
type
][
k
.
title
].
schema
.
properties
[
item
.
name
]
=
item
;
scope
[
k
.
type
][
k
.
title
].
model
[
item
.
name
]
=
item
.
value
;
// if model is empty object then fill it with scope model item
//if (scope[k.type][k.title] == {}){
// scope[k.type][k.title].model[item.name] = item.value;
//}
// prepare required fields
if
(
item
.
required
==
true
&&
item
.
name
!=
'idx'
)
{
...
...
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