Closed Kiougar closed 6 years ago
It seems that the tabs are just lists using CSS to style them, here's the CSS:
.tabs, .cbi-tabmenu {
margin: 0 0 18px;
padding: 0;
list-style: none;
zoom: 1;
}
.tabs:before,
.cbi-tabmenu:before,
.tabs:after,
.cbi-tabmenu:after {
display: table;
content: "";
zoom: 1;
}
.tabs:after, .cbi-tabmenu:after {
clear: both;
}
.tabs > li, .cbi-tabmenu > li {
float: left;
}
.tabs > li > a, .cbi-tabmenu > li > a {
display: block;
}
.tabs,
.cbi-tabmenu {
border-color: #ddd;
border-style: solid;
border-width: 0 0 1px;
}
.tabs > li,
.cbi-tabmenu > li {
position: relative;
margin-bottom: -1px;
}
.cbi-tabmenu.map {
margin: 0;
}
.cbi-tabmenu.map > li {
font-size: 16.5px;
font-weight: bold;
}
.cbi-tabcontainer > fieldset.cbi-section[id] > legend {
display: none;
}
.tabs > li > a,
.cbi-tabmenu > li > a {
padding: 0 15px;
margin-right: 2px;
line-height: 34px;
border: 1px solid transparent;
-webkit-border-radius: 4px 4px 0 0;
-moz-border-radius: 4px 4px 0 0;
border-radius: 4px 4px 0 0;
}
.tabs > li > a:hover,
.cbi-tabmenu > li > a:hover {
text-decoration: none;
background-color: #eee;
border-color: #eee #eee #ddd;
}
.tabs .active > a, .tabs .active > a:hover,
.cbi-tabmenu .active > a, .cbi-tabmenu .active > a:hover,
.cbi-tab > a:link, .cbi-tab > a:hover {
color: #808080;
background-color: #ffffff;
border: 1px solid #ddd;
border-bottom-color: transparent;
cursor: default;
}
.tabs .menu-dropdown, .tabs .dropdown-menu,
.cbi-tabmenu .menu-dropdown, .cbi-tabmenu .dropdown-menu {
top: 35px;
border-width: 1px;
-webkit-border-radius: 0 6px 6px 6px;
-moz-border-radius: 0 6px 6px 6px;
border-radius: 0 6px 6px 6px;
}
.tabs a.menu:after, .tabs .dropdown-toggle:after,
.cbi-tabmenu a.menu:after, .cbi-tabmenu .dropdown-toggle:after {
border-top-color: #999;
margin-top: 15px;
margin-left: 5px;
}
.tabs li.open.menu .menu, .tabs .open.dropdown .dropdown-toggle,
.cbi-tabmenu li.open.menu .menu, .cbi-tabmenu .open.dropdown .dropdown-toggle {
border-color: #999;
}
.tabs li.open a.menu:after, .tabs .dropdown.open .dropdown-toggle:after,
.cbi-tabmenu li.open a.menu:after, .cbi-tabmenu .dropdown.open .dropdown-toggle:after {
border-top-color: #555;
}
.tab-content > .tab-pane,
.tab-content > div {
display: none;
}
.tab-content > .active {
display: block;
}
Then the HTML looks like this (taken from the firewall page):
<ul class="tabs">
<li class="tabmenu-item-zones active">
<a href="/cgi-bin/luci/admin/network/firewall/zones">General Settings</a>
</li>
<li class="tabmenu-item-forwards ">
<a href="/cgi-bin/luci/admin/network/firewall/forwards">Port Forwards</a>
</li>
<li class="tabmenu-item-rules ">
<a href="/cgi-bin/luci/admin/network/firewall/rules">Traffic Rules</a>
</li>
<li class="tabmenu-item-custom ">
<a href="/cgi-bin/luci/admin/network/firewall/custom">Custom Rules</a>
</li>
</ul>
Here's a screenshot of how the tabs look: https://www.dropbox.com/s/dhh9jkqtgzkzxl9/FW%20Tabs.png
Note to self:
Investigate this even further by inspecting luci applications.
Notably: luci-app-firewall
Moved from #16 as a separate issue for clarity.
Research a little bit to see how to implement the tab interface that is widely used in LuCI modules. This will allow the
Usage
module to appear as a single menu entry and everything associated with it (i.e. config page) to exist in the same page.