Przeglądaj źródła

fix: Delete Card and Shortcut

version-14
shariquerik 4 lat temu
rodzic
commit
788c511274
3 zmienionych plików z 23 dodań i 12 usunięć
  1. +8
    -5
      frappe/public/js/frappe/widgets/widget_group.js
  2. +7
    -3
      frappe/public/js/frappe/wiki_blocks/card.js
  3. +8
    -4
      frappe/public/js/frappe/wiki_blocks/shortcut.js

+ 8
- 5
frappe/public/js/frappe/widgets/widget_group.js Wyświetl plik

@@ -205,18 +205,21 @@ export class SingleWidgetGroup {
widget_type: this.type,
container: this.container,
height: this.height || null,
options: {
...this.options,
on_delete: (name) => this.on_delete(name),
},
});

widget_object.options = {
...this.options,
on_delete: (name) => this.on_delete(name)
};
this.widgets_list.push(widget_object);
this.widgets_dict[widget.name] = widget_object;

return widget_object;
}

on_delete(name, setup_new) {
this.api.blocks.delete();
}

customize() {
this.widgets_list.forEach((wid) => {
wid.customize(this.options);


+ 7
- 3
frappe/public/js/frappe/wiki_blocks/card.js Wyświetl plik

@@ -73,9 +73,12 @@ export default class Card {
let wid = frappe.widget.make_widget({
...widget,
widget_type: 'links',
container: this.wrapper,
options: this.options,
container: this.wrapper
});
wid.options = {
...this.options,
on_delete: () => this.api.blocks.delete()
}
wid.customize(this.options);
this.wrapper.setAttribute("card_name", wid.label);
this.new_card_widget = wid.get_config();
@@ -163,7 +166,8 @@ export default class Card {
container: this.wrapper,
type: "links",
options: this.options,
widgets: card
widgets: card,
api: this.api
});
this.wrapper.setAttribute("card_name", card_name);
if (!this.readOnly) {


+ 8
- 4
frappe/public/js/frappe/wiki_blocks/shortcut.js Wyświetl plik

@@ -27,7 +27,7 @@ export default class Shortcut {
allow_create: this.allow_customization,
allow_delete: this.allow_customization,
allow_hiding: false,
allow_edit: true,
allow_edit: true
};
}

@@ -72,9 +72,12 @@ export default class Shortcut {
let wid = frappe.widget.make_widget({
...widget,
widget_type: 'shortcut',
container: this.wrapper,
options: this.options,
container: this.wrapper
});
wid.options = {
...this.options,
on_delete: () => this.api.blocks.delete(),
}
wid.customize(this.options);
this.wrapper.setAttribute("shortcut_name", wid.label);
this.new_shortcut_widget = wid.get_config();
@@ -162,7 +165,8 @@ export default class Shortcut {
container: this.wrapper,
type: "shortcut",
options: this.options,
widgets: shortcut
widgets: shortcut,
api: this.api
});
this.wrapper.setAttribute("shortcut_name", shortcut_name);
if (!this.readOnly) {


Ładowanie…
Anuluj
Zapisz