@@ -66,31 +66,36 @@ void sendPage(EthernetClient &client, byte reqPage) {
66
66
CSS Classes
67
67
w - wrapper (includes m + c)
68
68
m - navigation menu (left)
69
- c - content of a page
70
- r - row inside a content
69
+ c - wrapper for the content of a page (incl. smaller header)
70
+ d - content of the page
71
+ q - row inside a content (top aligned)
72
+ r - row inside a content (center-aligned)
71
73
i - short input (byte or IP address octet)
72
74
n - input type=number
73
75
s - select input with numbers
74
76
p - inputs disabled by id=o checkbox
75
77
CSS Ids
76
78
o - checkbox which disables other checkboxes and inputs
77
79
*/
78
- " body,.m{padding:1px;margin:0;font-family:sans-serif}"
80
+ " *{box-sizing:border-box}"
81
+ " body{padding:1px;margin:0;font-family:sans-serif;height:100vh}"
82
+ " body,.w,.c,.q{display:flex}"
83
+ " body,.c{flex-flow:column}"
84
+ " .w{flex-grow:1;min-height:0}"
85
+ " .m{flex:0 0 20vw;padding:1px}"
86
+ " .c{flex:1}"
87
+ " .d{overflow:auto;padding:15px}"
88
+ " .q{padding:1px}"
89
+ " .r{align-items:center}"
79
90
" h1,h4{padding:10px}"
80
91
" h1,.m,h4{background:#0067AC;margin:1px}"
81
- " .m,.c{height:calc(100vh - 71px)}"
82
- " .m{min-width:20%}"
83
- " .c{flex-grow:1;overflow-y:auto}"
84
- " .w,.r{display:flex}"
85
92
" a,h1,h4{color:white;text-decoration:none}"
86
- " .c h4{padding-left:30%;margin-bottom:20px}"
87
- " .r{margin:4px}"
93
+ " .c h4{padding-left:30%}"
88
94
" label{width:30%;text-align:right;margin-right:2px}"
89
- " input,button,select{margin-top:-2px}" // improve vertical allignment of input, button and select
90
95
" .s{text-align:right}"
91
96
" .s>option{direction:rtl}"
92
- " .i{text-align:center;width:3ch ;color:black}"
93
- " .n{width:8ch }"
97
+ " .i{text-align:center;width:4ch ;color:black}"
98
+ " .n{width:10ch }"
94
99
" </style>"
95
100
" </head>"
96
101
" <body" ));
@@ -119,7 +124,7 @@ void sendPage(EthernetClient &client, byte reqPage) {
119
124
120
125
// Left Menu
121
126
for (byte i = 1 ; i < PAGE_WAIT; i++) { // PAGE_WAIT is the last item in enum
122
- chunked.print (F (" <h4 " ));
127
+ chunked.print (F (" <h4" ));
123
128
if ((i) == reqPage) {
124
129
chunked.print (F (" style=background-color:#FF6600" ));
125
130
}
@@ -134,6 +139,7 @@ void sendPage(EthernetClient &client, byte reqPage) {
134
139
" <h4>" ));
135
140
stringPageName (chunked, reqPage);
136
141
chunked.print (F (" </h4>"
142
+ " <div class=d>"
137
143
" <form method=post>" ));
138
144
139
145
// PLACE FUNCTIONS PROVIDING CONTENT HERE
@@ -164,9 +170,10 @@ void sendPage(EthernetClient &client, byte reqPage) {
164
170
}
165
171
166
172
if (reqPage == PAGE_IP || reqPage == PAGE_TCP || reqPage == PAGE_RTU) {
167
- chunked.print (F (" <p><div class=r ><label><input type=submit value='Save & Apply'></label><input type=reset value=Cancel></div>" ));
173
+ chunked.print (F (" <p><div class=q ><label><input type=submit value='Save & Apply'></label><input type=reset value=Cancel></div>" ));
168
174
}
169
- chunked.print (F (" </form>" ));
175
+ chunked.print (F (" </form>"
176
+ " </div>" ));
170
177
tagDivClose (chunked); // close tags <div class=c> <div class=w>
171
178
chunked.end (); // closing tags not required </body></html>
172
179
}
@@ -277,20 +284,22 @@ void contentStatus(ChunkedPrint &chunked) {
277
284
tagLabelDiv (chunked, F (" Modbus RTU Response" ));
278
285
tagSpan (chunked, JSON_RESPONSE);
279
286
tagDivClose (chunked);
280
- tagLabelDiv (chunked, F (" Requests Queue" ));
287
+ tagLabelDiv (chunked, F (" Requests Queue" ), true );
281
288
tagSpan (chunked, JSON_QUEUE);
282
289
tagDivClose (chunked);
283
290
tagLabelDiv (chunked, F (" Modbus Statistics" ));
284
291
tagButton (chunked, F (" Reset Stats" ), ACT_RESET_STATS);
285
- chunked.print (F (" <br>" ));
292
+ tagDivClose (chunked);
293
+ tagLabelDiv (chunked, 0 );
286
294
tagSpan (chunked, JSON_STATS);
287
295
tagDivClose (chunked);
288
- tagLabelDiv (chunked, F (" Modbus Masters" ));
296
+ tagLabelDiv (chunked, F (" Modbus Masters" ), true );
289
297
tagSpan (chunked, JSON_TCP_UDP_MASTERS);
290
298
tagDivClose (chunked);
291
299
tagLabelDiv (chunked, F (" Modbus Slaves" ));
292
300
tagButton (chunked, F (" Scan Slaves" ), ACT_SCAN);
293
- chunked.print (F (" <br>" ));
301
+ tagDivClose (chunked);
302
+ tagLabelDiv (chunked, 0 );
294
303
tagSpan (chunked, JSON_SLAVES);
295
304
tagDivClose (chunked);
296
305
}
@@ -605,11 +614,16 @@ void tagInputHex(ChunkedPrint &chunked, const byte name, const bool required, co
605
614
606
615
@param chunked Chunked buffer
607
616
@param label Label string
617
+ @param top Align to top
608
618
*/
609
619
/* *************************************************************************/
610
620
void tagLabelDiv (ChunkedPrint &chunked, const __FlashStringHelper *label) {
611
- chunked.print (F (" <div class=r>" ));
612
- chunked.print (F (" <label> " ));
621
+ tagLabelDiv (chunked, label, false );
622
+ }
623
+ void tagLabelDiv (ChunkedPrint &chunked, const __FlashStringHelper *label, bool top) {
624
+ chunked.print (F (" <div class=\" q" ));
625
+ if (!top) chunked.print (F (" r" ));
626
+ chunked.print (F (" \" ><label> " ));
613
627
if (label) {
614
628
chunked.print (label);
615
629
chunked.print (F (" :" ));
@@ -645,7 +659,7 @@ void tagButton(ChunkedPrint &chunked, const __FlashStringHelper *flashString, by
645
659
/* *************************************************************************/
646
660
void tagDivClose (ChunkedPrint &chunked) {
647
661
chunked.print (F (" </div>"
648
- " </div>" )); // <div class=r >
662
+ " </div>" )); // <div class=q >
649
663
}
650
664
651
665
/* *************************************************************************/
0 commit comments