fix #644: plugin gallery load button

This commit is contained in:
antelle 2017-05-28 17:03:10 +02:00
parent 413b643d4b
commit 196bb3385b
4 changed files with 16 additions and 2 deletions

View File

@ -477,6 +477,7 @@
"setPlTranslate": "Or you can {}",
"setPlTranslateLink": "translate the app to your language",
"setPlAutoUpdate": "Update automatically",
"setPlLoadGallery": "Load plugin gallery",
"setAboutTitle": "About",
"setAboutBuilt": "This app is built with these awesome tools",

View File

@ -28,7 +28,8 @@ const SettingsPluginsView = Backbone.View.extend({
'change select.settings__plugins-plugin-input': 'pluginSettingChange',
'change input[type=checkbox].settings__plugins-plugin-input': 'pluginSettingChange',
'input input[type=text].settings__plugins-plugin-input': 'pluginSettingChange',
'change .settings__plugins-plugin-updates': 'autoUpdateChange'
'change .settings__plugins-plugin-updates': 'autoUpdateChange',
'click .settings__plugins-gallery-load-btn': 'loadPluginGalleryClick'
},
searchStr: null,
@ -39,7 +40,6 @@ const SettingsPluginsView = Backbone.View.extend({
initialize() {
this.listenTo(PluginManager, 'change', this.render.bind(this));
this.listenTo(Backbone, 'plugin-gallery-load-complete', this.render.bind(this));
PluginGallery.loadPlugins();
},
render() {
@ -108,6 +108,14 @@ const SettingsPluginsView = Backbone.View.extend({
return true;
},
loadPluginGalleryClick() {
if (PluginGallery.loading) {
return;
}
PluginGallery.loadPlugins();
this.render();
},
installClick() {
const installBtn = this.$el.find('.settings_plugins-install-btn');
const urlTextBox = this.$el.find('#settings__plugins-install-url');

View File

@ -200,6 +200,9 @@
display: flex;
flex-wrap: wrap;
}
&-gallery-load-btn {
margin-top: $base-padding-h;
}
&-gallery-plugin {
position: relative;
width: calc(50% - 40px);

View File

@ -149,6 +149,8 @@
</div>
{{/each}}
</div>
{{else}}
<button class="settings__plugins-gallery-load-btn" {{#if galleryLoading}}disabled="disabled"{{/if}}>{{res 'setPlLoadGallery'}}</button>
{{/if}}
</div>
<h2>{{res 'setPlInstallUrlTitle'}}</h2>