Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
138
Merge Requests
138
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
0c06ca35
Commit
0c06ca35
authored
Jul 27, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_json_form: version up from
https://lab.nexedi.com/bk/rjs_json_form
parent
764cc652
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
26 deletions
+43
-26
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform.gadget.js.js
...ateItem/portal_skins/erp5_json_form/jsonform.gadget.js.js
+12
-1
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform/gadget_json_generated_form_child.html.html
..._form/jsonform/gadget_json_generated_form_child.html.html
+0
-1
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform/gadget_json_generated_form_child.js.js
...json_form/jsonform/gadget_json_generated_form_child.js.js
+31
-24
No files found.
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform.gadget.js.js
View file @
0c06ca35
...
...
@@ -420,7 +420,8 @@
})
.
declareAcquiredMethod
(
"
downloadJSON
"
,
"
downloadJSON
"
)
.
declareAcquiredMethod
(
"
notifyChange
"
,
"
notifyChange
"
)
.
allowPublicAcquisition
(
"
notifyChange
"
,
function
()
{
.
allowPublicAcquisition
(
"
rootNotifyChange
"
,
function
()
{
this
.
props
.
changed
=
true
;
return
this
.
notifyChange
();
})
.
declareAcquiredMethod
(
"
notifyValid
"
,
"
notifyValid
"
)
...
...
@@ -508,6 +509,7 @@
}
else
{
error_message
.
appendChild
(
createTextNode
(
error
.
message
));
}
error_message
.
appendChild
(
document
.
createElement
(
"
br
"
));
error_message
.
hidden
=
false
;
a
=
document
.
createElement
(
"
a
"
);
...
...
@@ -643,6 +645,15 @@
// XXX Disable
return
;
})
.
onLoop
(
function
()
{
var
gadget
=
this
;
if
(
this
.
props
.
changed
)
{
return
this
.
checkValidity
()
.
push
(
function
()
{
gadget
.
props
.
changed
=
false
;
});
}
},
500
)
.
declareMethod
(
'
getContent
'
,
function
()
{
var
g
=
this
;
...
...
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform/gadget_json_generated_form_child.html.html
View file @
0c06ca35
...
...
@@ -8,7 +8,6 @@
<script
src=
"../rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"tv4.js"
type=
"text/javascript"
></script>
<script
src=
"../renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"../jio.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_json_generated_form_child.js"
type=
"text/javascript"
></script>
</head>
<body>
...
...
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform/gadget_json_generated_form_child.js.js
View file @
0c06ca35
/*jslint nomen: true, maxlen: 200, indent: 2, maxerr: 100*/
/*global window, document, URL, rJS, RSVP, jIO, tv4, location */
(
function
(
window
,
document
,
location
,
rJS
,
RSVP
,
jIO
,
tv4
)
{
(
function
(
window
,
document
,
location
,
rJS
,
RSVP
,
tv4
)
{
"
use strict
"
;
var
render_object
;
...
...
@@ -101,13 +101,13 @@
return
input
;
}
function
render_textarea
(
json_
field
,
default_value
,
data_format
)
{
function
render_textarea
(
json_
document
,
data_format
)
{
var
input
=
document
.
createElement
(
"
textarea
"
);
if
(
default_value
!==
undefined
)
{
if
(
default_value
instanceof
Array
)
{
input
.
value
=
default_value
.
join
(
"
\n
"
);
if
(
json_document
!==
undefined
)
{
if
(
typeof
json_document
===
"
object
"
)
{
input
.
value
=
JSON
.
stringify
(
json_document
,
null
,
2
);
}
else
{
input
.
value
=
default_value
;
input
.
value
=
json_document
;
}
}
input
[
"
data-format
"
]
=
data_format
;
...
...
@@ -273,13 +273,6 @@
return
ret_arr
[
0
];
}
function
checkValidityAndNotifyChange
(
g
)
{
return
RSVP
.
all
([
g
.
checkValidity
(),
g
.
notifyChange
()
]);
}
function
render_schema_selector
(
gadget
,
title
,
schema_arr
,
event
,
rerender
)
{
return
RSVP
.
Queue
()
.
push
(
function
()
{
...
...
@@ -385,7 +378,7 @@
return
event
(
schema_alternatives
[
value
[
scope
]].
value
);
})
.
push
(
function
()
{
return
checkValidityAndNotifyChange
(
gadget
);
return
gadget
.
rootNotifyChange
(
);
})
.
push
(
function
()
{
if
(
rerender
)
{
...
...
@@ -450,7 +443,7 @@
}
else
{
input
.
removeAttribute
(
"
style
"
);
}
return
checkValidityAndNotifyChange
(
gadget
);
return
gadget
.
rootNotifyChange
(
);
});
},
rerender
:
function
()
{
...
...
@@ -681,10 +674,13 @@
if
(
!
input
&&
[
"
string
"
,
"
integer
"
,
"
number
"
].
indexOf
(
type
)
>=
0
)
{
if
(
json_field
.
contentMediaType
===
"
text/plain
"
)
{
input
=
render_textarea
(
json_field
,
default_value
,
"
string
"
);
input
=
render_textarea
(
default_value
,
"
string
"
);
}
else
{
input
=
document
.
createElement
(
"
input
"
);
if
(
default_value
!==
undefined
)
{
if
(
typeof
default_value
===
"
object
"
)
{
default_value
=
JSON
.
stringify
(
default_value
);
}
input
.
value
=
default_value
;
}
...
...
@@ -1295,7 +1291,7 @@
g
.
props
=
{};
g
.
options
=
{};
})
.
declareAcquiredMethod
(
"
notifyChange
"
,
"
n
otifyChange
"
)
.
declareAcquiredMethod
(
"
rootNotifyChange
"
,
"
rootN
otifyChange
"
)
.
declareAcquiredMethod
(
"
renameChildrenParent
"
,
"
renameChildren
"
)
.
allowPublicAcquisition
(
"
renameChildren
"
,
function
(
opt_arr
,
scope
)
{
var
property_name
,
...
...
@@ -1359,7 +1355,7 @@
for
(
i
=
0
;
i
<
button_list
.
length
;
i
=
i
+
1
)
{
tasks
.
push
(
button_list
[
i
].
rerender
());
}
tasks
.
push
(
checkValidityAndNotifyChange
(
g
));
tasks
.
push
(
g
.
rootNotifyChange
(
));
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
(
tasks
);
...
...
@@ -1458,7 +1454,7 @@
if
(
event_object
&&
opt
.
type
===
"
change
"
)
{
return
event_object
.
event
();
}
return
g
.
n
otifyChange
();
return
g
.
rootN
otifyChange
();
})
.
declareMethod
(
'
renderForm
'
,
function
(
options
)
{
var
g
=
this
,
...
...
@@ -1485,6 +1481,12 @@
options
.
delete_button
=
!
options
.
required
;
}
}
if
(
options
.
top
&&
!
options
.
type
&&
!
schema
.
type
)
{
// XXX use "object" as type for support buggy
// slapos schemas where some times type absent
// i need remove it in future
options
.
type
=
"
object
"
;
}
while
(
root
.
firstChild
)
{
root
.
removeChild
(
root
.
firstChild
);
}
...
...
@@ -1526,19 +1528,24 @@
}
})
.
onEvent
(
'
change
'
,
function
(
evt
)
{
.
onEvent
(
'
input
'
,
function
(
evt
)
{
if
(
evt
.
target
===
this
.
props
.
property_name_edit
)
{
return
this
.
rename
(
this
.
props
.
property_name_edit
.
value
,
evt
);
}
var
field_list
=
this
.
props
.
inputs
,
i
;
var
gadget
=
this
,
field_list
=
this
.
props
.
inputs
,
i
,
changed
=
false
;
// on form data field
for
(
i
=
0
;
i
<
field_list
.
length
;
i
=
i
+
1
)
{
if
(
evt
.
target
===
field_list
[
i
])
{
return
checkValidityAndNotifyChange
(
this
)
;
changed
=
true
;
}
}
if
(
changed
)
{
return
gadget
.
rootNotifyChange
();
}
})
.
declareMethod
(
'
getContent
'
,
function
()
{
...
...
@@ -1568,4 +1575,4 @@
});
});
}(
window
,
document
,
location
,
rJS
,
RSVP
,
jIO
,
tv4
));
\ No newline at end of file
}(
window
,
document
,
location
,
rJS
,
RSVP
,
tv4
));
\ No newline at end of file
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