Skip to content

Commit

Permalink
Action implemented for translations download
Browse files Browse the repository at this point in the history
Initialized isLoading

setting isLoading to False finally

moving logic to controller file

removed redundant variable assignments
  • Loading branch information
mrsaicharan1 committed Apr 8, 2019
1 parent 6e31c41 commit 436afd2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions app/controllers/admin/content/translations.js
@@ -0,0 +1,19 @@
import Controller from '@ember/controller';

export default Controller.extend({
isLoading: false,

actions: {
translationsDownload() {
this.set('isLoading', true);
this.get('loader')
.load('/admin/content/translations/all')
.catch(() => {
this.get('notify').error(this.get('l10n').t('Unexpected error occurred.'));
})
.finally(() => {
this.set('isLoading', false);
});
}
}
});
2 changes: 1 addition & 1 deletion app/routes/admin/content/translations.js
Expand Up @@ -9,7 +9,7 @@ export default Route.extend({
return [
{
code : 'en',
sourceUrl : this.get('loader').load('/admin/content/translations/all')
sourceUrl : '#'
}
];
}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/admin/content/translations.hbs
Expand Up @@ -16,7 +16,7 @@
{{get l10n.availableLocales language.code}}
</div>
<div class="column eight wide">
<a href="{{language.sourceUrl}}">{{t 'Download'}}</a>
<button href="{{language.sourceUrl}}" {{action 'translationsDownload'}}>{{t 'Download' }}</a>
</div>
</div>
{{/each}}
Expand Down

0 comments on commit 436afd2

Please sign in to comment.