This commit is contained in:
parent
f1988c544b
commit
be99dc0902
6 changed files with 75 additions and 88 deletions
27
src/web/app/desktop/mixins/widget.js
Normal file
27
src/web/app/desktop/mixins/widget.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import * as riot from 'riot';
|
||||
|
||||
// ミックスインにオプションを渡せないのアレ
|
||||
// SEE: https://github.com/riot/riot/issues/2434
|
||||
|
||||
riot.mixin('widget', {
|
||||
init: function() {
|
||||
this.mixin('i');
|
||||
this.mixin('api');
|
||||
|
||||
this.id = this.opts.id;
|
||||
|
||||
Object.keys(this.data).forEach(prop => {
|
||||
this.data[prop] = this.opts.data.hasOwnProperty(prop) ? this.opts.data[prop] : this.data[prop];
|
||||
});
|
||||
},
|
||||
|
||||
save: function() {
|
||||
this.api('i/update_home', {
|
||||
id: this.id,
|
||||
data: this.data
|
||||
}).then(() => {
|
||||
this.I.client_settings.home.find(w => w.id == this.id).data = this.data;
|
||||
this.I.update();
|
||||
});
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue