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
0
Merge Requests
0
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alecs_myu
erp5
Commits
66c065af
Commit
66c065af
authored
Feb 14, 2015
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: check data's validity in floatfield
parent
b7f4f3a2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
13 deletions
+74
-13
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
...tal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
+2
-1
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_floatfield_html.xml
...eItem/web_page_module/rjs_gadget_erp5_floatfield_html.xml
+5
-5
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_floatfield_js.xml
...ateItem/web_page_module/rjs_gadget_erp5_floatfield_js.xml
+67
-7
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
View file @
66c065af
...
...
@@ -148,7 +148,8 @@ def renderField(field, meta_type=None):\n
"title": field.get_value("title"),\n
"required": field.get_value("required"),\n
}\n
\n
if meta_type == "FloatField":\n
result["precision"] = field.get_value("precision")\n
elif meta_type == "DateTimeField":\n
result = {\n
"type": meta_type,\n
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_floatfield_html.xml
View file @
66c065af
...
...
@@ -120,7 +120,7 @@
\n
</head>
\n
<body>
\n
<input
type=
\'number\'
step=
"0.00000001"
/>
\n
<input
type=
\'number\'
/>
\n
</body>
\n
</html>
...
...
@@ -245,7 +245,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
sven
</string>
</value>
<value>
<string>
xiaowu
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -259,7 +259,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
37.51521.250.37802
</string>
</value>
<value>
<string>
9
40.63282.44183.51353
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -277,8 +277,8 @@
</tuple>
<state>
<tuple>
<float>
14
11576768.35
</float>
<string>
GMT
</string>
<float>
14
23905795.16
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_floatfield_js.xml
View file @
66c065af
...
...
@@ -99,9 +99,9 @@
</item>
<item>
<key>
<string>
text_content
</string>
</key>
<value>
<string>
/*global window, rJS */\n
<value>
<string>
/*global window, rJS
, RSVP, loopEventListener
*/\n
/*jslint indent: 2, maxerr: 3 */\n
(function (window, rJS) {\n
(function (window, rJS
, RSVP, loopEventListener
) {\n
"use strict";\n
\n
rJS(window)\n
...
...
@@ -111,13 +111,21 @@
gadget.element = element;\n
});\n
})\n
.declareAcquiredMethod("notifyValid", "notifyValid")\n
.declareAcquiredMethod("notifyInvalid", "notifyInvalid")\n
.declareAcquiredMethod("notifyChange", "notifyChange")\n
.declareMethod(\'render\', function (options) {\n
var input = this.element.querySelector(\'input\'),\n
step = 0.00000001,\n
field_json = options.field_json || {};\n
input.setAttribute(\n
\'value\',\n
field_json.value || field_json.default || ""\n
);\n
if (field_json.precision !== "") {\n
step = 1 / Math.pow(10, field_json.precision);\n
}\n
input.setAttribute("step", step);\n
input.setAttribute(\'name\', field_json.key);\n
input.setAttribute(\'title\', field_json.title);\n
if (field_json.required === 1) {\n
...
...
@@ -136,9 +144,61 @@
result = {};\n
result[input.getAttribute(\'name\')] = input.value;\n
return result;\n
})\n
.declareMethod(\'checkValidity\', function () {\n
var result;\n
result = this.element.querySelector(\'input\').checkValidity();\n
if (result) {\n
return this.notifyValid()\n
.push(function () {\n
return result;\n
});\n
}\n
return result;\n
})\n
\n
.declareService(function () {\n
////////////////////////////////////\n
// Check field validity when the value changes\n
////////////////////////////////////\n
var field_gadget = this;\n
\n
function notifyChange() {\n
return RSVP.all([\n
field_gadget.checkValidity(),\n
field_gadget.notifyChange()\n
]);\n
}\n
\n
// Listen to input change\n
return loopEventListener(\n
field_gadget.element.querySelector(\'input\'),\n
\'change\',\n
false,\n
notifyChange\n
);\n
})\n
\n
.declareService(function () {\n
////////////////////////////////////\n
// Inform when the field input is invalid\n
////////////////////////////////////\n
var field_gadget = this;\n
\n
function notifyInvalid(evt) {\n
return field_gadget.notifyInvalid(evt.target.validationMessage);\n
}\n
\n
// Listen to input change\n
return loopEventListener(\n
field_gadget.element.querySelector(\'input\'),\n
\'invalid\',\n
false,\n
notifyInvalid\n
);\n
});\n
\n
}(window, rJS));
</string>
</value>
}(window, rJS
, RSVP, loopEventListener
));
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
...
...
@@ -259,7 +319,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
romain
</string>
</value>
<value>
<string>
xiaowu
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -273,7 +333,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
37.51520.38687.48861
</string>
</value>
<value>
<string>
9
40.63306.33653.13909
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -291,8 +351,8 @@
</tuple>
<state>
<tuple>
<float>
14
12082125.19
</float>
<string>
GMT
</string>
<float>
14
23907635.25
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
...
...
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