Force user to actively select a group while defining a new dashboard

This commit is contained in:
fbsanchez 2021-01-08 18:54:04 +01:00
parent f38ea57c5f
commit 6962c34f48
3 changed files with 12 additions and 2 deletions

View File

@ -201,6 +201,7 @@ function load_modal(settings) {
var flagError = false;
if (Array.isArray(settings.form) === false) {
$("#" + settings.form + " :input").each(function() {
var input = this;
if (this.checkValidity() === false) {
$(this).attr("title", this.validationMessage);
$(this).tooltip({
@ -209,6 +210,9 @@ function load_modal(settings) {
my: "right bottom",
at: "right top",
using: function(position, feedback) {
if (input.className == "select2-hidden-accessible")
position.left += width / 1.7;
console.log(position);
$(this).css(position);
$("<div>")
.addClass("arrow")

View File

@ -33,7 +33,7 @@ if (empty($arrayDashboard) === true) {
$arrayDashboard['name'] = 'Default';
$arrayDashboard['id_user'] = '';
$private = 0;
$arrayDashboard['id_group'] = 0;
$arrayDashboard['id_group'] = null;
$arrayDashboard['active'] = 0;
$arrayDashboard['cells_slideshow'] = 0;
} else {
@ -105,6 +105,7 @@ $inputs = [
'type' => 'select_groups',
'selected' => $arrayDashboard['id_group'],
'return' => true,
'required' => true,
],
],
],

View File

@ -202,11 +202,16 @@ if (empty($dashboards) === true) {
}
if ($writeDashboards === 1) {
$text = __('Create a new dashboard');
if ($dashboard !== null) {
$text = __('Update Dashboard');
}
// Button for display modal options dashboard.
$output = '<a href="#" style="float:right;" onclick=\'';
$output .= 'show_option_dialog('.json_encode(
[
'title' => __('Update Dashboard'),
'title' => $text,
'btn_text' => __('Ok'),
'btn_cancel' => __('Cancel'),
'url' => $ajaxController,