Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
00f5c97e
Commit
00f5c97e
authored
Dec 23, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
label of expand(sub)field sync-ing corrected
parent
6679c74b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
5 deletions
+55
-5
dream/platform/src/expandable_field/expandablefield.js
dream/platform/src/expandable_field/expandablefield.js
+53
-5
dream/platform/src/fieldset/fieldset.js
dream/platform/src/fieldset/fieldset.js
+2
-0
No files found.
dream/platform/src/expandable_field/expandablefield.js
View file @
00f5c97e
...
...
@@ -27,6 +27,7 @@
var
i
,
properties_dict
,
sub_title
,
sub_type
,
in_type
,
default_value
,
previous_value
,
labels
=
[],
lbls
,
inps
=
[],
inputs
,
j
,
index
,
corresponding_input
,
sub_gadget_list
=
[],
old_title
,
recent_occupied
=
[],
recent_occupied_labels
=
[],
prop_name
=
gadget
.
props
.
definition
.
property_def
.
title
;
...
...
@@ -37,8 +38,26 @@
gadget
.
props
.
element
.
children
[
1
].
innerHTML
=
prop_name
;
gadget
.
props
.
element
.
children
[
1
].
setAttribute
(
"
for
"
,
prop_name
);
// sub fields set props.key correctly
// find any sub_sub_gadgets if any
for
(
j
=
0
;
j
<=
gadget
.
props
.
field_gadget_list
.
length
-
1
;
j
+=
1
)
{
gadget
.
props
.
field_gadget_list
[
j
].
props
.
key
=
prop_name
;
if
(
gadget
.
props
.
field_gadget_list
[
j
].
props
.
field_gadget_list
)
{
for
(
i
=
0
;
i
<=
gadget
.
props
.
field_gadget_list
[
j
]
.
props
.
field_gadget_list
.
length
-
1
;
i
+=
1
)
{
// if the sub-gadget has itself a field_gadget_list :
// thus is a expandable field itself
if
(
gadget
.
props
.
field_gadget_list
[
j
]
.
props
.
field_gadget_list
[
i
].
props
)
{
if
(
gadget
.
props
.
field_gadget_list
[
j
]
.
props
.
field_gadget_list
[
i
].
props
.
field_gadget_list
)
{
sub_gadget_list
.
push
(
gadget
.
props
.
field_gadget_list
[
j
]
.
props
.
field_gadget_list
[
i
]);
}
}
}
}
}
// un-hide the title of the field
gadget
.
props
.
element
.
children
[
1
].
style
.
display
=
''
;
...
...
@@ -66,14 +85,39 @@
sub_title
=
Object
.
keys
(
properties_dict
)[
i
];
console
.
log
(
"
sub_title
"
);
console
.
log
(
sub_title
);
sub_type
=
properties_dict
[
sub_title
].
type
;
sub_type
=
properties_dict
[
sub_title
].
type
||
(
properties_dict
[
sub_title
].
allOf
?
"
allOf
"
:
undefined
);
// if the gadget contains expandable inputs (allOf)
// find the labels of that inputs
if
(
properties_dict
[
sub_title
].
allOf
)
{
for
(
j
=
0
;
j
<=
labels
.
length
-
1
;
j
+=
1
)
{
if
(
labels
[
j
].
getAttribute
(
"
for
"
).
split
(
"
_
"
)[
0
]
===
"
allOf
"
)
{
if
(
!
(
recent_occupied_labels
.
indexOf
(
labels
[
j
])
>
-
1
))
{
if
(
!
(
recent_occupied_labels
.
indexOf
(
labels
[
j
])
>
-
1
))
{
// for that label, find if it is assigned to any input
// proceed only if no input is assigned to it
corresponding_input
=
false
;
for
(
index
=
0
;
index
<=
inps
.
length
-
1
;
index
+=
1
)
{
if
(
labels
[
j
].
getAttribute
(
"
for
"
)
===
inps
[
index
].
getAttribute
(
"
title
"
))
{
corresponding_input
=
true
;
}
}
if
(
!
corresponding_input
)
{
old_title
=
JSON
.
parse
(
JSON
.
stringify
(
labels
[
j
].
getAttribute
(
"
for
"
)));
// if the old title of the label is the same with the key
// of the subsubgadget then update the key of the subsubgadget
for
(
index
=
0
;
index
<=
sub_gadget_list
.
length
-
1
;
index
+=
1
)
{
if
(
sub_gadget_list
[
index
].
props
.
key
===
old_title
)
{
sub_gadget_list
[
index
].
props
.
key
=
sub_title
;
break
;
}
}
labels
[
j
].
innerHTML
=
sub_title
;
labels
[
j
].
setAttribute
(
"
for
"
,
sub_title
);
recent_occupied_labels
.
push
(
labels
[
j
]);
break
;
}
...
...
@@ -115,9 +159,12 @@
recent_occupied
.
push
(
inps
[
j
]);
// find the label for that input
inps
[
j
].
parentNode
.
parentNode
.
previousSibling
.
previousSibling
.
innerHTML
=
sub_title
;
.
previousSibling
.
previousSibling
.
innerHTML
=
sub_title
;
inps
[
j
].
parentNode
.
parentNode
.
previousSibling
.
previousSibling
.
setAttribute
(
"
for
"
,
sub_title
);
recent_occupied_labels
.
push
(
inps
[
j
].
parentNode
.
parentNode
.
previousSibling
.
previousSibling
);
.
previousSibling
.
previousSibling
);
// present them
inps
[
j
].
parentNode
.
parentNode
.
previousSibling
.
previousSibling
.
style
.
display
=
''
;
...
...
@@ -502,6 +549,7 @@
.
push
(
function
()
{
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
(
result_list
)
{
console
.
log
(
"
Retrieving results from sub_fields
"
);
console
.
log
(
"
[*](/)[*]
"
);
console
.
log
(
result_list
);
var
name
,
result
=
{},
content
=
result
;
if
(
gadget
.
props
.
key
)
{
...
...
dream/platform/src/fieldset/fieldset.js
View file @
00f5c97e
...
...
@@ -144,6 +144,8 @@
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
(
result_list
)
{
console
.
log
(
"
(*)(/)(*)
"
);
console
.
log
(
result_list
);
var
name
,
result
=
{},
content
=
result
;
if
(
gadget
.
props
.
key
)
{
content
=
result
[
gadget
.
props
.
key
]
=
{};
...
...
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