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
aa8f4785
Commit
aa8f4785
authored
Jan 05, 2015
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expandable fields load correct previous values on initiation. minor corrections
parent
00f5c97e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
8 deletions
+23
-8
dream/platform/src/expandable_field/expandablefield.js
dream/platform/src/expandable_field/expandablefield.js
+23
-8
No files found.
dream/platform/src/expandable_field/expandablefield.js
View file @
aa8f4785
...
...
@@ -67,6 +67,7 @@
gadget
.
props
.
element
.
children
[
2
].
style
.
display
=
''
;
inputs
=
gadget
.
props
.
element
.
children
[
2
]
.
getElementsByTagName
(
"
input
"
);
// find the inputs that are direct children of the gadgets element
for
(
i
=
0
;
i
<=
inputs
.
length
-
1
;
i
+=
1
)
{
if
(
inputs
[
i
].
parentNode
.
parentNode
.
parentNode
===
gadget
.
props
.
element
.
children
[
2
])
{
...
...
@@ -75,12 +76,14 @@
}
lbls
=
gadget
.
props
.
element
.
children
[
2
]
.
getElementsByTagName
(
"
label
"
);
// find the labels that are direct children of the gadgets element
for
(
i
=
0
;
i
<=
lbls
.
length
-
1
;
i
+=
1
)
{
if
(
lbls
[
i
].
parentNode
===
gadget
.
props
.
element
.
children
[
2
])
{
labels
.
push
(
lbls
[
i
]);
}
}
for
(
i
=
0
;
i
<=
Object
.
keys
(
properties_dict
).
length
-
1
;
i
+=
1
)
{
sub_title
=
Object
.
keys
(
properties_dict
)[
i
];
console
.
log
(
"
sub_title
"
);
...
...
@@ -126,10 +129,13 @@
}
default_value
=
properties_dict
[
sub_title
].
default
;
//
previous value
//
find previous value if any
if
(
gadget
.
props
.
options
.
value
[
prop_name
])
{
previous_value
=
gadget
.
props
.
options
.
value
[
prop_name
][
sub_title
];
if
(
gadget
.
props
.
options
.
value
[
prop_name
][
sub_title
])
{
previous_value
=
gadget
.
props
.
options
.
value
[
prop_name
][
sub_title
];
}
}
for
(
j
=
0
;
j
<=
inps
.
length
-
1
;
j
+=
1
)
{
// check if the input is one of a sub-gadget
// do not proceed if yes
...
...
@@ -313,8 +319,8 @@
gadget
.
props
.
field_gadget_list
.
push
(
sub_gadget
);
});
}
function
add
ListField
(
options
)
{
// update the listfield of the expandable field
function
update
ListField
(
options
)
{
console
.
log
(
"
ADDLISTFIELD EXPANDABLEFIELDSET 1
"
);
var
select
=
gadget
.
props
.
element
.
getElementsByTagName
(
'
select
'
)[
0
],
i
,
...
...
@@ -335,7 +341,6 @@
}
select
.
innerHTML
+=
tmp
;
}
////////////////////////////////////////////////////////////////
// function that finds the different types of fields that are
// requested and calculates how many times each one of them
...
...
@@ -485,13 +490,23 @@
}
}
}
for
(
ind
=
0
;
ind
<=
oneOf_list
.
length
-
1
;
ind
+=
1
)
{
if
(
oneOf_list
[
ind
].
title
===
string_value
)
{
value
=
(
gadget
.
props
.
options
.
value
||
{})[
oneOf_list
[
ind
].
title
]
===
undefined
?
oneOf_list
[
ind
].
default
:
gadget
.
props
.
options
.
value
[
oneOf_list
[
ind
].
title
];
break
;
}
}
console
.
log
(
"
abstract_definition for
"
+
index
);
console
.
log
(
ab_definition
);
// add a field with abstract definition
addField
(
ab_definition
.
title
,
ab_definition
,
"
undefined
"
value
);
// find out if the oneOf_list item should be initiated
// (if it is the selected one (string_value))
...
...
@@ -507,6 +522,7 @@
property_def
:
oneOf_list
[
ind
],
value
:
value
};
break
;
}
}
}
else
{
...
...
@@ -526,7 +542,7 @@
===
undefined
?
prop_definition
.
default
:
gadget
.
props
.
options
.
value
[
prop_name
];
add
ListField
({
update
ListField
({
key
:
prop_name
,
value
:
string_value
,
property_definition
:
prop_definition
...
...
@@ -536,7 +552,6 @@
});
return
queue
;
})
// getContent of all subfields
.
declareMethod
(
"
getContent
"
,
function
()
{
console
.
log
(
"
GETCONTENT EXPANDABLEFIELDSET 1
"
);
...
...
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