mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-16 03:41:41 +00:00
Add a hover menu to the "Agents" nav link.
This commit is contained in:
parent
a224a0b908
commit
05e373614e
3 changed files with 37 additions and 3 deletions
|
@ -98,6 +98,12 @@ span.not-applicable:after {
|
|||
right: 1px;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
.dropdown.dropdown-hover:hover .dropdown-menu {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
// Flash
|
||||
|
||||
.flash {
|
||||
|
|
|
@ -1,6 +1,28 @@
|
|||
module ApplicationHelper
|
||||
def nav_link(name, path, options = {})
|
||||
content_tag :li, link_to(name, path), class: current_page?(path) ? 'active' : ''
|
||||
def nav_link(name, path, options = {}, &block)
|
||||
if glyphicon = options[:glyphicon]
|
||||
name = "<span class='glyphicon glyphicon-#{glyphicon}'></span> ".html_safe + name
|
||||
end
|
||||
content = link_to(name, path)
|
||||
active = current_page?(path)
|
||||
if block
|
||||
# Passing a block signifies that the link is a header of a hover
|
||||
# menu which contains what's in the block.
|
||||
begin
|
||||
@nav_in_menu = true
|
||||
@nav_link_active = active
|
||||
content += capture(&block)
|
||||
class_name = "dropdown dropdown-hover #{@nav_link_active ? 'active' : ''}"
|
||||
ensure
|
||||
@nav_in_menu = @nav_link_active = false
|
||||
end
|
||||
else
|
||||
# Mark the menu header active if it contains the current page
|
||||
@nav_link_active ||= active if @nav_in_menu
|
||||
# An "active" menu item may be an eyesore, hence `!@nav_in_menu &&`.
|
||||
class_name = !@nav_in_menu && active ? 'active' : ''
|
||||
end
|
||||
content_tag :li, content, class: class_name
|
||||
end
|
||||
|
||||
def yes_no(bool)
|
||||
|
|
|
@ -12,7 +12,13 @@
|
|||
|
||||
<% if user_signed_in? %>
|
||||
<ul class='nav navbar-nav'>
|
||||
<%= nav_link "Agents", agents_path %>
|
||||
<%= nav_link "Agents", agents_path do %>
|
||||
<ul class='dropdown-menu' role='menu'>
|
||||
<%= nav_link "New Agent", new_agent_path, glyphicon: "plus" %>
|
||||
<%= nav_link "Run event propagation", propagate_agents_path, glyphicon: "refresh" %>
|
||||
<%= nav_link "View Diagram", diagram_path, glyphicon: 'random' %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<%= nav_link "Scenarios", scenarios_path %>
|
||||
<%= nav_link "Events", events_path %>
|
||||
<%= nav_link "Credentials", user_credentials_path %>
|
||||
|
|
Loading…
Add table
Reference in a new issue