Commit 6ee7fd04d8974910855b31cf3d210a73896c6a32
1 parent
11ce5180
add sub_entry and subtitle in left menu entry
Showing
2 changed files
with
102 additions
and
17 deletions
Show diff stats
web/widgets/left_menu.anubis
| @@ -14,6 +14,7 @@ read system/string.anubis | @@ -14,6 +14,7 @@ read system/string.anubis | ||
| 14 | public type Left_Menu_Entry: | 14 | public type Left_Menu_Entry: |
| 15 | left_menu_entry( //MENU entry hence no selectable | 15 | left_menu_entry( //MENU entry hence no selectable |
| 16 | String entry_id, //it's also use as icon prefix | 16 | String entry_id, //it's also use as icon prefix |
| 17 | + Bool sub_entry, | ||
| 17 | List(String) classes, //additional classes if need (for disabling entry, change background color, etc.) | 18 | List(String) classes, //additional classes if need (for disabling entry, change background color, etc.) |
| 18 | WEB_Action_Name action, //action (url to apply when click | 19 | WEB_Action_Name action, //action (url to apply when click |
| 19 | String text, //text to show | 20 | String text, //text to show |
| @@ -22,6 +23,7 @@ public type Left_Menu_Entry: | @@ -22,6 +23,7 @@ public type Left_Menu_Entry: | ||
| 22 | ), | 23 | ), |
| 23 | title( //TITLE entry hence no selectable | 24 | title( //TITLE entry hence no selectable |
| 24 | String title_id, //it's also use as icon prefix | 25 | String title_id, //it's also use as icon prefix |
| 26 | + Bool subtitle, | ||
| 25 | List(String) classes, //additional classes if need (change background color, font size, etc.) | 27 | List(String) classes, //additional classes if need (change background color, font size, etc.) |
| 26 | String text //text to show | 28 | String text //text to show |
| 27 | ) | 29 | ) |
| @@ -141,9 +143,19 @@ public define Left_Menu_Entry | @@ -141,9 +143,19 @@ public define Left_Menu_Entry | ||
| 141 | WEB_Action_Name action, | 143 | WEB_Action_Name action, |
| 142 | String text | 144 | String text |
| 143 | )= | 145 | )= |
| 144 | - left_menu_entry(entry_id, [], action, text, [], failure) | 146 | + left_menu_entry(entry_id, false, [], action, text, [], failure) |
| 145 | . | 147 | . |
| 146 | - | 148 | + |
| 149 | +public define Left_Menu_Entry | ||
| 150 | + left_menu_sub_entry | ||
| 151 | + ( | ||
| 152 | + String entry_id, | ||
| 153 | + WEB_Action_Name action, | ||
| 154 | + String text | ||
| 155 | + )= | ||
| 156 | + left_menu_entry(entry_id, true, [], action, text, [], failure) | ||
| 157 | +. | ||
| 158 | + | ||
| 147 | public define Left_Menu_Entry | 159 | public define Left_Menu_Entry |
| 148 | left_menu_entry | 160 | left_menu_entry |
| 149 | ( | 161 | ( |
| @@ -151,9 +163,19 @@ public define Left_Menu_Entry | @@ -151,9 +163,19 @@ public define Left_Menu_Entry | ||
| 151 | String action, | 163 | String action, |
| 152 | String text | 164 | String text |
| 153 | )= | 165 | )= |
| 154 | - left_menu_entry(entry_id, [], action_name(action), text, [], failure) | 166 | + left_menu_entry(entry_id, false, [], action_name(action), text, [], failure) |
| 155 | . | 167 | . |
| 156 | - | 168 | + |
| 169 | +public define Left_Menu_Entry | ||
| 170 | + left_menu_sub_entry | ||
| 171 | + ( | ||
| 172 | + String entry_id, | ||
| 173 | + String action, | ||
| 174 | + String text | ||
| 175 | + )= | ||
| 176 | + left_menu_entry(entry_id, true, [], action_name(action), text, [], failure) | ||
| 177 | +. | ||
| 178 | + | ||
| 157 | public define Left_Menu_Entry | 179 | public define Left_Menu_Entry |
| 158 | left_menu_entry | 180 | left_menu_entry |
| 159 | ( | 181 | ( |
| @@ -162,7 +184,18 @@ public define Left_Menu_Entry | @@ -162,7 +184,18 @@ public define Left_Menu_Entry | ||
| 162 | String text, //text to show | 184 | String text, //text to show |
| 163 | List((String, String)) extra //extra web arguments to send when click | 185 | List((String, String)) extra //extra web arguments to send when click |
| 164 | )= | 186 | )= |
| 165 | - left_menu_entry(entry_id, [], action, text, extra, failure) | 187 | + left_menu_entry(entry_id, false, [], action, text, extra, failure) |
| 188 | +. | ||
| 189 | + | ||
| 190 | +public define Left_Menu_Entry | ||
| 191 | + left_menu_sub_entry | ||
| 192 | + ( | ||
| 193 | + String entry_id, //it's also use as icon prefix | ||
| 194 | + WEB_Action_Name action, //action (url to apply when click | ||
| 195 | + String text, //text to show | ||
| 196 | + List((String, String)) extra //extra web arguments to send when click | ||
| 197 | + )= | ||
| 198 | + left_menu_entry(entry_id, true, [], action, text, extra, failure) | ||
| 166 | . | 199 | . |
| 167 | 200 | ||
| 168 | public define Left_Menu_Entry | 201 | public define Left_Menu_Entry |
| @@ -174,9 +207,21 @@ public define Left_Menu_Entry | @@ -174,9 +207,21 @@ public define Left_Menu_Entry | ||
| 174 | List((String, String)) extra, //extra web arguments to send when click | 207 | List((String, String)) extra, //extra web arguments to send when click |
| 175 | String target_id | 208 | String target_id |
| 176 | )= | 209 | )= |
| 177 | - left_menu_entry(entry_id, [], action, text, extra, success(target_id)) | 210 | + left_menu_entry(entry_id, false, [], action, text, extra, success(target_id)) |
| 178 | . | 211 | . |
| 179 | - | 212 | + |
| 213 | +public define Left_Menu_Entry | ||
| 214 | + left_menu_sub_entry | ||
| 215 | + ( | ||
| 216 | + String entry_id, //it's also use as icon prefix | ||
| 217 | + WEB_Action_Name action, //action (url to apply when click | ||
| 218 | + String text, //text to show | ||
| 219 | + List((String, String)) extra, //extra web arguments to send when click | ||
| 220 | + String target_id | ||
| 221 | + )= | ||
| 222 | + left_menu_entry(entry_id, true, [], action, text, extra, success(target_id)) | ||
| 223 | +. | ||
| 224 | + | ||
| 180 | public define Left_Menu_Entry | 225 | public define Left_Menu_Entry |
| 181 | left_menu_entry | 226 | left_menu_entry |
| 182 | ( | 227 | ( |
| @@ -185,7 +230,18 @@ public define Left_Menu_Entry | @@ -185,7 +230,18 @@ public define Left_Menu_Entry | ||
| 185 | String text, //text to show | 230 | String text, //text to show |
| 186 | List((String, String)) extra //extra web arguments to send when click | 231 | List((String, String)) extra //extra web arguments to send when click |
| 187 | )= | 232 | )= |
| 188 | - left_menu_entry(entry_id, [], action_name(action), text, extra, failure) | 233 | + left_menu_entry(entry_id, false, [], action_name(action), text, extra, failure) |
| 234 | +. | ||
| 235 | + | ||
| 236 | +public define Left_Menu_Entry | ||
| 237 | + left_menu_sub_entry | ||
| 238 | + ( | ||
| 239 | + String entry_id, //it's also use as icon prefix | ||
| 240 | + String action, //action (url to apply when click | ||
| 241 | + String text, //text to show | ||
| 242 | + List((String, String)) extra //extra web arguments to send when click | ||
| 243 | + )= | ||
| 244 | + left_menu_entry(entry_id, true, [], action_name(action), text, extra, failure) | ||
| 189 | . | 245 | . |
| 190 | 246 | ||
| 191 | public define Left_Menu_Entry | 247 | public define Left_Menu_Entry |
| @@ -197,15 +253,34 @@ public define Left_Menu_Entry | @@ -197,15 +253,34 @@ public define Left_Menu_Entry | ||
| 197 | List((String, String)) extra, //extra web arguments to send when click | 253 | List((String, String)) extra, //extra web arguments to send when click |
| 198 | String target_id | 254 | String target_id |
| 199 | )= | 255 | )= |
| 200 | - left_menu_entry(entry_id, [], action_name(action), text, extra, success(target_id)) | 256 | + left_menu_entry(entry_id, false, [], action_name(action), text, extra, success(target_id)) |
| 201 | . | 257 | . |
| 202 | - | 258 | + |
| 259 | +public define Left_Menu_Entry | ||
| 260 | + left_menu_sub_entry | ||
| 261 | + ( | ||
| 262 | + String entry_id, //it's also use as icon prefix | ||
| 263 | + String action, //action (url to apply when click | ||
| 264 | + String text, //text to show | ||
| 265 | + List((String, String)) extra, //extra web arguments to send when click | ||
| 266 | + String target_id | ||
| 267 | + )= | ||
| 268 | + left_menu_entry(entry_id, true, [], action_name(action), text, extra, success(target_id)) | ||
| 269 | +. | ||
| 270 | + | ||
| 203 | public define Left_Menu_Entry | 271 | public define Left_Menu_Entry |
| 204 | title | 272 | title |
| 205 | ( | 273 | ( |
| 206 | String text | 274 | String text |
| 207 | )= | 275 | )= |
| 208 | - title("", [], text). | 276 | + title("", false, [], text). |
| 277 | + | ||
| 278 | +public define Left_Menu_Entry | ||
| 279 | + subtitle | ||
| 280 | + ( | ||
| 281 | + String text | ||
| 282 | + )= | ||
| 283 | + title("", true, [], text). | ||
| 209 | 284 | ||
| 210 | public define Left_Menu_Entry | 285 | public define Left_Menu_Entry |
| 211 | title | 286 | title |
| @@ -213,5 +288,14 @@ public define Left_Menu_Entry | @@ -213,5 +288,14 @@ public define Left_Menu_Entry | ||
| 213 | String title_id, | 288 | String title_id, |
| 214 | String text | 289 | String text |
| 215 | )= | 290 | )= |
| 216 | - title(title_id, [], text). | 291 | + title(title_id, false, [], text) |
| 292 | +. | ||
| 217 | 293 | ||
| 294 | +public define Left_Menu_Entry | ||
| 295 | + subtitle | ||
| 296 | + ( | ||
| 297 | + String title_id, | ||
| 298 | + String text | ||
| 299 | + )= | ||
| 300 | + title(title_id, true, [], text) | ||
| 301 | +. |
web/widgets/left_menu_html.anubis
| @@ -26,18 +26,19 @@ define List(HTML_Off_Form) | @@ -26,18 +26,19 @@ define List(HTML_Off_Form) | ||
| 26 | with entry = | 26 | with entry = |
| 27 | if h is | 27 | if h is |
| 28 | { | 28 | { |
| 29 | - left_menu_entry(_menu_id, _classes, _action, _text, _extra, _target_id) then | 29 | + left_menu_entry(_menu_id, subentry, _classes, _action, _text, _extra, _target_id) then |
| 30 | + with item_class = if subentry then "subitem " else "item ", | ||
| 30 | if _target_id is | 31 | if _target_id is |
| 31 | { | 32 | { |
| 32 | - failure then p([class("item "+_menu_id+"_icon"+if _menu_id=selected then " selected" else ""+ " "+join(" ", _classes))],actioner(same,same, link(_T(_text)),_action,_extra)), | 33 | + failure then p([class(item_class+_menu_id+"_icon"+if _menu_id=selected then " selected" else ""+ " "+join(" ", _classes))],actioner(same,same, link(_T(_text)),_action,_extra)), |
| 33 | success(target_id) then | 34 | success(target_id) then |
| 34 | - p([class("item "+_menu_id+"_icon"+if _menu_id=selected then " selected" else ""+ " "+join(" ", _classes)), | 35 | + p([class(item_class+"clickable "+_menu_id+"_icon"+if _menu_id=selected then " selected" else ""+ " "+join(" ", _classes)), |
| 35 | // event(onclick, "CalexiumToolBox.ajax_load_content('"+target_id+"', "+format_web_action_name_to_js(_action, _extra)+")")],text(_T(_text))), | 36 | // event(onclick, "CalexiumToolBox.ajax_load_content('"+target_id+"', "+format_web_action_name_to_js(_action, _extra)+")")],text(_T(_text))), |
| 36 | event(onclick, load_content(target_id, _action, _extra))],text(_T(_text))), | 37 | event(onclick, load_content(target_id, _action, _extra))],text(_T(_text))), |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | - title(_title_id, _classes, _text) then | ||
| 40 | - p([class("menu_title"), class(if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) | 40 | + title(_title_id, subtitle, _classes, _text) then |
| 41 | + p([class(if subtitle then "menu_subtitle" else "menu_title"), class(if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) | ||
| 41 | // p([class("menu_title"), class("item "+_title_id+"_icon"+if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) | 42 | // p([class("menu_title"), class("item "+_title_id+"_icon"+if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) |
| 42 | }, | 43 | }, |
| 43 | make_left_menu(_T, t, selected, [ entry . so_far]) | 44 | make_left_menu(_T, t, selected, [ entry . so_far]) |