Git Product home page Git Product logo

semantic-menu's People

Contributors

ajsharp avatar francois avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

semantic-menu's Issues

Setup problems

Hi there,

I've just installed the plugin, but when i try out the example code in my view:

<%= semantic_menu :class => 'top_level_nav' do |root|
root.add "overview", "root_path"
end %>

I get the following error:

uninitialized class variable @@controller in MenuItem

Any help would be greatly appreciated, i'm hoping i've done something daft.

Thanks in advance

semantic menu can't use current_page? b/c it doesn't have a reference to the controller instance

This is due to how the controller instance is passed into the SemanticMenu intializer. Still, to get this instance to each
module MenuHelper
def semantic_menu(opts={}, &block)
# controller is not available in this context, but @controller is
SemanticMenu.new(opts, &block).to_s(controller)
end
end

#...
ActionView::Base.send :include, MenuHelper

Additionally, we need to fix how the child menu items are being passed a controller instance.

class SemanticMenu < MenuItem

  def initialize(opts={},&block)
    @opts = {:class => 'menu'}.merge opts
    @level = 0
    @children = []

    yield self if block_given?
  end

  def to_s(controller=nil)
    @controller = controller
    # we need to pass the @controller instance to each child as well
    content_tag(:ul, @children.collect(&:to_s).join, @opts)
  end
end

Incompatible with Rails 3

The current version is sadly incompatible with Rails 3. The following stack is displayed when attempting to use it:

"undefined local variable or method request' for #<MenuItem:0xa1c9c88>" actionpack (3.0.0.beta4) lib/action_view/helpers/url_helper.rb:570:incurrent_page?'
vendor/plugins/semantic-menu/lib/semantic_menu.rb:42:in on_current_page?' vendor/plugins/semantic-menu/lib/semantic_menu.rb:37:inactive?'
vendor/plugins/semantic-menu/lib/semantic_menu.rb:25:in to_s' vendor/plugins/semantic-menu/lib/semantic_menu.rb:58:incollect'
vendor/plugins/semantic-menu/lib/semantic_menu.rb:58:in to_s' vendor/plugins/semantic-menu/lib/menu_helper.rb:19:insemantic_menu'
actionpack (3.0.0.beta4) lib/action_view/template.rb:134:in `block in render'
...

Hopefully this can be fixed, I'll update this issue in case I come across any!

Making root options execute link before they expand.

Hello.

I am using semantic-menu in my application. Right now, when I click on one of the options in the menu, it will expand and it is going to show all the children. What I would like to do, is to set a default link once it is clicked, so it will go to a link and then it will expand the rest of the options? I have tried to add the link in the root, the same was as the links without children, but I am not getting the result I expect to have.

Parent link not marked as active

Hi there,

I've just set this up with 1 level of sub nav items and selecting one of the child links it's parent isn't being flagged as an active link.

Thanks again in advance,

Alan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.