mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
dashboard: allow widget locking
This commit is contained in:
parent
105ecf9a5a
commit
34cafe3e98
@ -2,6 +2,11 @@
|
||||
--chart-js-font-color: #000000;
|
||||
}
|
||||
|
||||
.btn-pressed, .btn-pressed:hover {
|
||||
background-color: #d94f00;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.fa-spinner {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
@ -272,6 +272,11 @@ class WidgetManager {
|
||||
</button>
|
||||
`));
|
||||
$btn_group.append($(`<button class="btn btn-secondary" id="restore-defaults">${this.gettext.restore}</button>`));
|
||||
$btn_group.append($(`
|
||||
<button class="btn btn-secondary" id="lock-grid">
|
||||
<i class="fa fa-lock" style="font-size: 14px;"></i>
|
||||
</button>
|
||||
`));
|
||||
|
||||
// Initially hide the save button
|
||||
$('#save-grid').hide();
|
||||
@ -386,6 +391,24 @@ class WidgetManager {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#lock-grid').on('click', () => {
|
||||
$('#lock-grid').toggleClass('btn-pressed');
|
||||
|
||||
if ($('#lock-grid').hasClass('btn-pressed')) {
|
||||
this.grid.enableMove(false);
|
||||
this.grid.enableResize(false);
|
||||
$('.widget-content').css('cursor', 'default');
|
||||
} else {
|
||||
this.grid.enableMove(true);
|
||||
this.grid.enableResize(true);
|
||||
$('.widget-content').css('cursor', 'grab');
|
||||
}
|
||||
});
|
||||
|
||||
$('#lock-grid').mouseup(function() {
|
||||
$(this).blur();
|
||||
});
|
||||
}
|
||||
|
||||
/* Executes all widget post-render callbacks asynchronously and in "parallel".
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user