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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
Cédric Le Ninivin
erp5
Commits
a9107863
Commit
a9107863
authored
Oct 12, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Render non editable checkbox field as text
parent
b1b7c745
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
42 additions
and
17 deletions
+42
-17
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_checkboxfield_html.html
...m/web_page_module/rjs_gadget_erp5_checkboxfield_html.html
+0
-1
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_checkboxfield_html.xml
...em/web_page_module/rjs_gadget_erp5_checkboxfield_html.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_checkboxfield_js.js
...eItem/web_page_module/rjs_gadget_erp5_checkboxfield_js.js
+27
-4
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_checkboxfield_js.xml
...Item/web_page_module/rjs_gadget_erp5_checkboxfield_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_element_js.js
...mplateItem/web_page_module/rjs_gadget_html5_element_js.js
+4
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_element_js.xml
...plateItem/web_page_module/rjs_gadget_html5_element_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_js.js
...TemplateItem/web_page_module/rjs_gadget_html5_input_js.js
+3
-4
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_js.xml
...emplateItem/web_page_module/rjs_gadget_html5_input_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_checkboxfield_html.html
View file @
a9107863
...
@@ -13,6 +13,5 @@
...
@@ -13,6 +13,5 @@
</head>
</head>
<body>
<body>
<div
data-gadget-url=
"gadget_html5_input.html"
data-gadget-scope=
"sub"
></div>
</body>
</body>
</html>
</html>
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_checkboxfield_html.xml
View file @
a9107863
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
954.356
38.15944.23620
</string>
</value>
<value>
<string>
954.356
42.48652.3413
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14762
60804.53
</float>
<float>
14762
73705.86
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_checkboxfield_js.js
View file @
a9107863
...
@@ -5,7 +5,8 @@
...
@@ -5,7 +5,8 @@
rJS
(
window
)
rJS
(
window
)
.
setState
({
.
setState
({
type
:
'
checkbox
'
type
:
'
checkbox
'
,
tag
:
'
p
'
})
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
...
@@ -16,12 +17,34 @@
...
@@ -16,12 +17,34 @@
name
:
field_json
.
key
,
name
:
field_json
.
key
,
title
:
field_json
.
title
title
:
field_json
.
title
};
};
state_dict
.
text_content
=
state_dict
.
checked
?
'
✓
'
:
''
;
return
this
.
changeState
(
state_dict
);
return
this
.
changeState
(
state_dict
);
})
})
.
onStateChange
(
function
()
{
.
onStateChange
(
function
(
modification_dict
)
{
var
gadget
=
this
;
var
element
=
this
.
element
,
return
this
.
getDeclaredGadget
(
'
sub
'
)
gadget
=
this
,
url
,
result
;
if
(
modification_dict
.
hasOwnProperty
(
'
editable
'
))
{
if
(
gadget
.
state
.
editable
)
{
url
=
'
gadget_html5_input.html
'
;
}
else
{
url
=
'
gadget_html5_element.html
'
;
}
result
=
this
.
declareGadget
(
url
,
{
scope
:
'
sub
'
})
.
push
(
function
(
input
)
{
// Clear first to DOM, append after to reduce flickering/manip
while
(
element
.
firstChild
)
{
element
.
removeChild
(
element
.
firstChild
);
}
element
.
appendChild
(
input
.
element
);
return
input
;
});
}
else
{
result
=
this
.
getDeclaredGadget
(
'
sub
'
);
}
return
result
.
push
(
function
(
input
)
{
.
push
(
function
(
input
)
{
return
input
.
render
(
gadget
.
state
);
return
input
.
render
(
gadget
.
state
);
});
});
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_checkboxfield_js.xml
View file @
a9107863
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
954.35
756.30335.63129
</string>
</value>
<value>
<string>
954.35
867.63296.32580
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14762
67648.2
</float>
<float>
14762
74434.41
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_element_js.js
View file @
a9107863
...
@@ -26,6 +26,10 @@
...
@@ -26,6 +26,10 @@
element
.
removeChild
(
element
.
firstChild
);
element
.
removeChild
(
element
.
firstChild
);
}
}
element
.
appendChild
(
new_element
);
element
.
appendChild
(
new_element
);
})
.
declareMethod
(
'
getTextContent
'
,
function
(
options
)
{
return
this
.
state
.
text_content
;
});
});
}(
window
,
document
,
rJS
));
}(
window
,
document
,
rJS
));
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_element_js.xml
View file @
a9107863
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
954.
22958.59420.56644
</string>
</value>
<value>
<string>
954.
34618.13218.7202
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1476
194334.9
</float>
<float>
1476
274252.73
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_js.js
View file @
a9107863
...
@@ -29,13 +29,12 @@
...
@@ -29,13 +29,12 @@
.
onStateChange
(
function
()
{
.
onStateChange
(
function
()
{
var
textarea
=
this
.
element
.
querySelector
(
'
input
'
);
var
textarea
=
this
.
element
.
querySelector
(
'
input
'
);
if
(
this
.
state
.
value
!==
undefined
)
{
if
(
this
.
state
.
type
===
'
checkbox
'
)
{
textarea
.
checked
=
this
.
state
.
checked
;
}
else
{
textarea
.
setAttribute
(
'
value
'
,
this
.
state
.
value
);
textarea
.
setAttribute
(
'
value
'
,
this
.
state
.
value
);
textarea
.
value
=
this
.
state
.
value
;
textarea
.
value
=
this
.
state
.
value
;
}
}
if
(
this
.
state
.
checked
!==
undefined
)
{
textarea
.
checked
=
this
.
state
.
checked
;
}
textarea
.
setAttribute
(
'
name
'
,
this
.
state
.
name
);
textarea
.
setAttribute
(
'
name
'
,
this
.
state
.
name
);
textarea
.
setAttribute
(
'
type
'
,
this
.
state
.
type
);
textarea
.
setAttribute
(
'
type
'
,
this
.
state
.
type
);
if
(
this
.
state
.
title
)
{
if
(
this
.
state
.
title
)
{
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_js.xml
View file @
a9107863
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
954.35751.
28793.55927
</string>
</value>
<value>
<string>
954.35751.
60338.24780
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14762
67355.19
</float>
<float>
14762
74067.85
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
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