Skip to content

Commit 29a9d7b

Browse files
Improve rotation mode thumbnails (#302)
resolves #291
2 parents 41595b9 + 76cf7dc commit 29a9d7b

14 files changed

+123
-24
lines changed

application/forms/RotationConfigForm.php

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,9 @@ protected function assembleModeSelection(): string
582582
$value = $this->getPopulatedValue('mode');
583583

584584
$modes = [
585-
'24-7' => $this->translate('24/7'),
586585
'partial' => $this->translate('Partial Day'),
587-
'multi' => $this->translate('Multi Day')
586+
'multi' => $this->translate('Multi Day'),
587+
'24-7' => $this->translate('24/7')
588588
];
589589

590590
$modeList = new HtmlElement('ul');
@@ -602,22 +602,66 @@ protected function assembleModeSelection(): string
602602
$value = $mode;
603603
}
604604

605+
switch ($mode) {
606+
case 'partial':
607+
$labelDescription = [
608+
new HtmlElement(
609+
'span',
610+
null,
611+
Text::create($this->translate('Daily shifts with a daily handoff at a defined time.'))
612+
),
613+
new HtmlElement(
614+
'span',
615+
new Attributes(['class' => 'example']),
616+
Text::create($this->translate('e.g. Working hours (Mon - Fri, 9AM - 5PM)'))
617+
)
618+
];
619+
620+
break;
621+
case 'multi':
622+
$labelDescription = [
623+
new HtmlElement(
624+
'span',
625+
null,
626+
Text::create($this->translate(
627+
'Shifts start at a certain time on one day of the week and end on another.'
628+
))
629+
),
630+
new HtmlElement(
631+
'span',
632+
new Attributes(['class' => 'example']),
633+
Text::create($this->translate('e.g. Weekend shifts (Fri 5PM - Mon 9AM)'))
634+
)
635+
];
636+
637+
break;
638+
case '24-7':
639+
$labelDescription = [
640+
new HtmlElement(
641+
'span',
642+
null,
643+
Text::create($this->translate(
644+
'24 h shifts starting at a certain time at the day on every day of the week.'
645+
))
646+
),
647+
new HtmlElement(
648+
'span',
649+
new Attributes(['class' => 'example']),
650+
Text::create($this->translate('e.g. Daily, 9AM - 5PM'))
651+
)
652+
];
653+
}
654+
605655
$modeList->addHtml(new HtmlElement(
606656
'li',
607657
null,
608658
new HtmlElement(
609659
'label',
610660
null,
611661
$radio,
612-
new HtmlElement('img', Attributes::create([
613-
'src' => Url::fromPath(sprintf('img/notifications/pictogram/%s-gray.jpg', $mode)),
614-
'class' => 'unchecked'
615-
])),
616-
new HtmlElement('img', Attributes::create([
617-
'src' => Url::fromPath(sprintf('img/notifications/pictogram/%s-colored.jpg', $mode)),
618-
'class' => 'checked'
619-
])),
620-
Text::create($label)
662+
new HtmlElement('div', Attributes::create(['class' => ['mode-img', 'img-' . $mode]])),
663+
Text::create($label),
664+
...$labelDescription
621665
)
622666
));
623667
}

public/css/form.less

Lines changed: 68 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
.rotation-config {
2525
.rotation-mode {
2626
width: 50em;
27-
padding: .5em;
27+
padding: .5em 1em;
2828
margin: 0 auto;
2929

3030
h2 {
@@ -39,22 +39,28 @@
3939
margin: 0;
4040
padding: 0;
4141

42+
li {
43+
flex: 1 1 auto;
44+
width: 0;
45+
46+
&:not(:last-child) {
47+
margin-right: 1em;
48+
}
49+
}
50+
4251
label {
43-
display: block;
44-
width: 12em;
45-
text-align: center;
52+
display: flex;
53+
flex-direction: column;
54+
width: auto;
4655

4756
input {
4857
display: none;
4958
}
5059

51-
img {
52-
width: 100%;
53-
}
54-
55-
input:not(:checked) ~ img.checked,
56-
input:checked ~ img.unchecked {
57-
display: none;
60+
.mode-img {
61+
width: 8em;
62+
margin-bottom: .5em;
63+
outline: 3px solid @icinga-blue;
5864
}
5965
}
6066
}
@@ -80,6 +86,20 @@
8086

8187
/* Style */
8288

89+
.rotation-mode {
90+
--img-24-7: url('../img/notifications/pictogram/24-7-dark.jpg');
91+
--img-partial: url("../img/notifications/pictogram/partial-dark.jpg");
92+
--img-multi: url("../img/notifications/pictogram/multi-dark.jpg");
93+
}
94+
95+
@light-mode: {
96+
.rotation-mode {
97+
--img-24-7: url("../img/notifications/pictogram/24-7-light.jpg");
98+
--img-partial: url("../img/notifications/pictogram/partial-light.jpg");
99+
--img-multi: url("../img/notifications/pictogram/multi-light.jpg");
100+
}
101+
};
102+
83103
.rotation-config {
84104
label:not(:hover) {
85105
&.contact input:not(:focus) ~ .icon::before {
@@ -99,8 +119,43 @@
99119
background-color: @gray-lighter;
100120
}
101121

102-
img {
103-
.box-shadow();
122+
label {
123+
font-weight: bold;
124+
125+
* {
126+
font-weight: normal;
127+
}
128+
129+
.example {
130+
font-style: italic;
131+
color: @gray;
132+
}
133+
}
134+
135+
.mode-img {
136+
background-position: center;
137+
background-repeat: no-repeat;
138+
background-size: contain;
139+
aspect-ratio: 2;
140+
141+
.rounded-corners();
142+
143+
&.img-24-7 {
144+
background-image: var(--img-24-7);
145+
}
146+
147+
&.img-partial {
148+
background-image: var(--img-partial);
149+
}
150+
151+
&.img-multi {
152+
background-image: var(--img-multi);
153+
}
154+
}
155+
156+
input:not(:checked) + .mode-img {
157+
filter: grayscale(100%);
158+
outline: 1px solid @gray-light;
104159
}
105160
}
106161
}

public/img/pictogram/24-7-colored.jpg

-17.4 KB
Binary file not shown.

public/img/pictogram/24-7-dark.jpg

14.9 KB
Loading

public/img/pictogram/24-7-gray.jpg

-9.9 KB
Binary file not shown.

public/img/pictogram/24-7-light.jpg

13.3 KB
Loading
-10.6 KB
Binary file not shown.

public/img/pictogram/multi-dark.jpg

12.5 KB
Loading

public/img/pictogram/multi-gray.jpg

-7.88 KB
Binary file not shown.

public/img/pictogram/multi-light.jpg

10.9 KB
Loading

0 commit comments

Comments
 (0)