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
1
Merge Requests
1
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
Vincent Bechu
erp5
Commits
a949f63f
Commit
a949f63f
authored
Oct 07, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
officejs_support_request_ui: post comments as HTML with editor
parent
578c1a32
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
21 deletions
+60
-21
bt5/erp5_officejs_support_request_ui/PathTemplateItem/web_page_module/gadget_supportrequest_pt_form_view_discussable_html.html
.../gadget_supportrequest_pt_form_view_discussable_html.html
+6
-2
bt5/erp5_officejs_support_request_ui/PathTemplateItem/web_page_module/gadget_supportrequest_pt_form_view_discussable_html.xml
...e/gadget_supportrequest_pt_form_view_discussable_html.xml
+2
-2
bt5/erp5_officejs_support_request_ui/PathTemplateItem/web_page_module/gadget_supportrequest_pt_form_view_discussable_js.js
...dule/gadget_supportrequest_pt_form_view_discussable_js.js
+50
-15
bt5/erp5_officejs_support_request_ui/PathTemplateItem/web_page_module/gadget_supportrequest_pt_form_view_discussable_js.xml
...ule/gadget_supportrequest_pt_form_view_discussable_js.xml
+2
-2
No files found.
bt5/erp5_officejs_support_request_ui/PathTemplateItem/web_page_module/gadget_supportrequest_pt_form_view_discussable_html.html
View file @
a949f63f
...
...
@@ -28,11 +28,15 @@
<p
style=
"background-color:#0E81C2;color:white;margin:1em 0;padding:0.5em"
>
Comments:
</p>
<ol
id=
"post_list"
></ol>
<h3
class=
"ui-content-title ui-body-c ui-icon ui-icon-custom ui-icon-random"
id=
"comment-title"
name=
"comment-title"
>
Post a comment
</h3>
<textarea
id=
"comment"
name=
"comment"
placeholder=
"Enter your comment here..."
></textarea>
<div
data-gadget-url=
"gadget_editor.html"
data-gadget-scope=
"editor"
data-gadget-sandbox=
""
>
</div>
<div
id=
"file_upload_div"
>
<input
value=
""
name=
"attachment"
id=
"attachment"
type=
"file"
title=
"Upload"
>
</div>
<input
data-theme=
"b"
data-inline=
"true"
type=
"submit"
data-i18n=
"[value]Post Comment"
value=
"Post Comment"
data-icon=
"check"
/>
<input
data-theme=
"b"
data-inline=
"true"
type=
"submit"
data-i18n=
"[value]Post Comment"
value=
"Post Comment"
data-icon=
"check"
disabled
class=
"ui-disabled"
/>
</form>
</div>
</body>
...
...
bt5/erp5_officejs_support_request_ui/PathTemplateItem/web_page_module/gadget_supportrequest_pt_form_view_discussable_html.xml
View file @
a949f63f
...
...
@@ -252,8 +252,8 @@
</tuple>
<state>
<tuple>
<float>
15
06616673.69
</float>
<string>
UTC
</string>
<float>
15
38885951.97
</float>
<string>
GMT+9
</string>
</tuple>
</state>
</object>
...
...
bt5/erp5_officejs_support_request_ui/PathTemplateItem/web_page_module/gadget_supportrequest_pt_form_view_discussable_js.js
View file @
a949f63f
...
...
@@ -67,16 +67,24 @@
});
})
.
onStateChange
(
function
()
{
/** @type {GadgetInstance} */
var
gadget
=
this
;
// render the erp5 form
return
this
.
getDeclaredGadget
(
"
erp5_form
"
)
.
push
(
function
(
erp5_form
)
{
.
push
(
function
(
erp5_form
)
{
return
gadget
.
getDeclaredGadget
(
"
editor
"
)
.
push
(
function
(
editor
)
{
return
[
editor
,
erp5_form
];
})
})
.
push
(
function
(
gadgets
)
{
var
form_options
=
gadget
.
state
.
erp5_form
,
rendered_form
=
gadget
.
state
.
erp5_document
.
_embedded
.
_view
,
rendered_field
,
key
;
key
,
editor
=
gadgets
[
0
],
erp5_form
=
gadgets
[
1
];
// Remove all empty fields, and mark all others as non editable
for
(
key
in
rendered_form
)
{
if
(
rendered_form
.
hasOwnProperty
(
key
)
&&
(
key
[
0
]
!==
"
_
"
))
{
...
...
@@ -94,12 +102,32 @@
form_options
.
form_definition
=
gadget
.
state
.
form_definition
;
form_options
.
view
=
gadget
.
state
.
view
;
return
erp5_form
.
render
(
form_options
);
})
return
gadget
.
jio_getAttachment
(
'
post_module
'
,
gadget
.
hateoas_url
+
gadget
.
options
.
jio_key
+
"
/Base_getEditorFieldPreferredTextEditor
"
,
{
format
:
"
text
"
}
).
push
(
function
(
preferred_editor
)
{
return
Promise
.
all
([
erp5_form
.
render
(
form_options
),
editor
.
render
({
value
:
""
,
key
:
"
comment
"
,
portal_type
:
"
HTML Post
"
,
editable
:
true
,
editor
:
preferred_editor
})]).
then
(
function
(){
// make our submit button editable
var
element
=
/** @type {HTMLInputElement} */
(
gadget
.
element
.
querySelector
(
'
input[type="submit"]
'
));
element
.
removeAttribute
(
'
disabled
'
);
element
.
classList
.
remove
(
'
ui-disabled
'
);
});
})
})
// render the header
.
push
(
function
()
{
return
RSVP
.
all
([
return
Promise
.
all
([
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
editable
:
true
}}),
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
"
action
"
}}),
gadget
.
getUrlFor
({
command
:
'
history_previous
'
}),
...
...
@@ -131,10 +159,9 @@
);
})
.
push
(
function
(
post_list
)
{
var
i
,
// XXX abbreviation
queue_list
=
[];
var
queue_list
=
[];
if
(
post_list
.
length
)
{
for
(
i
=
0
;
i
<
post_list
.
length
;
i
+=
1
)
{
for
(
var
i
=
0
;
i
<
post_list
.
length
;
i
+=
1
)
{
if
(
post_list
[
i
][
3
]
!==
null
&&
post_list
[
i
][
3
].
indexOf
(
"
image_module
"
)
!==
-
1
)
{
queue_list
.
push
(
gadget
.
getImageUrl
(
post_list
[
i
][
3
]));
}
else
if
(
post_list
[
i
][
3
]
!==
null
&&
post_list
[
i
][
3
].
indexOf
(
"
document_module
"
)
!==
-
1
)
{
...
...
@@ -187,9 +214,13 @@
var
gadget
=
this
,
submitButton
=
null
,
queue
=
null
,
editor
=
gadget
.
element
.
querySelector
(
'
#comment
'
);
if
(
editor
.
value
===
''
)
{
editor
=
null
;
return
gadget
.
getDeclaredGadget
(
"
editor
"
)
.
then
(
function
(
e
)
{
editor
=
e
;
return
e
.
getContent
();
})
.
then
(
function
(
content
)
{
if
(
content
.
comment
===
''
)
{
return
gadget
.
notifySubmitted
({
message
:
"
Post content can not be empty!
"
});
}
...
...
@@ -206,7 +237,7 @@
data
=
new
FormData
();
data
.
append
(
"
follow_up
"
,
gadget
.
options
.
jio_key
);
data
.
append
(
"
predecessor
"
,
''
);
data
.
append
(
"
data
"
,
editor
.
value
);
data
.
append
(
"
data
"
,
content
.
comment
);
data
.
append
(
"
file
"
,
file_blob
);
// XXX: Hack, call jIO.util.ajax directly to pass the file blob
// Because the jio_putAttachment will call readBlobAsText, which
...
...
@@ -225,12 +256,16 @@
return
gadget
.
notifySubmitted
({
message
:
"
Comment added
"
,
status
:
"
success
"
});
})
.
push
(
function
()
{
editor
.
value
=
''
;
return
gadget
.
redirect
({
command
:
'
reload
'
});
editor
.
changeState
({
value
:
''
})
.
push
(
function
(){
return
gadget
.
redirect
({
command
:
'
reload
'
});
})
});
queue
.
then
(
enableSubmitButton
,
enableSubmitButton
);
return
queue
;
})
}
)
.
onEvent
(
'
submit
'
,
function
()
{
this
.
submitPostComment
();
});
...
...
bt5/erp5_officejs_support_request_ui/PathTemplateItem/web_page_module/gadget_supportrequest_pt_form_view_discussable_js.xml
View file @
a949f63f
...
...
@@ -252,8 +252,8 @@
</tuple>
<state>
<tuple>
<float>
15
07898069.5
</float>
<string>
UTC
</string>
<float>
15
38886067.22
</float>
<string>
GMT+9
</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