menu-rails 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54995716b752ca3986bebdffa9bf21141217ce65
4
- data.tar.gz: d53a501614e2b8650facd1f3e70b05c5f88cb749
3
+ metadata.gz: ade3caa8f049fcfc1c044546241a52b7371f71ad
4
+ data.tar.gz: 8cb89b4157e51547765c190f2816616f6a365231
5
5
  SHA512:
6
- metadata.gz: 43ec47cda017c386a4265dafc53f4598a24711b8292c3b390464d5f7fcd4954d14ec0c7e30c19601702747b3269ba38300b9a795c23520c94e343f1efc1194df
7
- data.tar.gz: fe61f77f6530eadda79e447a791a2ab6cca039a5efafa36cd216cbc4cacffa4116b884c7c50bfb251e4f45c40372cd6f4d3f012ad68a6a7b023ac5bc5d9bf218
6
+ metadata.gz: 035ea5bade29a8ee20e619ee369b03c5b7da41c799638a4ebd1bd10bb7ee3ff40911c5b0d2381d87fd5bf854819b25d5d0c22b5aff8736aec8408fc406a82efb
7
+ data.tar.gz: 1c0a7fe369d2a1864011ec74a4fca203c8c8a275aebc85c5c06ef40237f97d1e16fd4e815f8e849aac401df79101b91adad2a592daeca61f403248dffa5160df
@@ -0,0 +1 @@
1
+ 2.0.0-p353
data/README.md CHANGED
@@ -1,12 +1,43 @@
1
1
  # menu-rails
2
2
 
3
- TODO: Write a gem description
3
+ This gem provide a set of helpers and methods that allow to easily generate a menu and identify
4
+ the currently active link item.
5
+ Comes with support to generate menu from a YAML file in config directory, but supports generation
6
+ even from database (or whatever you want).
7
+
8
+ ## Features
9
+
10
+ - Threadsafe (not tested)
11
+ - Menu generation from YAML file
12
+ - Menu generation from any other source (database for example)
13
+ - Check which menu item is active
14
+ - Cancan support
15
+
16
+ ## How to generate menu from database
17
+
18
+ You must create 2 classes which will respond to some methods:
19
+
20
+ A `Menu` class which must respond to:
21
+
22
+ - `all_menu_items` with an array of menu items
23
+ - Must `include MenuRails::BaseMenu`
24
+
25
+ A `MenuItem` class which must respond to:
26
+
27
+ - `url` *String* which must be a valid url
28
+ - `text` *String* which is text displayed to users
29
+ - `authorization` should return `nil` (will be displayed without checking through `can?`) or a hash like this:
30
+ `{ can: :read, class_name: 'ApplicationController' }` which will be used in `can?` method (view) and if false, will skip the item
31
+ - `active_controller_only` *Boolean* `false` if you want to check both against controller and action name if this link is currently active. If `true`, only controller will be checked
32
+ - `active_method` *Symbol* if not `nil`, will be called instead of standard `active?` method (and `active_controller_only` ignored)
33
+
34
+ The gem should be threadsafe
4
35
 
5
36
  ## Installation
6
37
 
7
38
  Add this line to your application's Gemfile:
8
39
 
9
- gem 'menu-rails', '~> 0.0.1'
40
+ gem 'menu-rails', '~> 0.1.0'
10
41
 
11
42
  And then execute:
12
43
 
@@ -20,6 +51,11 @@ Or install it yourself as:
20
51
 
21
52
  TODO: Write usage instructions here
22
53
 
54
+ ## TODO
55
+
56
+ - Split `Menu` and `MenuItem` classes into 2 pairs, `MenuBase` will not include anything related to `has_no_table`, same for `MenuItemBase`
57
+ - I18n support (very important, for menu text string)
58
+
23
59
  ## Contributing
24
60
 
25
61
  1. Fork it
@@ -8,6 +8,7 @@ module MenuRails
8
8
 
9
9
  class Menu < ActiveRecord::Base
10
10
  include Symbolize::ActiveRecord
11
+ include MenuRails::BaseMenu
11
12
 
12
13
  has_no_table
13
14
 
@@ -18,13 +19,28 @@ module MenuRails
18
19
 
19
20
  symbolize :mrid
20
21
 
22
+ def get_menu_item_by_mriid(identifier)
23
+ self.menu_items.select{ |menu_item| menu_item.mriid == identifier.to_sym }.first
24
+ end
25
+
26
+ def all_menu_items
27
+ self.menu_items
28
+ end
29
+
21
30
  private
22
31
 
23
32
  def build_menu_items_from_yaml_data!(menu_items_data)
24
33
  menu_items_data.each do |menu_item_data|
25
- menu_item = MenuItem.new(menu_item_data)
26
- menu_item.menu = self
27
- self.menu_items << menu_item
34
+ menu_item_params = menu_item_data.values.first.merge(mriid: menu_item_data.keys.first.to_sym)
35
+ overwrite_menu_item_class = menu_item_params.delete(:class_name)
36
+ if overwrite_menu_item_class.nil?
37
+ overwrite_menu_item_class = menu_item_class
38
+ else
39
+ overwrite_menu_item_class = overwrite_menu_item_class.constantize
40
+ end
41
+ menu_item = overwrite_menu_item_class.new(menu_item_params)
42
+ menu_item.menu = self
43
+ self.menu_items << menu_item
28
44
  end
29
45
  self.menu_items.freeze
30
46
 
@@ -32,6 +48,10 @@ module MenuRails
32
48
  self
33
49
  end
34
50
 
51
+ def menu_item_class
52
+ Rails.application.config.menu_rails.menu_item_class_name.constantize
53
+ end
54
+
35
55
  class << self
36
56
 
37
57
  SEMAPHORE = Mutex.new
@@ -44,7 +64,10 @@ module MenuRails
44
64
 
45
65
  base_menu.each do |menu_identifier, menu|
46
66
  mid_sym = menu_identifier.to_sym
47
- @menu_by_mrid[mid_sym] = new(mrid: mid_sym).send(:build_menu_items_from_yaml_data!, menu[:menu_items]).freeze
67
+ overwrite_menu_class = menu.delete(:class_name)
68
+ overwrite_menu_class = overwrite_menu_class.nil? ? menu_class : overwrite_menu_class.constantize
69
+ @menu_by_mrid[mid_sym] = overwrite_menu_class.new(mrid: mid_sym).send( :build_menu_items_from_yaml_data!,
70
+ menu[:menu_items] ).freeze
48
71
  end
49
72
  end
50
73
 
@@ -52,6 +75,12 @@ module MenuRails
52
75
  end
53
76
  end
54
77
 
78
+ private
79
+
80
+ def menu_class
81
+ Rails.application.config.menu_rails.menu_class_name.constantize
82
+ end
83
+
55
84
  end
56
85
 
57
86
  end
@@ -1,21 +1,81 @@
1
1
  require 'activerecord-tableless'
2
2
  require 'symbolize'
3
+ require 'active_support/all'
3
4
 
4
5
  module MenuRails
5
6
 
6
7
  class MenuItem < ActiveRecord::Base
7
8
  include Symbolize::ActiveRecord
9
+ include Rails.application.routes.url_helpers
8
10
 
9
11
  has_no_table
10
12
 
11
- column :menu_id, :integer
13
+ column :menu_id, :integer
12
14
  # Stands for MenuRails Item ID
13
- column :mriid, :string
14
- column :text, :string
15
+ column :mriid, :string
16
+ column :text, :string
17
+ column :authorization_can, :string
18
+ column :authorization_class_name, :string
19
+ column :url_method, :string
20
+ column :url_text, :string
21
+ column :active_controller_only, :boolean
22
+ column :active_method, :string
15
23
 
16
24
  belongs_to :menu
17
25
 
18
- symbolize :mriid
26
+ symbolize :mriid, :authorization_can, :url_method, :active_method
27
+
28
+ validates :text, presence: true
29
+ validates :url_method, presence: { if: -> { self.url_text.blank? } }
30
+ validates :url_text, presence: { if: -> { self.url_method.blank? } }
31
+
32
+ def url=(value)
33
+ if value.kind_of? String
34
+ self.url_text = value
35
+ elsif value.kind_of? Symbol
36
+ self.url_method = value
37
+ end
38
+ end
39
+
40
+ def url
41
+ self.url_is_string? ? url_for(self.url_text) : send(self.url_method)
42
+ end
43
+
44
+ def authorization=(value)
45
+ self.authorization_can = value[:can]
46
+ self.authorization_class_name = value[:class_name]
47
+ end
48
+
49
+ def authorization
50
+ return nil if self.authorization_can.nil? || self.authorization_class_name.blank?
51
+
52
+ { can: self.authorization_can, class_name: self.authorization_class_name }
53
+ end
54
+
55
+ def active=(value)
56
+ self.active_controller_only = value[:controller_only]
57
+ self.active_method = value[:method]
58
+ end
59
+
60
+ def active?
61
+ return send(self.active_method) unless self.active_method.nil?
62
+ return false if self.url_is_string?
63
+
64
+ result = self.menu.controller.controller_name == Rails.application.routes.recognize_path(self.url)[:controller]
65
+ unless self.active_controller_only?
66
+ result &&= self.menu.controller.action_name == Rails.application.routes.recognize_path(self.url)[:action]
67
+ end
68
+
69
+ result
70
+ end
71
+
72
+ def to_s
73
+ self.text
74
+ end
75
+
76
+ def url_is_string?
77
+ self.url_method.nil?
78
+ end
19
79
 
20
80
  end
21
81
 
@@ -1,6 +1,14 @@
1
- require "menu-rails/version"
1
+ require 'menu-rails/version'
2
+ require 'menu-rails/helpers'
2
3
 
3
4
  module MenuRails
5
+ autoload :BaseMenu, 'menu-rails/base_menu'
6
+
7
+ mattr_accessor :menu_class_name
8
+ @@menu_class_name = 'MenuRails::Menu'
9
+
10
+ mattr_accessor :menu_item_class_name
11
+ @@menu_item_class_name = 'MenuRails::MenuItem'
4
12
  end
5
13
 
6
14
  # load Rails/Railtie
@@ -0,0 +1,22 @@
1
+ module MenuRails
2
+
3
+ module BaseMenu
4
+
5
+ def display_for_controller(tmp_controller)
6
+ old_controller = @controller
7
+ @controller = tmp_controller
8
+ block_result = yield
9
+ @controller = old_controller
10
+
11
+ block_result
12
+ end
13
+
14
+ def controller
15
+ raise 'Controller not valid if not displaying menu' if @controller.nil?
16
+
17
+ @controller
18
+ end
19
+
20
+ end
21
+
22
+ end
@@ -3,5 +3,13 @@ require 'rails'
3
3
  module MenuRails #:nodoc:
4
4
  class Engine < ::Rails::Engine #:nodoc:
5
5
  isolate_namespace MenuRails
6
+
7
+ config.menu_rails = MenuRails
8
+
9
+ initializer "menu-rails.helpers" do
10
+ ActiveSupport.on_load(:action_view) do
11
+ include MenuRails::Helpers::MenuHelper
12
+ end
13
+ end
6
14
  end
7
15
  end
@@ -0,0 +1,9 @@
1
+ module MenuRails
2
+
3
+ module Helpers
4
+
5
+ autoload :MenuHelper, 'menu-rails/helpers/menu_helper'
6
+
7
+ end
8
+
9
+ end
@@ -0,0 +1,49 @@
1
+ module MenuRails::Helpers
2
+
3
+ module MenuHelper
4
+
5
+ def menu_rails(menu)
6
+ raise 'Block must be provided' unless block_given?
7
+
8
+ block_result = nil
9
+
10
+ menu.display_for_controller(self.controller) do
11
+ menu_items = menu_rails_all_items(menu)
12
+
13
+ block_result = yield(menu_items)
14
+ end
15
+
16
+ block_result
17
+ end
18
+
19
+ def menu_rails_each(menu)
20
+ raise 'Block must be provided' unless block_given?
21
+
22
+ menu_rails(menu) do |menu_items|
23
+ menu_items.each_with_index do |menu_item, index|
24
+ yield(menu_item, index)
25
+ end
26
+ end
27
+ end
28
+
29
+ def menu_rails_all_items(menu)
30
+ menu_items = menu.all_menu_items
31
+
32
+ menu_items = menu_items.select do |menu_item|
33
+ if respond_to?(:can?)
34
+ if menu_item.authorization.nil?
35
+ true
36
+ else
37
+ can?(menu_item.authorization[:can], menu_item.authorization[:class_name].constantize)
38
+ end
39
+ else
40
+ true
41
+ end
42
+ end
43
+
44
+ menu_items
45
+ end
46
+
47
+ end
48
+
49
+ end
@@ -1,3 +1,3 @@
1
1
  module MenuRails
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+ require 'internal/app/controllers/pages_controller'
3
+
4
+ describe PagesController do
5
+
6
+ it "assigns @menu" do
7
+ get :home
8
+
9
+ assigns(:menu).should be_an_instance_of(MenuRails::Menu)
10
+ end
11
+
12
+ end
@@ -8,7 +8,8 @@ FactoryGirl.define do
8
8
 
9
9
  factory :menu_item, class: MenuRails::MenuItem do
10
10
  sequence(:mriid) { |n| "menu_item_#{ n }" }
11
- text { Faker::Lorem.word }
11
+ text { Faker::Lorem.word }
12
+ url { Faker::Internet.url }
12
13
  # name { Faker::Name.first_name }
13
14
 
14
15
  # factory :dummy_invalid do
@@ -1,11 +1,14 @@
1
1
  require 'spec_helper'
2
2
  require 'active_support/all'
3
3
 
4
- def menu_rails
5
- @menu_rails ||= YAML::load_file(MenuRails::CONFIG_PATH).with_indifferent_access[:menu_rails]
6
- end
7
-
8
4
  feature "Menu generation" do
5
+ let(:menu) { MenuRails::Menu.get_menu_by_mrid(:client) }
6
+
7
+ before(:each) do
8
+ ActionView::Base.any_instance.stub(:can?) do |accessor, klass|
9
+ klass != NotVisibleController
10
+ end
11
+ end
9
12
 
10
13
  scenario "Ensure capybara is working correctly" do
11
14
  visit root_path
@@ -13,13 +16,29 @@ feature "Menu generation" do
13
16
  page.should have_content("Capybara working correctly")
14
17
  end
15
18
 
16
- # # scenario "Print Home menu item" do
17
- # menu_rails.each do |menu_rails_item|
18
- # scenario "Print #{ menu_rails_item[:text] } menu item" do
19
- # visit root_path
19
+ context ":client menu" do
20
+
21
+ # scenario "Print Home menu item" do
22
+ ['Home', 'About'].each do |menu_rails_item|
23
+ scenario "Print #{ menu_rails_item } menu item" do
24
+ visit root_path
25
+
26
+ page.should have_content(menu_rails_item)
27
+ end
28
+ end
20
29
 
21
- # page.should have_content(menu_rails_item[:text])
22
- # end
23
- # end
30
+ scenario "Home is active" do
31
+ visit root_path
32
+
33
+ find('#menu a.is-active').should have_content('Home')
34
+ end
35
+
36
+ scenario "Dummy1 active? not called, instead it's called always_inactive" do
37
+ menu.get_menu_item_by_mriid(:dummy1).should_receive(:always_inactive).with(no_args).and_call_original
38
+
39
+ visit root_path
40
+ end
41
+
42
+ end
24
43
 
25
44
  end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe MenuRails::Helpers::MenuHelper do
4
+ let(:menu) { MenuRails::Menu.get_menu_by_mrid(:client) }
5
+
6
+ it { view.menu_rails_all_items(menu).first.text.should == 'Home' }
7
+ it { view.menu_rails_all_items(menu).map(&:text).should include('Not visible') }
8
+
9
+ it "is not active because url it's a string" do
10
+ view.menu_rails(menu){ |menu_items| menu_items.second.active? }.should be_false
11
+ end
12
+
13
+ context "with cancan" do
14
+ before(:each) do
15
+ view.stub(:can?) do |accessor, klass|
16
+ klass != NotVisibleController
17
+ end
18
+ end
19
+
20
+ it { view.menu_rails_all_items(menu).map(&:text).should_not include('Not visible') }
21
+
22
+ end
23
+
24
+ end
@@ -0,0 +1,2 @@
1
+ class NotVisibleController < ApplicationController
2
+ end
@@ -1,6 +1,13 @@
1
1
  class PagesController < ApplicationController
2
2
 
3
3
  def home
4
+ @menu = MenuRails::Menu.get_menu_by_mrid(:client)
5
+ end
6
+
7
+ def about
8
+ end
9
+
10
+ def dummy1
4
11
  end
5
12
 
6
13
  end
@@ -0,0 +1,7 @@
1
+ class DummyMenuItem < MenuRails::MenuItem
2
+
3
+ def always_inactive
4
+ false
5
+ end
6
+
7
+ end
@@ -0,0 +1,2 @@
1
+ class SecondDummyMenu < MenuRails::Menu
2
+ end
@@ -0,0 +1,2 @@
1
+ class SecondDummyMenuItem < MenuRails::MenuItem
2
+ end
@@ -1 +1,7 @@
1
- Capybara working correctly
1
+ Capybara working correctly
2
+
3
+ <div id="menu">
4
+ <% menu_rails_each(@menu) do |menu_item| %>
5
+ <%= link_to(menu_item.to_s, menu_item.url, class: menu_item.active? ? ['is-active'] : []) %>
6
+ <% end %>
7
+ </div>
@@ -1,42 +1,44 @@
1
1
  menu_rails:
2
2
  client:
3
3
  menu_items:
4
- - mriid: :home
5
- text: Home
4
+ - home:
5
+ text: Home
6
+ url: :root_path
7
+ authorization:
8
+ can: :read
9
+ class_name: PagesController
10
+ - contact:
11
+ text: Contact
12
+ url: "http://www.myrandomurl.com/"
13
+ authorization:
14
+ class_name: MissingCanKey
15
+ active:
16
+ # It's ignored because url is a string
17
+ controller_only: true
18
+ - about:
19
+ text: About
20
+ url: :about_path
21
+ - dummy1:
22
+ text: Dummy1
23
+ url: :dummy1_path
24
+ active:
25
+ method: :always_inactive
26
+ - not_visible:
27
+ text: Not visible
28
+ url: :root_path
29
+ authorization:
30
+ can: :read
31
+ class_name: NotVisibleController
6
32
  admin:
7
33
  menu_items:
8
- - mriid: :home
9
- text: Home
10
- # app_config:
11
- # client:
12
- # menu:
13
- # - text: Home
14
- # class_name: 'PagesController'
15
- # can: :read
16
- # url: :root_path
17
- # - text: About
18
- # class_name: 'PagesController'
19
- # can: :read
20
- # url: :root_path
21
- # - text: Archives
22
- # class_name: 'PagesController'
23
- # can: :read
24
- # url: :root_path
25
- # - text: Dropdown
26
- # class_name: 'PagesController'
27
- # can: :read
28
- # url: :root_path
29
- # - text: Templates
30
- # class_name: 'PagesController'
31
- # can: :read
32
- # url: :root_path
33
- # - text: Contact
34
- # class_name: 'PagesController'
35
- # can: :read
36
- # url: :root_path
37
- # last: true
38
- # admin:
39
- # menu:
40
- # - text: Home
41
- # class_name: 'Admin::PagesController'
42
- # can: :read
34
+ - home:
35
+ text: Home
36
+ url: :root_path
37
+
38
+ custom_class_menu:
39
+ class_name: SecondDummyMenu
40
+ menu_items:
41
+ - home:
42
+ class_name: SecondDummyMenuItem
43
+ text: Home
44
+ url: :root_path
@@ -1,3 +1,6 @@
1
1
  Rails.application.routes.draw do
2
2
  root to: 'pages#home'
3
+
4
+ get 'about' => 'pages#about'
5
+ get 'dummy1' => 'pages#dummy1'
3
6
  end
@@ -5,19 +5,47 @@ describe MenuRails::MenuItem do
5
5
  it "has a valid factory" do
6
6
  -> {FactoryGirl.build(:menu_item)}.should_not raise_error
7
7
  end
8
-
8
+
9
+ it { FactoryGirl.build(:menu_item, text: 'Dummy', url: 'http://dummy.com/').should be_valid }
10
+ it { FactoryGirl.build(:menu_item, url: nil).should_not be_valid }
11
+
9
12
  let(:menu_item) { FactoryGirl.build(:menu_item) }
10
13
 
11
- it { menu_item.should respond_to(:mriid, :text, :menu) }
12
- it { menu_item.text.should be_an_instance_of String }
13
- it { menu_item.mriid.should be_an_instance_of Symbol }
14
+ it do
15
+ menu_item.should respond_to(:mriid,
16
+ :text,
17
+ :menu,
18
+ :authorization,
19
+ :url)
20
+ end
21
+
22
+ it { menu_item.text.should be_an_instance_of String }
23
+ it { menu_item.mriid.should be_an_instance_of Symbol }
14
24
 
15
25
  context "with menu :client as parent" do
16
- let(:menu) { MenuRails::Menu.get_menu_by_mrid(:client) }
17
- let(:menu_item) { menu.menu_items.first }
26
+ let(:menu) { MenuRails::Menu.get_menu_by_mrid(:client) }
27
+ let(:first_menu_item) { menu.all_menu_items.first }
28
+ let(:second_menu_item) { menu.all_menu_items.second }
29
+
30
+ it { menu.get_menu_item_by_mriid(:home).should be first_menu_item }
31
+ it { menu.get_menu_item_by_mriid(:dummy1).should be_an_instance_of(DummyMenuItem) }
32
+
33
+ it { first_menu_item.menu.should be menu }
34
+ it { first_menu_item.authorization.should == { can: :read, class_name: 'PagesController' } }
35
+ it { first_menu_item.url.should == '/' }
36
+
37
+ it { second_menu_item.authorization.should be nil }
38
+ it { second_menu_item.url.should == second_menu_item.url_text }
39
+ it { second_menu_item.active_controller_only?.should be_true }
40
+
41
+ end
18
42
 
19
- it { menu_item.menu.should be menu }
43
+ context "with menu :custom_class_menu as parent" do
44
+ let(:menu) { MenuRails::Menu.get_menu_by_mrid(:custom_class_menu) }
45
+ let(:first_menu_item) { menu.all_menu_items.first }
20
46
 
47
+ it { menu.should be_an_instance_of SecondDummyMenu }
48
+ it { first_menu_item.should be_an_instance_of SecondDummyMenuItem }
21
49
  end
22
50
 
23
51
  end
@@ -4,6 +4,7 @@ describe MenuRails::Menu do
4
4
 
5
5
  it { described_class.should respond_to(:get_menu_by_mrid) }
6
6
  it { described_class.get_menu_by_mrid(:client).should be_an_instance_of described_class }
7
+ it { described_class.get_menu_by_mrid(:admin).should be_an_instance_of described_class }
7
8
  it { described_class.get_menu_by_mrid(:not_exist).should be_nil }
8
9
  it { described_class.get_menu_by_mrid(:client).mrid.should be :client }
9
10
 
@@ -22,6 +23,18 @@ describe MenuRails::Menu do
22
23
  it { menu.should respond_to(:menu_items, :mrid) }
23
24
  it { menu.menu_items.should respond_to(:size, :each) }
24
25
  it { menu.mrid.should be_a_kind_of Symbol }
25
- it { menu.menu_items.first.text.should match 'Home' }
26
+ it { menu.menu_items.first.text.should == 'Home' }
27
+ it { menu.all_menu_items.should be menu.menu_items }
28
+
29
+ it "uses given instance as controller while displaying in controller" do
30
+ fake_controller = double('Fake controller')
31
+ used_controller = nil
32
+
33
+ menu.display_for_controller(fake_controller) do
34
+ used_controller = menu.controller
35
+ end
36
+
37
+ used_controller.should be fake_controller
38
+ end
26
39
 
27
40
  end
@@ -8,7 +8,8 @@ require 'capybara/rspec'
8
8
  Combustion.initialize! :active_record,
9
9
  :action_controller,
10
10
  :action_view do
11
- config.i18n.enforce_available_locales = false
11
+ config.i18n.enforce_available_locales = false
12
+ config.menu_rails.menu_item_class_name = 'DummyMenuItem'
12
13
  end
13
14
 
14
15
  Bundler.require(:default, :development, :test)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: menu-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fire-Dragon-DoL
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-11 00:00:00.000000000 Z
11
+ date: 2013-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -230,6 +230,7 @@ extra_rdoc_files: []
230
230
  files:
231
231
  - .gitignore
232
232
  - .rspec
233
+ - .ruby-version
233
234
  - Gemfile
234
235
  - LICENSE.txt
235
236
  - README.md
@@ -238,14 +239,25 @@ files:
238
239
  - app/models/menu_rails/menu_item.rb
239
240
  - config.ru
240
241
  - lib/menu-rails.rb
242
+ - lib/menu-rails/base_menu.rb
241
243
  - lib/menu-rails/engine.rb
244
+ - lib/menu-rails/helpers.rb
245
+ - lib/menu-rails/helpers/menu_helper.rb
242
246
  - lib/menu-rails/version.rb
243
247
  - menu-rails.gemspec
248
+ - spec/controllers/pages_controller_spec.rb
244
249
  - spec/factories.rb
245
250
  - spec/features/pages_spec.rb
251
+ - spec/helpers/menu_helper_spec.rb
246
252
  - spec/internal/app/controllers/application_controller.rb
253
+ - spec/internal/app/controllers/not_visible_controller.rb
247
254
  - spec/internal/app/controllers/pages_controller.rb
255
+ - spec/internal/app/models/dummy_menu_item.rb
256
+ - spec/internal/app/models/second_dummy_menu.rb
257
+ - spec/internal/app/models/second_dummy_menu_item.rb
248
258
  - spec/internal/app/views/layouts/application.html.erb
259
+ - spec/internal/app/views/pages/about.html.erb
260
+ - spec/internal/app/views/pages/dummy1.html.erb
249
261
  - spec/internal/app/views/pages/home.html.erb
250
262
  - spec/internal/config/database.yml
251
263
  - spec/internal/config/menu-rails.yml
@@ -276,17 +288,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
276
288
  version: '0'
277
289
  requirements: []
278
290
  rubyforge_project:
279
- rubygems_version: 2.0.3
291
+ rubygems_version: 2.1.11
280
292
  signing_key:
281
293
  specification_version: 4
282
294
  summary: Gem that helps creating menu in views and setting the currently active link
283
295
  item
284
296
  test_files:
297
+ - spec/controllers/pages_controller_spec.rb
285
298
  - spec/factories.rb
286
299
  - spec/features/pages_spec.rb
300
+ - spec/helpers/menu_helper_spec.rb
287
301
  - spec/internal/app/controllers/application_controller.rb
302
+ - spec/internal/app/controllers/not_visible_controller.rb
288
303
  - spec/internal/app/controllers/pages_controller.rb
304
+ - spec/internal/app/models/dummy_menu_item.rb
305
+ - spec/internal/app/models/second_dummy_menu.rb
306
+ - spec/internal/app/models/second_dummy_menu_item.rb
289
307
  - spec/internal/app/views/layouts/application.html.erb
308
+ - spec/internal/app/views/pages/about.html.erb
309
+ - spec/internal/app/views/pages/dummy1.html.erb
290
310
  - spec/internal/app/views/pages/home.html.erb
291
311
  - spec/internal/config/database.yml
292
312
  - spec/internal/config/menu-rails.yml