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
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
Tatuya Kamada
erp5
Commits
157c669d
Commit
157c669d
authored
Oct 17, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Rewrite integer field
parent
fa6b944b
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
90 deletions
+76
-90
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_integerfield_html.html
...em/web_page_module/rjs_gadget_erp5_integerfield_html.html
+1
-4
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_integerfield_html.xml
...tem/web_page_module/rjs_gadget_erp5_integerfield_html.xml
+3
-3
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_integerfield_js.js
...teItem/web_page_module/rjs_gadget_erp5_integerfield_js.js
+63
-78
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_integerfield_js.xml
...eItem/web_page_module/rjs_gadget_erp5_integerfield_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
+5
-1
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_integerfield_html.html
View file @
157c669d
...
@@ -3,18 +3,15 @@
...
@@ -3,18 +3,15 @@
<head>
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no"
/>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no"
/>
<title>
ERP5
Float
field
</title>
<title>
ERP5
Integer
field
</title>
<!-- renderjs -->
<!-- renderjs -->
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<!-- custom script -->
<script
src=
"gadget_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_field_integer.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_field_integer.js"
type=
"text/javascript"
></script>
</head>
</head>
<body>
<body>
<input
type=
"number"
step=
"1"
/>
</body>
</body>
</html>
</html>
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_integerfield_html.xml
View file @
157c669d
...
@@ -220,7 +220,7 @@
...
@@ -220,7 +220,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
xiaowu
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
40.60742.34496.36488
</string>
</value>
<value>
<string>
9
54.42877.47511.36096
</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>
14
23754455.46
</float>
<float>
14
76697183.42
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_integerfield_js.js
View file @
157c669d
/*global window, rJS
, RSVP, loopEventListener
*/
/*global window, rJS */
/*jslint indent: 2, maxerr: 3 */
/*jslint indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
RSVP
,
loopEventListener
)
{
(
function
(
window
,
rJS
)
{
"
use strict
"
;
"
use strict
"
;
rJS
(
window
)
rJS
(
window
)
.
ready
(
function
(
gadget
)
{
.
setState
({
return
gadget
.
getElement
()
tag
:
'
p
'
,
.
push
(
function
(
element
)
{
step
:
1
,
gadget
.
element
=
element
;
type
:
"
number
"
});
})
.
declareAcquiredMethod
(
"
notifyValid
"
,
"
notifyValid
"
)
.
declareAcquiredMethod
(
"
notifyInvalid
"
,
"
notifyInvalid
"
)
.
declareAcquiredMethod
(
"
notifyChange
"
,
"
notifyChange
"
)
.
declareMethod
(
'
getTextContent
'
,
function
()
{
return
this
.
element
.
querySelector
(
'
input
'
).
getAttribute
(
'
value
'
);
})
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
input
=
this
.
element
.
querySelector
(
'
input
'
),
var
field_json
=
options
.
field_json
||
{},
field_json
=
options
.
field_json
||
{};
state_dict
=
{
input
.
setAttribute
(
value
:
field_json
.
value
||
field_json
.
default
||
""
,
'
value
'
,
editable
:
field_json
.
editable
,
field_json
.
value
||
field_json
.
default
||
""
required
:
field_json
.
required
,
);
name
:
field_json
.
key
,
input
.
setAttribute
(
'
name
'
,
field_json
.
key
);
title
:
field_json
.
title
input
.
setAttribute
(
'
title
'
,
field_json
.
title
);
};
if
(
field_json
.
required
===
1
)
{
state_dict
.
text_content
=
state_dict
.
value
;
input
.
setAttribute
(
'
required
'
,
'
required
'
);
return
this
.
changeState
(
state_dict
);
}
})
if
(
field_json
.
editable
!==
1
)
{
input
.
setAttribute
(
'
readonly
'
,
'
readonly
'
);
input
.
setAttribute
(
'
data-wrapper-class
'
,
'
ui-state-disabled ui-state-readonly
'
);
input
.
setAttribute
(
'
disabled
'
,
'
disabled
'
);
.
onStateChange
(
function
(
modification_dict
)
{
var
element
=
this
.
element
,
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
'
})
.
declareMethod
(
'
getContent
'
,
function
()
{
.
push
(
function
(
input
)
{
var
input
=
this
.
element
.
querySelector
(
'
input
'
),
// Clear first to DOM, append after to reduce flickering/manip
result
=
{};
while
(
element
.
firstChild
)
{
result
[
input
.
getAttribute
(
'
name
'
)]
=
input
.
value
;
element
.
removeChild
(
element
.
firstChild
);
return
result
;
}
})
element
.
appendChild
(
input
.
element
);
.
declareMethod
(
'
checkValidity
'
,
function
()
{
return
input
;
var
result
;
result
=
this
.
element
.
querySelector
(
'
input
'
).
checkValidity
();
if
(
result
)
{
return
this
.
notifyValid
()
.
push
(
function
()
{
return
result
;
});
});
}
else
{
result
=
this
.
getDeclaredGadget
(
'
sub
'
);
}
}
return
result
;
return
result
.
push
(
function
(
input
)
{
return
input
.
render
(
gadget
.
state
);
});
})
})
.
declareService
(
function
()
{
.
declareMethod
(
'
getContent
'
,
function
()
{
////////////////////////////////////
if
(
this
.
state
.
editable
)
{
// Check field validity when the value changes
return
this
.
getDeclaredGadget
(
'
sub
'
)
////////////////////////////////////
.
push
(
function
(
gadget
)
{
var
field_gadget
=
this
;
return
gadget
.
getContent
();
});
function
notifyChange
()
{
return
RSVP
.
all
([
field_gadget
.
checkValidity
(),
field_gadget
.
notifyChange
()
]);
}
}
return
{};
// Listen to input change
return
loopEventListener
(
field_gadget
.
element
.
querySelector
(
'
input
'
),
'
change
'
,
false
,
notifyChange
);
})
})
.
declareService
(
function
()
{
.
declareMethod
(
'
getTextContent
'
,
function
()
{
////////////////////////////////////
return
this
.
getDeclaredGadget
(
'
sub
'
)
// Inform when the field input is invalid
.
push
(
function
(
gadget
)
{
////////////////////////////////////
return
gadget
.
getTextContent
();
var
field_gadget
=
this
;
});
})
function
notifyInvalid
(
evt
)
{
.
declareMethod
(
'
checkValidity
'
,
function
()
{
return
field_gadget
.
notifyInvalid
(
evt
.
target
.
validationMessage
);
if
(
this
.
state
.
editable
)
{
return
this
.
getDeclaredGadget
(
'
sub
'
)
.
push
(
function
(
gadget
)
{
return
gadget
.
checkValidity
();
});
}
}
return
true
;
// Listen to input change
return
loopEventListener
(
field_gadget
.
element
.
querySelector
(
'
input
'
),
'
invalid
'
,
false
,
notifyInvalid
);
});
});
}(
window
,
rJS
,
RSVP
,
loopEventListener
));
}(
window
,
rJS
));
\ No newline at end of file
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_integerfield_js.xml
View file @
157c669d
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
49.15479.42024.21538
</string>
</value>
<value>
<string>
9
54.42915.19295.27187
</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>
14
55899193.71
</float>
<float>
14
76697168.98
</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 @
157c669d
...
@@ -22,7 +22,8 @@
...
@@ -22,7 +22,8 @@
name
:
options
.
name
,
name
:
options
.
name
,
type
:
options
.
type
||
'
text
'
,
type
:
options
.
type
||
'
text
'
,
title
:
options
.
title
,
title
:
options
.
title
,
focus
:
options
.
focus
focus
:
options
.
focus
,
step
:
options
.
step
};
};
return
this
.
changeState
(
state_dict
);
return
this
.
changeState
(
state_dict
);
})
})
...
@@ -40,6 +41,9 @@
...
@@ -40,6 +41,9 @@
if
(
this
.
state
.
title
)
{
if
(
this
.
state
.
title
)
{
textarea
.
setAttribute
(
'
title
'
,
this
.
state
.
title
);
textarea
.
setAttribute
(
'
title
'
,
this
.
state
.
title
);
}
}
if
(
this
.
state
.
step
)
{
textarea
.
setAttribute
(
'
step
'
,
this
.
state
.
step
);
}
if
(
this
.
state
.
required
)
{
if
(
this
.
state
.
required
)
{
textarea
.
required
=
true
;
textarea
.
required
=
true
;
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_js.xml
View file @
157c669d
...
@@ -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
751.60338.24780
</string>
</value>
<value>
<string>
954.35
863.52273.29354
</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
274067.85
</float>
<float>
1476
697276.8
</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