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

Button isLoading added in template code

Added translations isloading
  • Loading branch information
mrsaicharan1 committed Apr 8, 2019
1 parent 6e31c41 commit cd40f11
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions app/controllers/admin/content/translations.js
@@ -0,0 +1,20 @@
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(e => {
console.warn(e);
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 class="ui primary {{if isLoading 'loading'}} button" href="{{language.sourceUrl}}" {{action 'translationsDownload'}}>{{t 'Download' }}</button>
</div>
</div>
{{/each}}
Expand Down

0 comments on commit cd40f11

Please sign in to comment.