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
Mikolaï Krol
erp5
Commits
859e66bc
Commit
859e66bc
authored
Oct 17, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Rewrite email field
parent
a87fdc00
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
89 deletions
+69
-89
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_emailfield_html.html
...Item/web_page_module/rjs_gadget_erp5_emailfield_html.html
+1
-4
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_emailfield_html.xml
...eItem/web_page_module/rjs_gadget_erp5_emailfield_html.xml
+4
-4
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_emailfield_js.js
...lateItem/web_page_module/rjs_gadget_erp5_emailfield_js.js
+60
-77
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_emailfield_js.xml
...ateItem/web_page_module/rjs_gadget_erp5_emailfield_js.xml
+4
-4
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_emailfield_html.html
View file @
859e66bc
...
@@ -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
File
field
</title>
<title>
ERP5
Email
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_erp5_field_email.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_field_email.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_global.js"
type=
"text/javascript"
></script>
</head>
</head>
<body>
<body>
<input
type=
'email'
name=
'email'
/>
</body>
</body>
</html>
</html>
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_emailfield_html.xml
View file @
859e66bc
...
@@ -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
44.22472.26102.41676
</string>
</value>
<value>
<string>
9
54.34618.13218.7202
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -252,8 +252,8 @@
...
@@ -252,8 +252,8 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
36754133.28
</float>
<float>
14
76689079.36
</float>
<string>
GMT+2
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
</object>
</object>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_emailfield_js.js
View file @
859e66bc
/*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
)
{
gadget
.
element
=
element
;
});
})
})
.
declareAcquiredMethod
(
"
notifyValid
"
,
"
notifyValid
"
)
.
declareAcquiredMethod
(
"
notifyInvalid
"
,
"
notifyInvalid
"
)
.
declareAcquiredMethod
(
"
notifyChange
"
,
"
notifyChange
"
)
.
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
);
type
:
'
email
'
if
(
field_json
.
required
===
1
)
{
};
input
.
setAttribute
(
'
required
'
,
'
required
'
);
state_dict
.
text_content
=
state_dict
.
value
;
}
return
this
.
changeState
(
state_dict
);
if
(
field_json
.
editable
!==
1
)
{
})
input
.
setAttribute
(
'
readonly
'
,
'
readonly
'
);
input
.
setAttribute
(
'
data-wrapper-class
'
,
'
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
'
})
.
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
)
{
return
input
.
render
(
gadget
.
state
);
});
})
})
.
declareMethod
(
'
getContent
'
,
function
()
{
.
declareMethod
(
'
getContent
'
,
function
()
{
var
input
=
this
.
element
.
querySelector
(
'
input
'
),
if
(
this
.
state
.
editable
)
{
result
=
{};
return
this
.
getDeclaredGadget
(
'
sub
'
)
result
[
input
.
getAttribute
(
'
name
'
)]
=
input
.
value
;
.
push
(
function
(
gadget
)
{
return
result
;
return
gadget
.
getContent
();
})
.
declareMethod
(
'
checkValidity
'
,
function
()
{
var
result
;
result
=
this
.
element
.
querySelector
(
'
input
'
).
checkValidity
();
if
(
result
)
{
return
this
.
notifyValid
()
.
push
(
function
()
{
return
result
;
});
});
}
}
return
result
;
return
{}
;
})
})
.
declareService
(
function
()
{
.
declareMethod
(
'
getTextContent
'
,
function
()
{
////////////////////////////////////
return
this
.
getDeclaredGadget
(
'
sub
'
)
// Check field validity when the value changes
.
push
(
function
(
gadget
)
{
////////////////////////////////////
return
gadget
.
getTextContent
();
var
field_gadget
=
this
;
});
function
notifyChange
()
{
return
RSVP
.
all
([
field_gadget
.
checkValidity
(),
field_gadget
.
notifyChange
()
]);
}
// Listen to input change
return
loopEventListener
(
field_gadget
.
element
.
querySelector
(
'
input
'
),
'
change
'
,
false
,
notifyChange
);
})
})
.
declareService
(
function
()
{
.
declareMethod
(
'
checkValidity
'
,
function
()
{
////////////////////////////////////
if
(
this
.
state
.
editable
)
{
// Inform when the field input is invalid
return
this
.
getDeclaredGadget
(
'
sub
'
)
////////////////////////////////////
.
push
(
function
(
gadget
)
{
var
field_gadget
=
this
;
return
gadget
.
checkValidity
();
});
function
notifyInvalid
(
evt
)
{
return
field_gadget
.
notifyInvalid
(
evt
.
target
.
validationMessage
);
}
}
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_emailfield_js.xml
View file @
859e66bc
...
@@ -216,7 +216,7 @@
...
@@ -216,7 +216,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>
...
@@ -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
44.22469.53955.10393
</string>
</value>
<value>
<string>
9
54.42781.26559.24780
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,8 +248,8 @@
...
@@ -248,8 +248,8 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
36753691.76
</float>
<float>
14
76689142.53
</float>
<string>
GMT+2
</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