Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rjs_json_form
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
rjs_json_form
Commits
899c03a6
Commit
899c03a6
authored
May 10, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix gadget.getElementByPath()
parent
8aa5557a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
19 deletions
+21
-19
gadget_json_generated_form_child.js
gadget_json_generated_form_child.js
+21
-19
No files found.
gadget_json_generated_form_child.js
View file @
899c03a6
...
@@ -1191,6 +1191,7 @@
...
@@ -1191,6 +1191,7 @@
path
,
path
,
scope
,
scope
,
key
,
key
,
next_data_path
,
slash_count
=
0
,
slash_count
=
0
,
slash_count_next
,
slash_count_next
,
bingo
,
bingo
,
...
@@ -1199,21 +1200,26 @@
...
@@ -1199,21 +1200,26 @@
if
(
data_path
!==
"
/
"
)
{
if
(
data_path
!==
"
/
"
)
{
for
(
path
in
options
.
arrays
)
{
for
(
path
in
options
.
arrays
)
{
if
(
options
.
arrays
.
hasOwnProperty
(
path
)
&&
data_path
.
startsWith
(
path
))
{
if
(
options
.
arrays
.
hasOwnProperty
(
path
)
&&
data_path
.
startsWith
(
path
))
{
array
=
options
.
arrays
[
path
]
slash_count_next
=
path
.
split
(
"
/
"
).
length
-
1
;
.
querySelectorAll
(
"
div[data-gadget-parent-scope='
"
+
g
.
element
.
getAttribute
(
"
data-gadget-scope
"
)
+
"
']
"
);
if
(
slash_count_next
>
slash_count
)
{
data_path
=
data_path
.
slice
(
path
.
length
).
split
(
"
/
"
);
bingo
=
path
;
idx
=
data_path
[
0
];
slash_count
=
slash_count_next
;
data_path
=
"
/
"
+
data_path
.
slice
(
1
).
join
(
"
/
"
);
}
bingo
=
array
[
idx
].
getAttribute
(
'
data-gadget-scope
'
);
}
}
}
}
if
(
bingo
)
{
if
(
bingo
)
{
return
g
.
getDeclaredGadget
(
bingo
)
array
=
options
.
arrays
[
bingo
]
.
querySelectorAll
(
"
div[data-gadget-parent-scope='
"
+
g
.
element
.
getAttribute
(
"
data-gadget-scope
"
)
+
"
']
"
);
next_data_path
=
data_path
.
slice
(
bingo
.
length
).
split
(
"
/
"
);
idx
=
next_data_path
[
0
];
next_data_path
=
"
/
"
+
next_data_path
.
slice
(
1
).
join
(
"
/
"
);
return
g
.
getDeclaredGadget
(
array
[
idx
].
getAttribute
(
'
data-gadget-scope
'
))
.
push
(
function
(
gadget
)
{
.
push
(
function
(
gadget
)
{
return
gadget
.
getElementByPath
(
data_path
);
return
gadget
.
getElementByPath
(
next_
data_path
);
});
});
}
}
slash_count
=
0
;
for
(
path
in
options
.
objects
)
{
for
(
path
in
options
.
objects
)
{
if
(
options
.
objects
.
hasOwnProperty
(
path
)
&&
data_path
.
startsWith
(
path
))
{
if
(
options
.
objects
.
hasOwnProperty
(
path
)
&&
data_path
.
startsWith
(
path
))
{
slash_count_next
=
path
.
split
(
"
/
"
).
length
-
1
;
slash_count_next
=
path
.
split
(
"
/
"
).
length
-
1
;
...
@@ -1225,17 +1231,13 @@
...
@@ -1225,17 +1231,13 @@
}
}
if
(
bingo
)
{
if
(
bingo
)
{
path
=
options
.
objects
[
bingo
];
path
=
options
.
objects
[
bingo
];
for
(
key
in
path
)
{
key
=
decodeJsonPointer
(
data_path
.
slice
(
bingo
.
length
).
split
(
'
/
'
)[
0
]);
if
(
path
.
hasOwnProperty
(
key
))
{
if
(
path
.
hasOwnProperty
(
key
))
{
if
(
data_path
.
startsWith
(
bingo
+
encodeJsonPointer
(
key
)))
{
next_data_path
=
data_path
.
slice
(
bingo
.
length
+
encodeJsonPointer
(
key
).
length
);
data_path
=
data_path
.
slice
(
bingo
.
length
+
encodeJsonPointer
(
key
).
length
);
if
(
!
next_data_path
)
{
if
(
!
data_path
)
{
next_data_path
=
"
/
"
;
data_path
=
"
/
"
;
}
}
scope
=
path
[
key
];
scope
=
path
[
key
];
break
;
}
}
}
}
}
}
if
(
scope
===
false
)
{
if
(
scope
===
false
)
{
...
@@ -1246,7 +1248,7 @@
...
@@ -1246,7 +1248,7 @@
if
(
scope
)
{
if
(
scope
)
{
return
g
.
getDeclaredGadget
(
scope
)
return
g
.
getDeclaredGadget
(
scope
)
.
push
(
function
(
gadget
)
{
.
push
(
function
(
gadget
)
{
return
gadget
.
getElementByPath
(
data_path
);
return
gadget
.
getElementByPath
(
next_
data_path
);
});
});
}
}
}
}
...
...
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