Skip to content

Commit 9d5c1c6

Browse files
committed
event-rule: Simplify stylesheet and make it responsive
1 parent fdc44a0 commit 9d5c1c6

File tree

5 files changed

+279
-394
lines changed

5 files changed

+279
-394
lines changed

application/controllers/EventRuleController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function init(): void
4242
public function indexAction(): void
4343
{
4444
$this->addTitleTab($this->translate('Event Rule'));
45+
$this->controls->addAttributes(['class' => 'event-rule-detail']);
4546
$this->content->addAttributes(['class' => 'event-rule-detail']);
4647
$this->getTabs()->disableLegacyExtensions();
4748

public/css/common.less

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,6 @@
8080

8181
.add-new-component {
8282
margin: 0 0 1em 1em;
83-
84-
&:is(div) {
85-
display: flex;
86-
gap: .5em;
87-
align-items: baseline;
88-
}
8983
}
9084

9185
.item-layout.rule footer {
Lines changed: 247 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,269 @@
1-
.event-rule-detail {
2-
.empty-state-bar {
3-
margin-bottom: 1em;
1+
.event-rule-config {
2+
@connectorHeight: .5em;
3+
@connectorColor: @gray-lighter;
4+
5+
// Style
6+
7+
.connector-line {
8+
background-color: @connectorColor;
49
}
5-
}
610

7-
.new-event-rule {
8-
margin-bottom: 1em;
9-
}
11+
.filter-controls,
12+
.dynamic-list:not(.empty, .escalations) {
13+
padding: .5em;
14+
border: 1px solid @connectorColor;
15+
.rounded-corners();
16+
}
17+
18+
.add-button,
19+
.remove-button {
20+
.event-rule-button();
21+
22+
&.animated.active {
23+
.fa::before {
24+
.animate(spin 2s infinite linear);
25+
26+
// fa spinner
27+
content: '\f110';
28+
}
29+
}
30+
}
31+
32+
.remove-button-disabled {
33+
.event-rule-button(true);
34+
}
35+
36+
.escalation-condition,
37+
.escalation-recipient {
38+
> :first-child,
39+
> :first-child[type="hidden"] + * {
40+
.rounded-corners(.25em);
41+
border-top-right-radius: 0;
42+
border-bottom-right-radius: 0;
43+
}
44+
45+
> :last-child {
46+
.rounded-corners(.25em);
47+
border-top-left-radius: 0;
48+
border-bottom-left-radius: 0;
49+
}
50+
51+
> :not(:first-child, :first-child[type="hidden"] + *, :last-child) {
52+
.rounded-corners(0);
53+
54+
* {
55+
// nested inputs as well
56+
.rounded-corners(0);
57+
}
58+
}
59+
}
60+
61+
// Layout
62+
63+
display: flex;
64+
65+
.connector-line {
66+
height: @connectorHeight;
67+
margin-top: 2.75em;
68+
}
69+
70+
> .connector-line {
71+
flex: 1 1 auto;
72+
min-width: 1em;
73+
}
74+
75+
#object-filter-controls {
76+
width: 20em;
77+
height: fit-content;
78+
79+
.filter-controls {
80+
margin-top: 1.25em;
81+
display: flex;
82+
gap: .5em;
83+
84+
input[type="text"] {
85+
flex: 1 1 auto;
86+
width: 0;
87+
}
88+
}
89+
}
90+
91+
.dynamic-list.empty .add-button,
92+
> #object-filter-controls > .add-button-wrapper .add-button {
93+
align-self: flex-start;
94+
padding: 1.25em 2em;
95+
margin-top: 1.25em;
96+
}
97+
98+
.dynamic-list.empty > .add-button-wrapper,
99+
> #object-filter-controls > .add-button-wrapper {
100+
display: flex;
101+
102+
&::before,
103+
&::after {
104+
content: "";
105+
flex: 1 1 auto;
106+
height: @connectorHeight;
107+
margin-top: 2.75em;
108+
background-color: @connectorColor;
109+
}
110+
111+
.add-button {
112+
flex: 0;
113+
}
114+
}
10115

11-
.event-rule-form {
12-
display: inline-flex;
13-
width: fit-content;
14-
max-width: unset;
15-
align-items: flex-start;
116+
> #object-filter-controls > .add-button-wrapper {
117+
min-width: 12em;
118+
}
16119

17-
> h2 {
18-
margin: 0 0 0.5em 0;
120+
> .escalations {
121+
flex: 15 1 auto;
19122
}
20123

21-
.control-group {
22-
display: inline-flex;
23-
margin-right: 2em;
124+
.escalations {
125+
display: grid;
126+
grid-template-columns: min-content minmax(1em, 4em) 1fr minmax(1em, 4em) 1fr;
127+
128+
.escalation {
129+
display: contents;
130+
}
131+
132+
.escalation > div:first-child {
133+
.vertical-line();
134+
135+
.remove-button {
136+
margin-top: 2em;
137+
}
138+
}
139+
140+
// The first escalation isn't connected to anything on top of it
141+
.escalation:first-child > div:first-child::before {
142+
top: 2.75em;
143+
}
144+
145+
> .add-button-wrapper {
146+
.vertical-line();
147+
148+
.add-button {
149+
margin-top: 2em;
150+
}
151+
}
152+
153+
.escalation .dynamic-list {
154+
position: relative;
155+
margin-bottom: 1em;
156+
157+
.dynamic-item {
158+
display: grid;
159+
align-items: baseline;
160+
margin-bottom: .5em;
161+
gap: 1px;
162+
163+
&.escalation-condition {
164+
grid-template-columns: minmax(8em, 1fr) 0fr 4em minmax(8em, 1fr) min-content;
165+
166+
.age-inputs {
167+
display: flex;
168+
gap: 1px;
169+
170+
> * {
171+
flex: 1 1 auto;
172+
width: 0;
173+
}
174+
}
175+
}
176+
177+
&.escalation-recipient {
178+
grid-template-columns: minmax(8em, 1fr) minmax(8em, 1fr) min-content;
179+
}
180+
181+
input[type="text"],
182+
.remove-button,
183+
.remove-button-disabled {
184+
height: 100%;
185+
}
186+
}
24187

25-
.control-label-group {
26-
width: auto;
188+
.add-button {
189+
width: 100%;
190+
191+
> .icon {
192+
margin: 0 auto;
193+
}
194+
}
27195
}
196+
}
197+
198+
select:not([multiple]) + .spinner::before {
199+
// ipl-web's Icon applies a min-width by default. Since the spinner element is part of a flex container,
200+
// it will be larger than necessary, covering the select's dropdown arrow. This ensures it doesn't.
201+
width: 1em;
202+
}
203+
204+
.vertical-line() {
205+
position: relative;
28206

29-
input[type='text'] {
30-
max-width: unset;
31-
width: 25em;
207+
&::before {
208+
position: absolute;
209+
z-index: -1;
210+
@halfedConnectorHeight: @connectorHeight / 2;
211+
inset: 0 ~"calc(50% - @{halfedConnectorHeight})" 0 ~"calc(50% - @{halfedConnectorHeight})";
212+
213+
content: "";
214+
width: @connectorHeight;
215+
216+
background-color: @connectorColor;
32217
}
33218
}
34219
}
35220

36-
.save-config {
37-
display: inline-flex;
38-
float: right;
39-
width: fit-content;
40-
flex-direction: row-reverse;
221+
#layout.twocols:not(.wide-layout) {
222+
.event-rule-config {
223+
#object-filter-controls {
224+
width: fit-content;
41225

42-
button[type="submit"] {
43-
margin-right: 1em;
226+
input[type="text"] {
227+
display: none;
228+
}
229+
}
44230

45-
&.btn-remove:not([disabled]) {
46-
.button(@body-bg-color, @color-critical, @color-critical-accentuated);
47-
border: none;
231+
.dynamic-list.empty .add-button,
232+
> #object-filter-controls > .add-button-wrapper .add-button {
233+
padding: .5em 1em;
234+
margin-top: 2em;
48235
}
49236

50-
&.btn-discard-changes {
51-
.event-rule-button();
237+
> #object-filter-controls > .add-button-wrapper {
238+
min-width: fit-content;
52239
}
240+
}
241+
}
242+
243+
// Other stuff
244+
245+
.event-rule-and-save-forms {
246+
display: flex;
247+
justify-content: space-between;
248+
align-items: baseline;
249+
margin-bottom: .5em;
53250

54-
&:disabled {
55-
background: @gray-light;
56-
color: @disabled-gray;
57-
cursor: not-allowed;
58-
border: transparent;
251+
.event-rule-form {
252+
display: flex;
253+
gap: .5em;
254+
255+
h2 {
256+
margin: 0;
257+
}
258+
}
259+
260+
#save-config {
261+
display: flex;
262+
gap: .5em;
263+
max-height: 2em;
264+
265+
.btn-remove {
266+
.button(@body-bg-color, @color-critical, @color-critical-accentuated);
59267
}
60268
}
61269
}

0 commit comments

Comments
 (0)