Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translations download as zip(.po files) button fix #2445

Merged
merged 6 commits into from Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions app/controllers/admin/content/translations.js
@@ -0,0 +1,23 @@
import Controller from '@ember/controller';

export default Controller.extend({
isLoading: false,

actions: {
translationsDownload() {
this.set('isLoading', true);
this.get('loader')
.downloadFile('/admin/content/translations/all')
.then(() => {
this.get('notify').success(this.get('l10n').t('Translations Zip generated successfully.'));
})
.catch(e => {
console.warn(e);
this.get('notify').error(this.get('l10n').t('Unexpected error occurred.'));
})
.finally(() => {
this.set('isLoading', false);
});
}
}
});
4 changes: 2 additions & 2 deletions app/templates/admin/content/translations.hbs
Expand Up @@ -7,7 +7,7 @@
<h4 class="ui header">{{t 'Language'}}</h4>
</div>
<div class="column eight wide">
<h4 class="ui header">{{t 'Download .PO files'}}</h4>
<h4 class="ui header"> <a href="{{translations.sourceUrl}}">{{t 'Download .PO files'}}</a></h4>
</div>
</div>
{{#each model as |language|}}
Expand All @@ -16,7 +16,7 @@
{{get l10n.availableLocales language.code}}
</div>
<div class="column eight wide">
<a href="{{language.sourceUrl}}">{{t 'Download'}}</a>
<button class="ui primary {{if isLoading 'loading'}} button" href="{{language.sourceUrl}}" {{action 'translationsDownload'}}>{{t 'Download' }}</button>
</div>
</div>
{{/each}}
Expand Down