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/web_unsplash/static/src/xml | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/web_unsplash/static/src/xml')
| -rw-r--r-- | addons/web_unsplash/static/src/xml/unsplash_image_widget.xml | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/addons/web_unsplash/static/src/xml/unsplash_image_widget.xml b/addons/web_unsplash/static/src/xml/unsplash_image_widget.xml new file mode 100644 index 00000000..0bd4a70f --- /dev/null +++ b/addons/web_unsplash/static/src/xml/unsplash_image_widget.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="utf-8"?> +<templates id="template" xml:space="preserve"> + +<t t-extend="wysiwyg.widgets.file"> + <t t-jquery=".o_we_load_more" t-operation="after"> + <div class="unsplash_error"></div> + </t> +</t> +<t t-extend="wysiwyg.widgets.image"> + <t t-jquery="option[value='media-library']" t-operation="after"> + <option value="unsplash">Photos (via Unsplash)</option> + </t> +</t> +<t t-extend="wysiwyg.widgets.image.existing.attachments"> + <t t-jquery="t[t-foreach='libraryMedia']" t-operation="after"> + <t t-if="['all', 'unsplash'].includes(widget.searchService)" t-foreach="widget.unsplashRecords" t-as="record"> + <t t-call="web_unsplash.dialog.image.content"/> + </t> + </t> +</t> + +<t t-name="web_unsplash.dialog.image.content"> + <div class="o_existing_attachment_cell o_unsplash_attachment_cell position-relative align-items-center justify-content-center bg-light" t-att-data-imgid="record.id" t-att-data-id="record.id" t-att-data-url="record.urls.regular" t-att-data-download-url="record.links.download_location" t-att-data-description="record.alt_description"> + <img class="img img-fluid o_we_attachment_highlight" t-att-src="record.url" t-att-alt="record.alt_description" style="max-height: 100%;"/> + <a class="o_we_media_author" t-att-href="record.user.links.html" target="_blank" t-esc="record.user.name" t-att-title="record.user.name"/> + </div> +</t> + +<t t-name="web_unsplash.dialog.error.credentials"> + <h4><t t-esc="title"/></h4> + <div class="details"> + <t t-esc="subtitle"/> + <div class="form-group mt-4 access_key_box"> + <input type="text" class="form-control w-100" id="accessKeyInput" placeholder="Paste your access key here"/> + </div> + <a href="https://www.odoo.com/documentation/14.0/applications/general/unsplash/unsplash_access_key.html" target="_blank"><i class="fa fa-arrow-right"/> Generate an access key</a> + <div class="form-group mt-4 access_key_box"> + <input type="text" class="form-control w-100" id="appIdInput" placeholder="Paste your application ID here"/> + </div> + <a href="https://www.odoo.com/documentation/14.0/applications/general/unsplash/unsplash_application_id.html" target="_blank"> + <i class="fa fa-arrow-right"/> How to find my Unsplash Application ID?</a> + <button type="button" class="btn btn-primary btn-block mt-4 save_unsplash">Apply</button> + </div> +</t> + +<t t-name="web_unsplash.dialog.error.content"> + <div class="d-flex mt-2 unsplash_error"> + <div class="mx-auto text-center"> + <t t-if="status == 'key_not_found'"> + <t t-call="web_unsplash.dialog.error.credentials"> + <t t-set="title"> + Unsplash requires an access key and an application ID + </t> + </t> + </t> + <t t-elif="status == 403"> + <h4 class="text-muted"> + Search is temporarily unavailable + </h4> + <div class="details"> + The max number of searches is exceeded. Please retry in an hour or extend to a better account. + </div> + </t> + <t t-elif="status == 401"> + <t t-call="web_unsplash.dialog.error.credentials"> + <t t-set="title"> + Unauthorized Key + </t> + <t t-set="subtitle"> + Please check your Unsplash access key and application ID. + </t> + </t> + </t> + <t t-else=""> + <h4 class="text-muted"> + Something went wrong + </h4> + <div class="details"> + Please check your internet connection or contact administrator. + </div> + </t> + </div> + </div> +</t> + +</templates> |
