-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
GitHub Actions Bot
committed
Jul 2, 2023
1 parent
ed38f07
commit 6e6123f
Showing
11 changed files
with
31 additions
and
155 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
src/Resources/public/administration/css/frosh-platform-thumbnail-processor.css
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
src/Resources/public/administration/js/frosh-platform-thumbnail-processor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(()=>{var a=`{% block frosh_thumbnail_processor_info_texts %} | ||
<div class="frosh-thumbnail-processor-info-texts"> | ||
<p> | ||
Hint: You can set the configuration per SalesChannel and you don't need to use all variables. | ||
</p> | ||
<p> | ||
Available variables for the ThumbnailPattern:<br> | ||
<b>{mediaUrl}</b>: e.g. https://cdn.test.de/<br> | ||
<b>{mediaPath}</b>: e.g. media/image/5b/6d/16/tea.png<br> | ||
<b>{width}</b>: e.g. 800 | ||
</p> | ||
<p> | ||
Find patterns in the discussion category 'Patterns' of the GitHub repository:<br> | ||
<a href="https://github.com/FriendsOfShopware/FroshPlatformThumbnailProcessor/discussions/categories/patterns" target="_blank"> | ||
GitHub Category 'Patterns' | ||
</a> | ||
</p> | ||
</div> | ||
{% endblock %} | ||
`;var{Component:u}=Shopware;u.register("frosh-thumbnail-processor-info-texts",{template:a});var l=`<div> | ||
<sw-button-process | ||
:isLoading="isLoading" | ||
:processSuccess="isSuccessful" | ||
@process-finish="finish" | ||
@click="saveAndCheck" | ||
>{{ btnLabel }}</sw-button-process> | ||
</div> | ||
`;var{Component:d,Mixin:f}=Shopware;d.register("thumbnailprocessor-test",{template:l,props:["btnLabel"],inject:["thumbnailProcessorTest"],mixins:[f.getByName("notification")],data(){return{isLoading:!1,isSuccessful:!1}},computed:{pluginSalesChannelId(){let e=this.$parent;for(let t=0;t<20;t++){if(typeof e.currentSalesChannelId<"u")return e.currentSalesChannelId;e=e.$parent}throw"Can not get pluginConfigData"}},methods:{finish(){this.isSuccessful=!1},showError(e,t){this.isSuccessful=!1,t&&(e+=" sample url: "+t),this.createNotificationError({title:this.$tc("thumbnail-processor.test.title"),message:e})},saveAndCheck(){this.isLoading=!0,this.systemConfigSaveAll()},check(){let e=this;e.thumbnailProcessorTest.getUrl(this.pluginSalesChannelId).then(t=>{if(t.url){e.isSuccessful=!0;let s=document.createElement("img");s.width=200,s.height=200,s.onload=function(){s.naturalWidth!==200&&e.showError(e.$tc("thumbnail-processor.test.error.noResize"),t.url)},s.onerror=function(){e.showError(e.$tc("thumbnail-processor.test.error.general"),t.url)},s.src=t.url;let r=document.querySelector('[name="FroshPlatformThumbnailProcessor.config.test"]'),n=r.querySelector(".frosh-thumbnail-processor-testimage img");if(n)n.replaceWith(s);else{let i=document.createElement("p");i.classList.add("frosh-thumbnail-processor-testimage"),i.appendChild(s),r.appendChild(i)}}else e.showError(e.$tc("thumbnail-processor.test.error.general"));setTimeout(()=>{this.isLoading=!1},2500)})},systemConfigSaveAll(){let e=this,t=this.$parent;for(let s=0;s<30;s++){if(typeof t.$refs.systemConfig<"u")return t.$refs.systemConfig.saveAll().then(()=>{e.check()});t=t.$parent}throw"Can not get systemConfig"}}});var c=Shopware.Classes.ApiService,{Application:h}=Shopware,o=class extends c{constructor(t,s,r="thumbnail-processor-test"){super(t,s,r)}getUrl(t){let s=this.getBasicHeaders({});return this.httpClient.post(`_action/${this.getApiBasePath()}/get-sample-image`,{salesChannelId:t},{headers:s}).then(r=>c.handleResponse(r))}};h.addServiceProvider("thumbnailProcessorTest",e=>{let t=h.getContainer("init");return new o(t.httpClient,e.loginService)});})(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.