golden-menu 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/app/controllers/golden/menu/hierarchical_menus_controller.rb +14 -1
- data/app/models/concerns/golden/menu/golden_menu_resource.rb +0 -1
- data/app/models/golden/menu/hierarchical_menu.rb +0 -2
- data/app/views/golden/menu/hierarchical_menus/_table.html.erb +1 -1
- data/config/locales/menus.en.yml +1 -0
- data/config/locales/menus.zh-TW.yml +1 -0
- data/lib/generators/golden/menu/templates/golden_menu.rb +3 -0
- data/lib/golden/menu.rb +5 -0
- data/lib/golden/menu/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24aad3f23c4d5d4eff16137628f0827c1f55f25d
|
4
|
+
data.tar.gz: 27d23e3f7d04850289387cd766df0a43280cefee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39d51c4c7da2ddb3d8a0744649492bede430066e095c2f503181a56e367a4eaf677baecfd59adedb71dd965bb8b0911fb820cadb1bdfb30c27d3b271c3a85b5a
|
7
|
+
data.tar.gz: 0e60e9501cd1db96a00ba01cefe6d53bceffd6351f0ffa7a825b7c32ea4f348ce0bbd35d7198395e9d8bfa3758cf6508888f888f46b1f80318e910c5cc95d9e6
|
data/README.md
CHANGED
@@ -7,8 +7,7 @@ The `golden-menu` creates menus by building a hierarchiacal tree first and linki
|
|
7
7
|
For Rails 4 project, `Gemfile` should have
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem '
|
11
|
-
gem 'devise', '~> 3.0.0.rc'
|
10
|
+
gem 'devise', '> 3.0'
|
12
11
|
gem 'cancan'
|
13
12
|
gem 'simple_form', '~> 3.0.0.rc'
|
14
13
|
gem 'anjlab-bootstrap-rails', require: 'bootstrap-rails'
|
@@ -2,6 +2,7 @@ class Golden::Menu::HierarchicalMenusController < ApplicationController
|
|
2
2
|
include ::TheSortableTreeController::Rebuild
|
3
3
|
|
4
4
|
before_filter :authenticate_session!
|
5
|
+
before_filter :new_menu, only: [:create]
|
5
6
|
load_and_authorize_resource :menu, class: 'Golden::Menu::HierarchicalMenu', parent: false #, find_by: :url
|
6
7
|
|
7
8
|
def index
|
@@ -26,7 +27,7 @@ class Golden::Menu::HierarchicalMenusController < ApplicationController
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def update
|
29
|
-
@menu.update_attributes
|
30
|
+
@menu.update_attributes menu_params
|
30
31
|
respond_with @menu
|
31
32
|
end
|
32
33
|
|
@@ -42,6 +43,18 @@ class Golden::Menu::HierarchicalMenusController < ApplicationController
|
|
42
43
|
|
43
44
|
protected
|
44
45
|
|
46
|
+
def menu_params
|
47
|
+
if params.respond_to? :permit
|
48
|
+
params.require(:menu).permit(Golden::Menu.permitted_fields)
|
49
|
+
else
|
50
|
+
params[:menu]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def new_menu
|
55
|
+
@menu = Golden::Menu::HierarchicalMenu.new menu_params
|
56
|
+
end
|
57
|
+
|
45
58
|
def the_define_common_variables
|
46
59
|
['@menu', 'menus', Golden::Menu::HierarchicalMenu]
|
47
60
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Golden::Menu::GoldenMenuResource
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
included do
|
4
|
-
attr_accessible :menu_ids
|
5
4
|
has_many :menu_resources, class_name: 'Golden::Menu::MenuResource', as: :resource
|
6
5
|
has_many :menus, class_name: 'Golden::Menu::HierarchicalMenu', through: :menu_resources
|
7
6
|
end
|
@@ -3,8 +3,6 @@ class Golden::Menu::HierarchicalMenu < ActiveRecord::Base
|
|
3
3
|
|
4
4
|
self.table_name = 'golden_menus'
|
5
5
|
|
6
|
-
attr_accessible :group, :name, :description, :parent_id, :resource_url
|
7
|
-
|
8
6
|
validates :name, presence: true
|
9
7
|
validates :url, format: { with: /\A([\w\-]{3,})\z/ }, allow_blank: true
|
10
8
|
|
data/config/locales/menus.en.yml
CHANGED
@@ -38,6 +38,7 @@ en:
|
|
38
38
|
hints:
|
39
39
|
golden_menu/hierarchical_menu:
|
40
40
|
menu:
|
41
|
+
name: 'Only characters, numbers and, - are allowed. Minimal 3 characters requied.'
|
41
42
|
group: 'Only root menus (blank parent) need to choose a group'
|
42
43
|
resource_url: 'fill redirect URL while click menu'
|
43
44
|
placeholders:
|
data/lib/golden/menu.rb
CHANGED
data/lib/golden/menu/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: golden-menu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tse-Ching Ho
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|