Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Romain Courteaud
erp5_rtl_support
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
...
@@ -148,7 +148,8 @@ def renderField(field, meta_type=None):\n
"title": field.get_value("title"),\n
"title": field.get_value("title"),\n
"required": field.get_value("required"),\n
"required": field.get_value("required"),\n
}\n
}\n
\n
if meta_type == "FloatField":\n
result["precision"] = field.get_value("precision")\n
elif meta_type == "DateTimeField":\n
elif meta_type == "DateTimeField":\n
result = {\n
result = {\n
"type": meta_type,\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 @@
...
@@ -120,7 +120,7 @@
\n
\n
</head>
\n
</head>
\n
<body>
\n
<body>
\n
<input
type=
\'number\'
step=
"0.00000001"
/>
\n
<input
type=
\'number\'
/>
\n
</body>
\n
</body>
\n
</html>
</html>
...
@@ -245,7 +245,7 @@
...
@@ -245,7 +245,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
sven
</string>
</value>
<value>
<string>
xiaowu
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -259,7 +259,7 @@
...
@@ -259,7 +259,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -277,8 +277,8 @@
...
@@ -277,8 +277,8 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
11576768.35
</float>
<float>
14
23905795.16
</float>
<string>
GMT
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
</object>
</object>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_floatfield_js.xml
View file @
66c065af
...
@@ -99,9 +99,9 @@
...
@@ -99,9 +99,9 @@
</item>
</item>
<item>
<item>
<key>
<string>
text_content
</string>
</key>
<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
/*jslint indent: 2, maxerr: 3 */\n
(function (window, rJS) {\n
(function (window, rJS
, RSVP, loopEventListener
) {\n
"use strict";\n
"use strict";\n
\n
\n
rJS(window)\n
rJS(window)\n
...
@@ -111,13 +111,21 @@
...
@@ -111,13 +111,21 @@
gadget.element = element;\n
gadget.element = element;\n
});\n
});\n
})\n
})\n
.declareAcquiredMethod("notifyValid", "notifyValid")\n
.declareAcquiredMethod("notifyInvalid", "notifyInvalid")\n
.declareAcquiredMethod("notifyChange", "notifyChange")\n
.declareMethod(\'render\', function (options) {\n
.declareMethod(\'render\', function (options) {\n
var input = this.element.querySelector(\'input\'),\n
var input = this.element.querySelector(\'input\'),\n
step = 0.00000001,\n
field_json = options.field_json || {};\n
field_json = options.field_json || {};\n
input.setAttribute(\n
input.setAttribute(\n
\'value\',\n
\'value\',\n
field_json.value || field_json.default || ""\n
field_json.value || field_json.default || ""\n
);\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(\'name\', field_json.key);\n
input.setAttribute(\'title\', field_json.title);\n
input.setAttribute(\'title\', field_json.title);\n
if (field_json.required === 1) {\n
if (field_json.required === 1) {\n
...
@@ -136,9 +144,61 @@
...
@@ -136,9 +144,61 @@
result = {};\n
result = {};\n
result[input.getAttribute(\'name\')] = input.value;\n
result[input.getAttribute(\'name\')] = input.value;\n
return result;\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
\n
\n
}(window, rJS));
</string>
</value>
}(window, rJS
, RSVP, loopEventListener
));
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
...
@@ -259,7 +319,7 @@
...
@@ -259,7 +319,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
romain
</string>
</value>
<value>
<string>
xiaowu
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -273,7 +333,7 @@
...
@@ -273,7 +333,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -291,8 +351,8 @@
...
@@ -291,8 +351,8 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
12082125.19
</float>
<float>
14
23907635.25
</float>
<string>
GMT
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
</object>
</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