luci-mod-system: use generic .cbi-section-actions style for row actions

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 9706388c42)
This commit is contained in:
Jo-Philipp Wich 2020-03-23 21:53:53 +01:00
parent 4ee21feef2
commit 0bcb9109f2

View file

@ -37,12 +37,12 @@ return view.extend({
}, },
handleEnableDisable: function(name, isEnabled, ev) { handleEnableDisable: function(name, isEnabled, ev) {
return this.handleAction(name, isEnabled ? 'disable' : 'enable', ev).then(L.bind(function(name, isEnabled, cell) { return this.handleAction(name, isEnabled ? 'disable' : 'enable', ev).then(L.bind(function(name, isEnabled, btn) {
L.dom.content(cell, this.renderEnableDisable({ btn.parentNode.replaceChild(this.renderEnableDisable({
name: name, name: name,
enabled: isEnabled enabled: isEnabled
})); }), btn);
}, this, name, !isEnabled, ev.currentTarget.parentNode)); }, this, name, !isEnabled, ev.currentTarget));
}, },
handleRcLocalSave: function(ev) { handleRcLocalSave: function(ev) {
@ -72,10 +72,7 @@ return view.extend({
E('div', { 'class': 'tr table-titles' }, [ E('div', { 'class': 'tr table-titles' }, [
E('div', { 'class': 'th' }, _('Start priority')), E('div', { 'class': 'th' }, _('Start priority')),
E('div', { 'class': 'th' }, _('Initscript')), E('div', { 'class': 'th' }, _('Initscript')),
E('div', { 'class': 'th' }, _('Enable/Disable')), E('div', { 'class': 'th nowrap cbi-section-actions' })
E('div', { 'class': 'th' }, _('Start')),
E('div', { 'class': 'th' }, _('Restart')),
E('div', { 'class': 'th' }, _('Stop'))
]) ])
]); ]);
@ -94,10 +91,12 @@ return view.extend({
rows.push([ rows.push([
'%02d'.format(list[i].index), '%02d'.format(list[i].index),
list[i].name, list[i].name,
this.renderEnableDisable(list[i]), E('div', [
E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'start') }, _('Start')), this.renderEnableDisable(list[i]),
E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'restart') }, _('Restart')), E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'start') }, _('Start')),
E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'stop') }, _('Stop')) E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'restart') }, _('Restart')),
E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'stop') }, _('Stop'))
])
]); ]);
} }