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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gabriel Monnerat
erp5
Commits
0ca621e9
Commit
0ca621e9
authored
Oct 20, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Reimplemented FileField
parent
c6253d8c
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
88 additions
and
54 deletions
+88
-54
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_filefield_html.html
...eItem/web_page_module/rjs_gadget_erp5_filefield_html.html
+0
-1
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_filefield_html.xml
...teItem/web_page_module/rjs_gadget_erp5_filefield_html.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_filefield_js.js
...plateItem/web_page_module/rjs_gadget_erp5_filefield_js.js
+61
-41
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_filefield_js.xml
...lateItem/web_page_module/rjs_gadget_erp5_filefield_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_html.html
...lateItem/web_page_module/rjs_gadget_html5_input_html.html
+1
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_html.xml
...plateItem/web_page_module/rjs_gadget_html5_input_html.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
+18
-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_filefield_html.html
View file @
0ca621e9
...
@@ -14,6 +14,5 @@
...
@@ -14,6 +14,5 @@
</head>
</head>
<body>
<body>
<input
type=
"file"
>
</body>
</body>
</html>
</html>
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_filefield_html.xml
View file @
0ca621e9
...
@@ -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
48.40112.47919.55415
</string>
</value>
<value>
<string>
9
54.45675.44850.53452
</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
53368107.2
</float>
<float>
14
76949800.7
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_filefield_js.js
View file @
0ca621e9
/*global window, rJS
, RSVP, jIO
*/
/*global window, rJS
*/
/*jslint
nomen: true,
indent: 2, maxerr: 3 */
/*jslint indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
RSVP
,
jIO
)
{
(
function
(
window
,
rJS
)
{
"
use strict
"
;
"
use strict
"
;
rJS
(
window
)
rJS
(
window
)
.
ready
(
function
(
gadget
)
{
.
setState
({
return
gadget
.
getElement
()
tag
:
'
p
'
,
.
push
(
function
(
element
)
{
type
:
'
file
'
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
=
{
editable
:
field_json
.
editable
,
required
:
field_json
.
required
,
name
:
field_json
.
key
,
title
:
field_json
.
title
};
return
this
.
changeState
(
state_dict
);
})
input
.
setAttribute
(
'
name
'
,
field_json
.
key
);
.
onStateChange
(
function
(
modification_dict
)
{
input
.
setAttribute
(
'
title
'
,
field_json
.
title
);
var
element
=
this
.
element
,
if
(
field_json
.
required
===
1
)
{
gadget
=
this
,
input
.
setAttribute
(
'
required
'
,
'
required
'
);
url
,
result
;
if
(
modification_dict
.
hasOwnProperty
(
'
editable
'
))
{
if
(
gadget
.
state
.
editable
)
{
url
=
'
gadget_html5_input.html
'
;
}
else
{
url
=
'
gadget_html5_element.html
'
;
}
}
if
(
field_json
.
editable
!==
1
)
{
result
=
this
.
declareGadget
(
url
,
{
scope
:
'
sub
'
})
input
.
setAttribute
(
'
readonly
'
,
'
readonly
'
);
.
push
(
function
(
input
)
{
input
.
setAttribute
(
'
data-wrapper-class
'
,
'
ui-state-readonly
'
);
// Clear first to DOM, append after to reduce flickering/manip
// input.setAttribute('disabled', 'disabled');
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
gadget
=
this
,
if
(
this
.
state
.
editable
)
{
input
=
gadget
.
element
.
querySelector
(
'
input
'
),
return
this
.
getDeclaredGadget
(
'
sub
'
)
file
=
input
.
files
[
0
];
.
push
(
function
(
gadget
)
{
if
(
file
===
undefined
)
{
return
gadget
.
getContent
();
return
{}
;
})
;
}
}
return
new
RSVP
.
Queue
()
return
{};
.
push
(
function
()
{
return
jIO
.
util
.
readBlobAsDataURL
(
file
);
})
})
.
push
(
function
(
evt
)
{
var
result
=
{};
.
declareMethod
(
'
getTextContent
'
,
function
()
{
result
[
input
.
getAttribute
(
'
name
'
)]
=
{
return
""
;
url
:
evt
.
target
.
result
,
})
file_name
:
file
.
name
};
.
declareMethod
(
'
checkValidity
'
,
function
()
{
return
result
;
if
(
this
.
state
.
editable
)
{
return
this
.
getDeclaredGadget
(
'
sub
'
)
.
push
(
function
(
gadget
)
{
return
gadget
.
checkValidity
();
});
});
}
return
true
;
});
});
}(
window
,
rJS
,
RSVP
,
jIO
));
}(
window
,
rJS
));
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_filefield_js.xml
View file @
0ca621e9
...
@@ -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
48.41920.59644.21196
</string>
</value>
<value>
<string>
9
54.47126.41874.54613
</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
53476561.59
</float>
<float>
14
76950143.07
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_html.html
View file @
0ca621e9
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
<!-- 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>
<script
src=
"jiodev.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<!-- custom script -->
<script
src=
"gadget_html5_input.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_html5_input.js"
type=
"text/javascript"
></script>
</head>
</head>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_html.xml
View file @
0ca621e9
...
@@ -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.
2976.31424.22323
</string>
</value>
<value>
<string>
954.
45675.44850.53452
</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>
147
5499560.34
</float>
<float>
147
6952312.41
</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 @
0ca621e9
/*global window, rJS, RSVP */
/*global window, rJS, RSVP
, jIO
*/
/*jslint indent: 2, maxerr: 3, maxlen: 80 */
/*jslint indent: 2, maxerr: 3, maxlen: 80 */
(
function
(
window
,
rJS
,
RSVP
)
{
(
function
(
window
,
rJS
,
RSVP
,
jIO
)
{
"
use strict
"
;
"
use strict
"
;
rJS
(
window
)
rJS
(
window
)
...
@@ -74,7 +74,21 @@
...
@@ -74,7 +74,21 @@
input
;
input
;
if
(
this
.
state
.
editable
)
{
if
(
this
.
state
.
editable
)
{
input
=
this
.
element
.
querySelector
(
'
input
'
);
input
=
this
.
element
.
querySelector
(
'
input
'
);
if
(
this
.
state
.
type
===
'
checkbox
'
)
{
if
(
this
.
state
.
type
===
'
file
'
)
{
if
(
input
.
files
[
0
]
!==
undefined
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
jIO
.
util
.
readBlobAsDataURL
(
input
.
files
[
0
]);
})
.
push
(
function
(
evt
)
{
result
[
input
.
getAttribute
(
'
name
'
)]
=
{
url
:
evt
.
target
.
result
,
file_name
:
input
.
files
[
0
].
name
};
return
result
;
});
}
}
else
if
(
this
.
state
.
type
===
'
checkbox
'
)
{
result
[
input
.
getAttribute
(
'
name
'
)]
=
(
input
.
checked
?
1
:
0
);
result
[
input
.
getAttribute
(
'
name
'
)]
=
(
input
.
checked
?
1
:
0
);
}
else
{
}
else
{
result
[
input
.
getAttribute
(
'
name
'
)]
=
input
.
value
;
result
[
input
.
getAttribute
(
'
name
'
)]
=
input
.
value
;
...
@@ -145,4 +159,4 @@
...
@@ -145,4 +159,4 @@
return
this
.
notifyInvalid
(
evt
.
target
.
validationMessage
);
return
this
.
notifyInvalid
(
evt
.
target
.
validationMessage
);
},
true
,
false
);
},
true
,
false
);
}(
window
,
rJS
,
RSVP
));
}(
window
,
rJS
,
RSVP
,
jIO
));
\ No newline at end of file
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_js.xml
View file @
0ca621e9
...
@@ -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.4
5675.44850.53452
</string>
</value>
<value>
<string>
954.4
7167.27024.21401
</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
869880.85
</float>
<float>
1476
952365.89
</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