Skip to content

Commit

Permalink
Feat: responsiveness of the top bar
Browse files Browse the repository at this point in the history
  • Loading branch information
FardaleM committed Jul 22, 2023
1 parent e17365e commit dd18b31
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 43 deletions.
63 changes: 56 additions & 7 deletions files/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,71 @@
.grid-container { grid-template-columns: 300px auto;}
}

ul.topbar {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
border: 1px solid #e7e7e7;
background-color: #f3f3f3;
}

ul.topbar li {
height: 100%;
display: block;
float: left;
height: 50px;
}

ul.topbar li a {
display: block;
color: #666;
text-align: center;
padding: 14px 16px;
text-decoration: none;
text-align: center;
height: 50px;
}

ul.topbar li a:hover:not(.active) {background-color: #ddd;}

ul.topbar li a.active {background-color: #04AA6D;}

ul.topbar li.right {float: right;}

@media screen and (max-width: 768px) {
ul.topbar li.right,
ul.topbar li {
float: none;
border: 1px solid #e7e7e7;
}
}

.center-horizontal {
display: grid;
grid-template-columns: auto auto;
align-items: center;
justify-content: center;
height: 55%;
padding: 0;
margin: 0;
}

body {
font-family: Verdana,Geneva,Arial,Sans-serif;
font-size: 12px;
background-color : #FFFFFF
background-color : #FFFFFF;
margin: 0;
}

img {
border: 0px none;
}

.topbar img {
padding-right: 5px;
}

a:visited { color : #000080; ; text-decoration : underline; }
a:link { color : #2222FF; ; text-decoration : underline; }
a:hover { text-decoration : none; }
Expand All @@ -40,12 +95,6 @@ a.missing_page:visited { color : Red; text-decoration : underline; }
a.missing_page:link { color : Red; text-decoration : underline; }
a.missing_page:hover { color : Red; text-decoration : none; }

/* Accesskey'd links -- first letter underlined */
a.ak { text-decoration: underline; }
a.ak:hover { color:#2222FF; text-decoration: none;}
a.ak:focus { color:#2222FF; text-decoration: none;}
a.ak:first-letter { color:#2222FF; text-decoration: none; font-weight:bold; }

a.palette0 { color:rgb(128, 6, 25); }
a.palette1 { color:rgb(0, 104, 28); }
a.palette2 { color:rgb(0, 148, 145); }
Expand Down
54 changes: 22 additions & 32 deletions src/html_util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ let is_guest user =
let navbar_html ~cur_user ?(top_info_bar=[]) ?(wiki_revisions_link=[]) ?(wiki_page_links=[]) ?(todo_list_table=[]) content =
let home_link link_text =
a ~service:wiki_view_page
~a:[a_accesskey 'h'; a_class ["ak"]] link_text
~a:[a_accesskey 'h'] link_text
(Config.site.cfg_homepage, (None, (None, None))) in
let scheduler_link =
a ~service:scheduler_page
~a:[a_accesskey 'r'; a_class ["ak"]]
[img ~alt:"Scheduler" ~src:(make_static_uri ["calendar.png"]) ();
txt "Scheduler"] () in
~a:[a_accesskey 'r']
[div ~a:[a_class ["center-horizontal"]] [img ~alt:"Scheduler" ~src:(make_static_uri ["calendar.png"]) ();
txt "Scheduler"]] () in
let history_link =
a ~service:history_page
~a:[a_accesskey 'r'; a_class ["ak"]]
[img ~alt:"History" ~src:(make_static_uri ["home.png"]) ();
txt "History"] None in
~a:[a_accesskey 'r']
[div ~a:[a_class ["center-horizontal"]] [img ~alt:"History" ~src:(make_static_uri ["home.png"]) ();
txt "History"]] None in

let search_input =
[get_form ~service:search_page
Expand All @@ -90,42 +90,32 @@ let navbar_html ~cur_user ?(top_info_bar=[]) ?(wiki_revisions_link=[]) ?(wiki_pa
[] in

let disconnect_link =
if is_guest cur_user then [] else [disconnect_box "Logout"] in
if is_guest cur_user then [] else [li ~a:[a_class ["right"]] [disconnect_box "Logout"]] in

let my_preferences_link =
if is_guest cur_user then
[]
else
[a ~service:edit_user_page [txt "My Preferences"]
(None,cur_user.user_login)] in
[li ~a:[a_class ["right"]] [a ~service:edit_user_page [txt "My Preferences"]
(None,cur_user.user_login)]] in

let edit_users_link =
if Privileges.can_view_users cur_user then
[a ~service:user_admin_page [txt "Edit Users"] ()]
[li ~a:[a_class ["right"]] [a ~service:user_admin_page [txt "Edit Users"] ()]]
else
[] in

[div ~a:[a_id "topbar"]
[table ~a:[a_class ["top_menu_size"]]
[tr
[td ~a:[a_class ["top_menu_left_align"]]
[table
[tr [td [home_link
[img ~alt:"Home" ~src:(make_static_uri ["home.png"]) ();
txt "Home"]];
td [scheduler_link];
td [history_link];
td wiki_page_links]]
];
td ~a:[a_class ["top_menu_right_align"]]
([a ~service:about_page [txt "About"] ()] @
[txt " "] @
my_preferences_link @
[txt " "] @
edit_users_link @
[txt " "] @
disconnect_link)]]]]
@
ul ~a:[a_class ["top_menu_size"; "topbar"]]
([li [home_link [div ~a:[a_class ["center-horizontal"]] [img ~alt:"Home"
~src:(make_static_uri ["home.png"]) (); txt "Home"]]];
li [scheduler_link];
li [history_link]] @
List.map (fun l -> li [l]) wiki_page_links @
[li ~a:[a_class ["right"]] [a ~service:about_page [txt "About"] ()]] @
my_preferences_link @
edit_users_link @
disconnect_link)
::
(if top_info_bar = [] then [] else [div ~a:[a_id "top_action_bar"] top_info_bar])
@
[div ~a:[a_id "page"; a_class ["grid-container"]]
Expand Down
9 changes: 5 additions & 4 deletions src/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -463,12 +463,13 @@ let wiki_page_menu_html ~cur_user page content =

let edit_link =
[a ~service:wiki_edit_page ~a:[a_accesskey '1'; a_class ["ak"]]
[img ~alt:"Edit" ~src:(make_static_uri ["edit.png"]) ();
txt "Edit page"] page] in
[div ~a:[a_class ["center-horizontal"]] [img ~alt:"Edit" ~src:(make_static_uri ["edit.png"]) ();
txt "Edit page"]] page] in

let printable_link =
[a ~service:wiki_view_page
~a:[a_accesskey 'p'; a_class ["ak"]] [txt "Print"]
~a:[a_accesskey 'p'; a_class ["ak"]]
[div ~a:[a_class ["center-horizontal"]] [txt "Print"]]
(page, (Some true,(None,None)))] in

let revisions_link =
Expand All @@ -493,7 +494,7 @@ let wiki_page_menu_html ~cur_user page content =
[txt "Undo"] id]] in

return @@ Html_util.navbar_html ~cur_user
~wiki_page_links:(edit_link @ [txt " "] @ printable_link)
~wiki_page_links:(edit_link @ printable_link)
~wiki_revisions_link:revisions_link
~top_info_bar
~todo_list_table:[todo_list] content
Expand Down

0 comments on commit dd18b31

Please sign in to comment.