Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
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 @@
...
@@ -28,11 +28,15 @@
<p
style=
"background-color:#0E81C2;color:white;margin:1em 0;padding:0.5em"
>
Comments:
</p>
<p
style=
"background-color:#0E81C2;color:white;margin:1em 0;padding:0.5em"
>
Comments:
</p>
<ol
id=
"post_list"
></ol>
<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>
<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"
>
<div
id=
"file_upload_div"
>
<input
value=
""
name=
"attachment"
id=
"attachment"
type=
"file"
title=
"Upload"
>
<input
value=
""
name=
"attachment"
id=
"attachment"
type=
"file"
title=
"Upload"
>
</div>
</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>
</form>
</div>
</div>
</body>
</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 @@
...
@@ -252,8 +252,8 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15
06616673.69
</float>
<float>
15
38885951.97
</float>
<string>
UTC
</string>
<string>
GMT+9
</string>
</tuple>
</tuple>
</state>
</state>
</object>
</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 @@
...
@@ -67,16 +67,24 @@
});
});
})
})
.
onStateChange
(
function
()
{
.
onStateChange
(
function
()
{
/** @type {GadgetInstance} */
var
gadget
=
this
;
var
gadget
=
this
;
// render the erp5 form
// render the erp5 form
return
this
.
getDeclaredGadget
(
"
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
,
var
form_options
=
gadget
.
state
.
erp5_form
,
rendered_form
=
gadget
.
state
.
erp5_document
.
_embedded
.
_view
,
rendered_form
=
gadget
.
state
.
erp5_document
.
_embedded
.
_view
,
rendered_field
,
rendered_field
,
key
;
key
,
editor
=
gadgets
[
0
],
erp5_form
=
gadgets
[
1
];
// Remove all empty fields, and mark all others as non editable
// Remove all empty fields, and mark all others as non editable
for
(
key
in
rendered_form
)
{
for
(
key
in
rendered_form
)
{
if
(
rendered_form
.
hasOwnProperty
(
key
)
&&
(
key
[
0
]
!==
"
_
"
))
{
if
(
rendered_form
.
hasOwnProperty
(
key
)
&&
(
key
[
0
]
!==
"
_
"
))
{
...
@@ -94,12 +102,32 @@
...
@@ -94,12 +102,32 @@
form_options
.
form_definition
=
gadget
.
state
.
form_definition
;
form_options
.
form_definition
=
gadget
.
state
.
form_definition
;
form_options
.
view
=
gadget
.
state
.
view
;
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
// render the header
.
push
(
function
()
{
.
push
(
function
()
{
return
RSVP
.
all
([
return
Promise
.
all
([
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
editable
:
true
}}),
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
editable
:
true
}}),
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
"
action
"
}}),
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
"
action
"
}}),
gadget
.
getUrlFor
({
command
:
'
history_previous
'
}),
gadget
.
getUrlFor
({
command
:
'
history_previous
'
}),
...
@@ -131,10 +159,9 @@
...
@@ -131,10 +159,9 @@
);
);
})
})
.
push
(
function
(
post_list
)
{
.
push
(
function
(
post_list
)
{
var
i
,
// XXX abbreviation
var
queue_list
=
[];
queue_list
=
[];
if
(
post_list
.
length
)
{
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
)
{
if
(
post_list
[
i
][
3
]
!==
null
&&
post_list
[
i
][
3
].
indexOf
(
"
image_module
"
)
!==
-
1
)
{
queue_list
.
push
(
gadget
.
getImageUrl
(
post_list
[
i
][
3
]));
queue_list
.
push
(
gadget
.
getImageUrl
(
post_list
[
i
][
3
]));
}
else
if
(
post_list
[
i
][
3
]
!==
null
&&
post_list
[
i
][
3
].
indexOf
(
"
document_module
"
)
!==
-
1
)
{
}
else
if
(
post_list
[
i
][
3
]
!==
null
&&
post_list
[
i
][
3
].
indexOf
(
"
document_module
"
)
!==
-
1
)
{
...
@@ -187,9 +214,13 @@
...
@@ -187,9 +214,13 @@
var
gadget
=
this
,
var
gadget
=
this
,
submitButton
=
null
,
submitButton
=
null
,
queue
=
null
,
queue
=
null
,
editor
=
gadget
.
element
.
querySelector
(
'
#comment
'
);
editor
=
null
;
return
gadget
.
getDeclaredGadget
(
"
editor
"
)
if
(
editor
.
value
===
''
)
{
.
then
(
function
(
e
)
{
editor
=
e
;
return
e
.
getContent
();
})
.
then
(
function
(
content
)
{
if
(
content
.
comment
===
''
)
{
return
gadget
.
notifySubmitted
({
message
:
"
Post content can not be empty!
"
});
return
gadget
.
notifySubmitted
({
message
:
"
Post content can not be empty!
"
});
}
}
...
@@ -206,7 +237,7 @@
...
@@ -206,7 +237,7 @@
data
=
new
FormData
();
data
=
new
FormData
();
data
.
append
(
"
follow_up
"
,
gadget
.
options
.
jio_key
);
data
.
append
(
"
follow_up
"
,
gadget
.
options
.
jio_key
);
data
.
append
(
"
predecessor
"
,
''
);
data
.
append
(
"
predecessor
"
,
''
);
data
.
append
(
"
data
"
,
editor
.
value
);
data
.
append
(
"
data
"
,
content
.
comment
);
data
.
append
(
"
file
"
,
file_blob
);
data
.
append
(
"
file
"
,
file_blob
);
// XXX: Hack, call jIO.util.ajax directly to pass the file blob
// XXX: Hack, call jIO.util.ajax directly to pass the file blob
// Because the jio_putAttachment will call readBlobAsText, which
// Because the jio_putAttachment will call readBlobAsText, which
...
@@ -225,12 +256,16 @@
...
@@ -225,12 +256,16 @@
return
gadget
.
notifySubmitted
({
message
:
"
Comment added
"
,
status
:
"
success
"
});
return
gadget
.
notifySubmitted
({
message
:
"
Comment added
"
,
status
:
"
success
"
});
})
})
.
push
(
function
()
{
.
push
(
function
()
{
editor
.
value
=
''
;
editor
.
changeState
({
value
:
''
})
return
gadget
.
redirect
({
command
:
'
reload
'
});
.
push
(
function
(){
return
gadget
.
redirect
({
command
:
'
reload
'
});
})
});
});
queue
.
then
(
enableSubmitButton
,
enableSubmitButton
);
queue
.
then
(
enableSubmitButton
,
enableSubmitButton
);
return
queue
;
return
queue
;
})
})
}
)
.
onEvent
(
'
submit
'
,
function
()
{
.
onEvent
(
'
submit
'
,
function
()
{
this
.
submitPostComment
();
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 @@
...
@@ -252,8 +252,8 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15
07898069.5
</float>
<float>
15
38886067.22
</float>
<string>
UTC
</string>
<string>
GMT+9
</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