Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add visibility conditions to forms #18496

Merged
merged 5 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions css/includes/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,16 @@ body pre {
}
}

// Missing class from tabler, probably need to update it ?
.btn-check:checked+.btn {
color : var(--tblr-btn-hover-color) !important;
background-color: var(--tblr-btn-active-bg) !important;
}

.w-fit-content {
width: fit-content;
}

.accordion-button:hover, .accordion-button:focus {
z-index: unset;
}
36 changes: 36 additions & 0 deletions css/includes/components/form/_form-editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,39 @@
}
}
}

.logic-operator-selector .select2-selection {
border: 0 !important;
background-color: var(--tblr-pink-lt) !important;

// Fix some border conflicts with tabler/select2
border-top-right-radius: var(--tblr-border-radius) !important;
border-bottom-right-radius: var(--tblr-border-radius) !important;
}

.question-selector .select2-selection {
border: 0 !important;
background-color: var(--tblr-indigo-lt) !important;

// Fix some border conflicts with tabler/select2
border-top-right-radius: var(--tblr-border-radius) !important;
border-bottom-right-radius: var(--tblr-border-radius) !important;
}

.value-operator-selector .select2-selection {
border: 0 !important;
background-color: var(--tblr-teal-lt) !important;

// Fix some border conflicts with tabler/select2
border-top-right-radius: var(--tblr-border-radius) !important;
border-bottom-right-radius: var(--tblr-border-radius) !important;
}

.value-selector {
border: 0 !important;
background-color: var(--tblr-yellow-lt) !important;
}

.visibility-dropdown-card {
width: 600px;
}
4 changes: 4 additions & 0 deletions dependency_injection/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
$services->load('Glpi\Kernel\\Listener\\', $projectDir . '/src/Glpi/Kernel/Listener');
$services->load('Glpi\DependencyInjection\\', $projectDir . '/src/Glpi/DependencyInjection');
$services->load('Glpi\Progress\\', $projectDir . '/src/Glpi/Progress')->exclude($projectDir . '/src/Glpi/Progress/SessionProgress.php');
$services->load(
'Glpi\Form\ConditionalVisiblity\\',
$projectDir . '/src/Glpi/Form/ConditionalVisiblity/*Manager.php'
);

/**
* Override Symfony's logger.
Expand Down
6 changes: 6 additions & 0 deletions install/migrations/update_10.0.x_to_11.0.0/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
`name` varchar(255) NOT NULL DEFAULT '',
`description` longtext,
`rank` int NOT NULL DEFAULT '0',
`visibility_strategy` varchar(30) NOT NULL DEFAULT '',
`conditions` JSON NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid` (`uuid`),
KEY `name` (`name`),
Expand All @@ -124,6 +126,8 @@
`description` longtext,
`default_value` text COMMENT 'JSON - The default value type may not be the same for all questions type',
`extra_data` text COMMENT 'JSON - Extra configuration field(s) depending on the questions type',
`visibility_strategy` varchar(30) NOT NULL DEFAULT '',
`conditions` JSON NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid` (`uuid`),
KEY `name` (`name`),
Expand All @@ -142,6 +146,8 @@
`name` varchar(255) NOT NULL DEFAULT '',
`description` longtext,
`rank` int NOT NULL DEFAULT '0',
`visibility_strategy` varchar(30) NOT NULL DEFAULT '',
`conditions` JSON NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid` (`uuid`),
KEY `name` (`name`),
Expand Down
6 changes: 6 additions & 0 deletions install/mysql/glpi-empty.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9504,6 +9504,8 @@ CREATE TABLE `glpi_forms_sections` (
`name` varchar(255) NOT NULL DEFAULT '',
`description` longtext,
`rank` int NOT NULL DEFAULT '0',
`visibility_strategy` varchar(30) NOT NULL DEFAULT '',
`conditions` JSON NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid` (`uuid`),
KEY `name` (`name`),
Expand All @@ -9523,6 +9525,8 @@ CREATE TABLE `glpi_forms_questions` (
`description` longtext,
`default_value` text COMMENT 'JSON - The default value type may not be the same for all questions type',
`extra_data` text COMMENT 'JSON - Extra configuration field(s) depending on the questions type',
`visibility_strategy` varchar(30) NOT NULL DEFAULT '',
`conditions` JSON NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid` (`uuid`),
KEY `name` (`name`),
Expand All @@ -9539,6 +9543,8 @@ CREATE TABLE `glpi_forms_comments` (
`name` varchar(255) NOT NULL DEFAULT '',
`description` longtext,
`rank` int NOT NULL DEFAULT '0',
`visibility_strategy` varchar(30) NOT NULL DEFAULT '',
`conditions` JSON NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uuid` (`uuid`),
KEY `name` (`name`),
Expand Down
Loading
Loading