diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/portal/static/src/xml | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/portal/static/src/xml')
| -rw-r--r-- | addons/portal/static/src/xml/portal_chatter.xml | 162 | ||||
| -rw-r--r-- | addons/portal/static/src/xml/portal_security.xml | 13 | ||||
| -rw-r--r-- | addons/portal/static/src/xml/portal_signature.xml | 35 |
3 files changed, 210 insertions, 0 deletions
diff --git a/addons/portal/static/src/xml/portal_chatter.xml b/addons/portal/static/src/xml/portal_chatter.xml new file mode 100644 index 00000000..ae3a2374 --- /dev/null +++ b/addons/portal/static/src/xml/portal_chatter.xml @@ -0,0 +1,162 @@ +<templates id="template" xml:space="preserve"> + + <t t-name="portal.chatter_message_count"> + <t t-set="count" t-value="widget.get('message_count')"/> + <div class="o_message_counter"> + <t t-if="count"> + <span class="fa fa-comments" /> + <span class="o_message_count"> <t t-esc="count"/></span> + <t t-if="count == 1">comment</t> + <t t-else="">comments</t> + </t> + <t t-else=""> + There are no comments for now. + </t> + </div> + </t> + + <!-- + Widget PortalComposer (standalone) + + required many options: token, res_model, res_id, ... + --> + <t t-name="portal.Composer"> + <div class="o_portal_chatter_composer" t-if="widget.options['allow_composer']"> + <t t-set="discussion_url" t-value="window.encodeURI(window.location.href.split('#')[0] + '#discussion')"/> + <t t-if="!widget.options['display_composer']"> + <h4>Leave a comment</h4> + <p>You must be <a t-attf-href="/web/login?redirect=#{discussion_url}">logged in</a> to post a comment.</p> + </t> + <t t-if="widget.options['display_composer']"> + <div class="media"> + <img alt="Avatar" class="o_portal_chatter_avatar" t-attf-src="/web/image/res.partner/#{widget.options['partner_id']}/image_128/50x50" + t-if="!widget.options['is_user_public'] or !widget.options['token']"/> + <div class="media-body"> + <form class="o_portal_chatter_composer_form" t-attf-action="/mail/chatter_post" method="POST"> + <input type="hidden" name="csrf_token" t-att-value="widget.options['csrf_token']"/> + <div class="mb32"> + <textarea rows="4" name="message" class="form-control" placeholder="Write a message..."></textarea> + <input type="hidden" name="res_model" t-att-value="widget.options['res_model']"/> + <input type="hidden" name="res_id" t-att-value="widget.options['res_id']"/> + <input type="hidden" name="token" t-att-value="widget.options['token']" t-if="widget.options['token']"/> + <input type='hidden' name="pid" t-att-value="widget.options['pid']" t-if="widget.options['pid']"/> + <input type='hidden' name="hash" t-att-value="widget.options['hash']" t-if="widget.options['hash']"/> + <input type="hidden" name="sha_in" t-att-value="widget.options['sha_in']" t-if="widget.options['sha_in']"/> + <input type="hidden" name="sha_time" t-att-value="widget.options['sha_time']" t-if="widget.options['sha_time']"/> + <input type="hidden" name="redirect" t-att-value="discussion_url"/> + <input type="hidden" name="attachment_ids" class="o_portal_chatter_attachment_ids"/> + <input type="hidden" name="attachment_tokens" class="o_portal_chatter_attachment_tokens"/> + <div class="alert alert-danger mt8 mb0 o_portal_chatter_composer_error" style="display:none;" role="alert"> + Oops! Something went wrong. Try to reload the page and log in. + </div> + <div class="o_portal_chatter_attachments mt-3"/> + <div class="mt8"> + <button t-attf-class="o_portal_chatter_composer_btn btn btn-primary" type="submit">Send</button> + <button class="o_portal_chatter_attachment_btn btn btn-secondary" type="button" title="Add attachment"> + <i class="fa fa-paperclip"/> + </button> + </div> + </div> + </form> + <form class="d-none"> + <input type="file" class="o_portal_chatter_file_input" multiple="multiple"/> + </form> + </div> + </div> + </t> + </div> + </t> + + <t t-name="portal.Chatter.Attachments"> + <div t-if="attachments.length" class="row"> + <div t-foreach="attachments" t-as="attachment" class="col-lg-2 col-md-3 col-sm-6"> + <div class="o_portal_chatter_attachment mb-2 position-relative text-center" t-att-data-id="attachment.id"> + <button t-if="showDelete and attachment.state == 'pending'" class="o_portal_chatter_attachment_delete btn btn-sm btn-outline-danger" title="Delete"> + <i class="fa fa-times"/> + </button> + <a t-attf-href="/web/content/#{attachment.id}?download=true&access_token=#{attachment.access_token}" target="_blank"> + <div class='oe_attachment_embedded o_image' t-att-title="attachment.name" t-att-data-mimetype="attachment.mimetype"/> + <div class='o_portal_chatter_attachment_name'><t t-esc='attachment.name'/></div> + </a> + </div> + </div> + </div> + </t> + + <!-- + Widget PortalChatter, and subtemplates + --> + + <t t-name="portal.chatter_messages"> + <div class="o_portal_chatter_messages"> + <t t-foreach="widget.get('messages') || []" t-as="message"> + <div class="media o_portal_chatter_message" t-att-id="'message-' + message.id"> + <img class="o_portal_chatter_avatar" t-att-src="message.author_avatar_url" alt="avatar"/> + <div class="media-body"> + <t t-call="portal.chatter_internal_toggle" t-if="widget.options['is_user_employee']"/> + + <div class="o_portal_chatter_message_title"> + <h5 class='mb-1'><t t-esc="message.author_id[1]"/></h5> + <p class="o_portal_chatter_puslished_date"><t t-esc="message.published_date_str"/></p> + </div> + <t t-raw="message.body"/> + + <div class="o_portal_chatter_attachments"> + <t t-call="portal.Chatter.Attachments"> + <t t-set="attachments" t-value="message.attachment_ids"/> + </t> + </div> + </div> + </div> + </t> + </div> + </t> + + <!-- Chatter: internal toggle widget --> + <t t-name="portal.chatter_internal_toggle"> + <div t-attf-class="float-right o_portal_chatter_js_is_internal #{message.is_internal and 'o_portal_message_internal_on' or 'o_portal_message_internal_off'}" + t-att-data-message-id="message.id" + t-att-data-is-internal="message.is_internal"> + <button class="btn btn-danger" + title="Currently restricted to internal employees, click to make it available to everyone viewing this document.">Employees Only</button> + <button class="btn btn-success" + title="Currently available to everyone viewing this document, click to restrict to internal employees.">Visible</button> + </div> + </t> + + <t t-name="portal.pager"> + <div class="o_portal_chatter_pager"> + <t t-if="!_.isEmpty(widget.get('pager'))"> + <ul class="pagination" t-if="widget.get('pager')['pages'].length > 1"> + <li t-if="widget.get('pager')['page'] != widget.get('pager')['page_previous']" t-att-data-page="widget.get('pager')['page_previous']" class="page-item o_portal_chatter_pager_btn"> + <a href="#" class="page-link"><i class="fa fa-chevron-left" role="img" aria-label="Previous" title="Previous"/></a> + </li> + <t t-foreach="widget.get('pager')['pages']" t-as="page"> + <li t-att-data-page="page" t-attf-class="page-item #{page == widget.get('pager')['page'] ? 'o_portal_chatter_pager_btn active' : 'o_portal_chatter_pager_btn'}"> + <a href="#" class="page-link"><t t-esc="page"/></a> + </li> + </t> + <li t-if="widget.get('pager')['page'] != widget.get('pager')['page_next']" t-att-data-page="widget.get('pager')['page_next']" class="page-item o_portal_chatter_pager_btn"> + <a href="#" class="page-link"><i class="fa fa-chevron-right" role="img" aria-label="Next" title="Next"/></a> + </li> + </ul> + </t> + </div> + </t> + + <t t-name="portal.Chatter"> + <div class="o_portal_chatter p-0"> + <div class="o_portal_chatter_header"> + <t t-call="portal.chatter_message_count"/> + </div> + <hr t-if="widget.options['allow_composer']"/> + <div class="o_portal_chatter_composer"/> + <hr/> + <t t-call="portal.chatter_messages"/> + <div class="o_portal_chatter_footer"> + <t t-call="portal.pager"/> + </div> + </div> + </t> + +</templates> diff --git a/addons/portal/static/src/xml/portal_security.xml b/addons/portal/static/src/xml/portal_security.xml new file mode 100644 index 00000000..ff5e62e8 --- /dev/null +++ b/addons/portal/static/src/xml/portal_security.xml @@ -0,0 +1,13 @@ +<templates xml:space="preserve"> + <t t-name="portal.identitycheck"> + <form string="Security Control"> + <h3><strong>Please confirm your password to continue</strong></h3> + <p>This is necessary for security-related changes. The authorization will last for a few minutes.</p> + <div> + <label for="password" class="col-4 col-md-12 px-0">Password</label> + <input class="form-control col-10 col-md-6" autocomplete="current-password" + name="password" type="password" required="required"/> + </div> + </form> + </t> +</templates> diff --git a/addons/portal/static/src/xml/portal_signature.xml b/addons/portal/static/src/xml/portal_signature.xml new file mode 100644 index 00000000..43456d9c --- /dev/null +++ b/addons/portal/static/src/xml/portal_signature.xml @@ -0,0 +1,35 @@ +<templates id="template" xml:space="preserve"> + + <!-- Template for the widget SignatureForm. --> + <t t-name="portal.portal_signature"> + <form method="POST"> + <input type="hidden" name="csrf_token" t-att-value="widget.csrf_token"/> + <div class="o_web_sign_name_and_signature"/> + <div class="o_portal_sign_controls my-3"> + <div class="text-right my-3"> + <button type="submit" class="o_portal_sign_submit btn btn-primary" disabled="disabled"> + <i class="fa fa-check"/> + <t t-esc="widget.sendLabel"/> + </button> + </div> + </div> + </form> + </t> + <!-- Template when the sign rpc is successful. --> + <t t-name="portal.portal_signature_success"> + <div class="alert alert-success" role="status"> + <span t-if="widget.message" t-esc="widget.message"/> + <span t-else="">Thank You!</span> + <a t-if="widget.redirect_url" t-att-href="widget.redirect_url"> + <t t-if="widget.redirect_message" t-esc="widget.redirect_message"/> + <t t-else="">Click here to see your document.</t> + </a> + </div> + </t> + <!-- Template when the sign rpc returns an error. --> + <t t-name="portal.portal_signature_error"> + <div class="o_portal_sign_error_msg alert alert-danger" role="status"> + <t t-esc="widget.error"/> + </div> + </t> +</templates> |
