tkh_menus 0.0.2 → 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/app/assets/images/drag-handle.gif +0 -0
- data/app/assets/javascripts/drag-and-sort.js.coffee +6 -0
- data/app/views/shared/_context_menu.html.erb +48 -17
- data/lib/generators/tkh_menus/create_or_update_migrations/create_or_update_migrations_generator.rb +1 -0
- data/lib/generators/tkh_menus/create_or_update_migrations/templates/add_menu_position_to_pages.rb +9 -0
- data/lib/tkh_menus/version.rb +1 -1
- metadata +7 -4
data/CHANGELOG.md
CHANGED
Binary file
|
@@ -1,21 +1,52 @@
|
|
1
1
|
<% content_for :context_menu do %>
|
2
|
-
<% if @page %>
|
3
|
-
<% if @page.has_children? %>
|
4
|
-
<h2><%= @page.nickname %></h2>
|
5
|
-
<ul>
|
6
|
-
<% for page in @page.children %>
|
7
|
-
<%= content_tag :li, link_to(page.nickname, page) %>
|
8
|
-
<% end %>
|
9
|
-
</ul>
|
10
|
-
<% end %>
|
11
2
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
3
|
+
<% unless administrator? # basic functionality for all users %>
|
4
|
+
<% if @page %>
|
5
|
+
<% if @page.has_children? %>
|
6
|
+
<h2><%= @page.nickname %></h2>
|
7
|
+
<ul>
|
8
|
+
<% for page in @page.children %>
|
9
|
+
<%= content_tag :li, link_to(page.nickname, page) %>
|
10
|
+
<% end %>
|
11
|
+
</ul>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% if !@page.orphan? && @page.has_siblings? %>
|
15
|
+
<h2><%= link_to @page.parent.nickname, @page.parent %></h2>
|
16
|
+
<ul>
|
17
|
+
<% for page in @page.siblings %>
|
18
|
+
<%= content_tag :li, link_to(page.nickname, page) %>
|
19
|
+
<% end %>
|
20
|
+
</ul>
|
21
|
+
<% end %>
|
22
|
+
<% end -%>
|
23
|
+
|
24
|
+
<% else # administrators can reorder menu pages %>
|
25
|
+
|
26
|
+
<% if @page %>
|
27
|
+
<% if @page.has_children? %>
|
28
|
+
<h2><%= @page.nickname %></h2>
|
29
|
+
<ul class="draggable" data-update-url="<%= sort_pages_path %>">
|
30
|
+
<% for page in @page.children.by_menu_position %>
|
31
|
+
<%= content_tag :li, page, class: 'page', id: "page_#{page.id}" do %>
|
32
|
+
<%= image_tag 'drag-handle.gif', :class => 'handle silhouette' %> <%= link_to page.nickname, page -%>
|
33
|
+
<% end -%>
|
34
|
+
<% end %>
|
35
|
+
</ul>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
<% if !@page.orphan? && @page.has_siblings? %>
|
39
|
+
<h2><%= link_to @page.parent.nickname, @page.parent %></h2>
|
40
|
+
<ul class="draggable" data-update-url="<%= sort_pages_path %>">
|
41
|
+
<% for page in @page.siblings.by_menu_position %>
|
42
|
+
<%= content_tag :li, page, class: 'page', id: "page_#{page.id}" do %>
|
43
|
+
<%= image_tag 'drag-handle.gif', :class => 'handle silhouette' %> <%= link_to page.nickname, page -%>
|
44
|
+
<% end -%>
|
45
|
+
<% end %>
|
46
|
+
</ul>
|
47
|
+
<% end %>
|
48
|
+
<% end -%>
|
49
|
+
|
20
50
|
<% end -%>
|
51
|
+
|
21
52
|
<% end -%>
|
data/lib/tkh_menus/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tkh_menus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.1'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -98,6 +98,8 @@ executables: []
|
|
98
98
|
extensions: []
|
99
99
|
extra_rdoc_files: []
|
100
100
|
files:
|
101
|
+
- app/assets/images/drag-handle.gif
|
102
|
+
- app/assets/javascripts/drag-and-sort.js.coffee
|
101
103
|
- app/controllers/menus_controller.rb
|
102
104
|
- app/models/menu.rb
|
103
105
|
- app/views/menus/_form.html.erb
|
@@ -114,6 +116,7 @@ files:
|
|
114
116
|
- lib/generators/tkh_menus/create_or_update_locales/templates/es.yml
|
115
117
|
- lib/generators/tkh_menus/create_or_update_locales/templates/fr.yml
|
116
118
|
- lib/generators/tkh_menus/create_or_update_migrations/create_or_update_migrations_generator.rb
|
119
|
+
- lib/generators/tkh_menus/create_or_update_migrations/templates/add_menu_position_to_pages.rb
|
117
120
|
- lib/generators/tkh_menus/create_or_update_migrations/templates/create_menus.rb
|
118
121
|
- lib/tasks/tkh_menus_tasks.rake
|
119
122
|
- lib/tkh_menus/version.rb
|
@@ -166,7 +169,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
169
|
version: '0'
|
167
170
|
segments:
|
168
171
|
- 0
|
169
|
-
hash: -
|
172
|
+
hash: -2983082608256837938
|
170
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
174
|
none: false
|
172
175
|
requirements:
|
@@ -175,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
178
|
version: '0'
|
176
179
|
segments:
|
177
180
|
- 0
|
178
|
-
hash: -
|
181
|
+
hash: -2983082608256837938
|
179
182
|
requirements: []
|
180
183
|
rubyforge_project:
|
181
184
|
rubygems_version: 1.8.23
|