Skip to content

Commit d6e40a2

Browse files
committed
feat(form): set background color of tile
1 parent 5149235 commit d6e40a2

File tree

6 files changed

+13
-7
lines changed

6 files changed

+13
-7
lines changed

css/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ form.formcreator_form {
810810
cursor: pointer;
811811
border-radius: 0;
812812
box-sizing: border-box;
813-
background-color: #E7E7E7;
813+
//background-color: #E7E7E7;
814814
animation-name: fadeInUp ;
815815
animation-iteration-count: 1;
816816
animation-timing-function: ease-in;

inc/form.class.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,11 @@ public function showForm($ID, $options = []) {
372372
echo '<td>' . __('Form icon', 'formcreator') . '</td>';
373373
echo '<td>';
374374
PluginFormcreatorCommon::showFontAwesomeDropdown('icon', ['value' => $this->fields['icon']]);
375+
Html::showColorField('icon_color', ['value' => $this->fields['icon_color']]);
375376
echo '</td>';
376-
echo '<td>' . __('Icon color', 'formcreator') . '</td>';
377+
echo '<td>' . __('Background color', 'formcreator') . '</td>';
377378
echo '<td>';
378-
Html::showColorField('icon_color', ['value' => $this->fields['icon_color']]);
379+
Html::showColorField('background_color', ['value' => $this->fields['background_color']]);
379380
echo '</td>';
380381
echo '</tr>';
381382

@@ -829,7 +830,7 @@ public function showFormList($rootCategory = 0, $keywords = '', $helpdeskHome =
829830

830831
$result_forms = $DB->request([
831832
'SELECT' => [
832-
$table_form => ['id', 'name', 'icon', 'icon_color', 'description', 'usage_count', 'is_default'],
833+
$table_form => ['id', 'name', 'icon', 'icon_color', 'background_color', 'description', 'usage_count', 'is_default'],
833834
],
834835
'FROM' => $table_form,
835836
'LEFT JOIN' => [
@@ -879,6 +880,7 @@ public function showFormList($rootCategory = 0, $keywords = '', $helpdeskHome =
879880
'name' => $form['name'],
880881
'icon' => $form['icon'],
881882
'icon_color' => $form['icon_color'],
883+
'background_color' => $form['background_color'],
882884
'description' => $form['description'],
883885
'type' => 'form',
884886
'usage_count' => $form['usage_count'],
@@ -962,7 +964,7 @@ public function showFormList($rootCategory = 0, $keywords = '', $helpdeskHome =
962964

963965
$query_forms = [
964966
'SELECT' => [
965-
$table_form => ['id', 'name', 'icon', 'description', 'usage_count'],
967+
$table_form => ['id', 'name', 'icon', 'icon_color', 'background_color', 'description', 'usage_count'],
966968
],
967969
'FROM' => $table_form,
968970
'LEFT JOIN' => [
@@ -987,6 +989,7 @@ public function showFormList($rootCategory = 0, $keywords = '', $helpdeskHome =
987989
'name' => $form['name'],
988990
'icon' => $form['icon'],
989991
'icon_color' => $form['icon_color'],
992+
'background_color' => $form['background_color'],
990993
'description' => $form['description'],
991994
'type' => 'form',
992995
'usage_count' => $form['usage_count'],

install/mysql/plugin_formcreator_empty.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_formcreator_forms` (
4040
`is_recursive` tinyint(1) NOT NULL DEFAULT '0',
4141
`icon` varchar(255) NOT NULL DEFAULT '',
4242
`icon_color` varchar(255) NOT NULL DEFAULT '',
43+
`background_color` varchar(255) NOT NULL DEFAULT '',
4344
`access_rights` tinyint(1) NOT NULL DEFAULT '1',
4445
`requesttype` int(11) NOT NULL DEFAULT '0',
4546
`description` varchar(255) DEFAULT NULL,

install/upgrade_to_2.9.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ public function upgrade(Migration $migration) {
294294
$table = 'glpi_plugin_formcreator_forms';
295295
$migration->addField($table, 'icon', 'string', ['after' => 'is_recursive']);
296296
$migration->addField($table, 'icon_color', 'string', ['after' => 'icon']);
297+
$migration->addField($table, 'background_color', 'string', ['after' => 'icon']);
297298
}
298299

299300
/**

js/scripts.js.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ function buildTiles(list) {
406406

407407
if (item.type == 'form') {
408408
forms.push(
409-
'<div class="plugin_formcreator_formTile '+item.type+' '+default_class+'" title="'+item.description+'">'
409+
'<div style="background-color: ' + item.background_color + '" class="plugin_formcreator_formTile '+item.type+' '+default_class+'" title="'+item.description+'">'
410410
+ '<i class="fa ' + item.icon + '" style="color: ' + item.icon_color+ '"></i>'
411411
+ '<a href="' + url + '" class="plugin_formcreator_formTile_title">'
412412
+ item.name
@@ -416,7 +416,7 @@ function buildTiles(list) {
416416
);
417417
} else {
418418
faqs.push(
419-
'<div class="plugin_formcreator_formTile '+item.type+' '+default_class+'" title="'+item.description+'">'
419+
'<div style="background-color: ' + item.background_color + '" class="plugin_formcreator_formTile '+item.type+' '+default_class+'" title="'+item.description+'">'
420420
+ '<i class="fa ' + item.icon + '" style="color: ' + item.icon_color+ '"></i>'
421421
+ '<a href="' + url + '" class="plugin_formcreator_formTile_title">'
422422
+ item.name

tests/suite-unit/PluginFormcreatorForm.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ public function testExport() {
427427
'is_recursive',
428428
'icon',
429429
'icon_color',
430+
'background_color',
430431
'access_rights',
431432
'requesttype',
432433
'description',

0 commit comments

Comments
 (0)