mtoros-mega_menus 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'rake'
|
|
4
4
|
begin
|
5
5
|
require 'echoe'
|
6
6
|
|
7
|
-
Echoe.new('mega_menus', '0.8.
|
7
|
+
Echoe.new('mega_menus', '0.8.2') do |p|
|
8
8
|
p.summary = "Treeview menu Gem for Rails"
|
9
9
|
p.description = "Adds a model, controller to perform the tasks in order to have a treeview menu. To use this gem simply install it and write script/generate menu name_of_the_menu"
|
10
10
|
p.author = ['Marko Toros']
|
data/mega_menus.gemspec
CHANGED
@@ -35,11 +35,11 @@ module <%= "#{file_name.capitalize}editorHelper" %>
|
|
35
35
|
allmenus.each do |m|
|
36
36
|
#write the actual menu line for each record
|
37
37
|
if(m.published==TRUE or admin_condition==TRUE)
|
38
|
-
if(m.id==1 and m.children.empty? and admin_depth.include?(m.depth))
|
38
|
+
if(m.id==1 and m.children.empty? and admin_depth.include?(m.depth+1))
|
39
39
|
if(admin_condition)
|
40
40
|
add_menu_form(menu_model, menu_controller, m.id)
|
41
41
|
end
|
42
|
-
concat( "<ul id=\"ul_<%= "#{file_name}" %>_#{m.depth}\" class=\"ul_<%= "#{file_name}" %>_depth_#{m.depth} ul_<%= "#{file_name}" %>\">")
|
42
|
+
concat( "<ul id=\"ul_<%= "#{file_name}" %>_#{m.depth+1}\" class=\"ul_<%= "#{file_name}" %>_depth_#{m.depth} ul_<%= "#{file_name}" %>\">")
|
43
43
|
if(admin_condition)
|
44
44
|
concat( "<li id=\"root_<%= "#{file_name}" %>_add_#{m.id}\" class=\"<%= "#{file_name}" %>_root_add\">")
|
45
45
|
concat( link_to_remote( "<span>Add</span>", {:url => {:controller => menu_controller, :action => '<%= "add_menu_form" %>', '<%= "#{file_name}_id" %>' => m.id,:menu_model=>menu_model, :menu_controller=>menu_controller}}, {:class => "<%= "#{file_name}" %>_links_add", :title=> "Add",:id => "add_<%= "#{file_name}" %>_link_#{m.id}"}))
|
@@ -148,12 +148,18 @@ module <%= "#{file_name.capitalize}editorHelper" %>
|
|
148
148
|
end
|
149
149
|
|
150
150
|
|
151
|
-
def edit_menu_form(menu_model, menu_controller,m)
|
151
|
+
def edit_menu_form(menu_model, menu_controller, m)
|
152
152
|
|
153
153
|
#select only menus that are not submenus!
|
154
|
-
cmenus=menu_model.all
|
154
|
+
cmenus=menu_model.find(:all, :order => "absolute_position")
|
155
155
|
cmenus.delete_if{|ame| (ame.id==m.id || ame.isChildOf(m.id))}
|
156
|
-
|
156
|
+
cmenus.each do |cm|
|
157
|
+
mtitle=cm.title
|
158
|
+
cm.depth.times do
|
159
|
+
mtitle="--" + mtitle
|
160
|
+
end
|
161
|
+
cm.title=mtitle
|
162
|
+
end
|
157
163
|
form_remote_tag( :url => {:controller=>menu_controller, :action=> 'edit_menu'}, :html => {:id => "edit_<%= "#{file_name}" %>_form_#{m.id}",:class => "edit_<%= "#{file_name}" %>_form", :style=>"display: none"}) do
|
158
164
|
concat( "Title:")
|
159
165
|
concat( text_field_tag( "title", m.title, :id=>"e_tft_title_#{m.id}" ))
|
@@ -161,7 +167,7 @@ module <%= "#{file_name.capitalize}editorHelper" %>
|
|
161
167
|
concat( text_field_tag( "link", m.link,:id=>"e_tft_link_#{m.id}"))
|
162
168
|
concat( "Parent:")
|
163
169
|
#concat( text_field_tag("parent_id", m.parent_id, :id=>"e_tft_parent_id_#{m.id}"))
|
164
|
-
concat( select_tag( "parent_id",
|
170
|
+
concat( select_tag( "parent_id", options_from_collection_for_select(cmenus, :id, :title), :id=>"e_tft_parent_id_#{m.id}"))
|
165
171
|
concat( hidden_field_tag( <%= ":#{file_name}_id" %>, m.id,:id=>"e_tft_<%= "#{file_name}" %>_id_#{m.id}"))
|
166
172
|
#concat content_tag :button, "Submit", {:type=>"submit", :class=>"button-submit"}
|
167
173
|
concat( submit_tag( "Edit", :class => "edit__button"))
|
@@ -11,7 +11,7 @@ class <%= "#{'Create' + file_name.capitalize + 's'}" %> < ActiveRecord::Migratio
|
|
11
11
|
t.timestamps
|
12
12
|
end
|
13
13
|
|
14
|
-
<%= file_name.capitalize %>.create :id => 1, :position=>0, :absolute_position=>0, :depth=>
|
14
|
+
<%= file_name.capitalize %>.create :id => 1, :position=>0, :absolute_position=>0, :depth=>0, :parent_id=>0,:published=>FALSE, :title=>"ROOT"
|
15
15
|
end
|
16
16
|
|
17
17
|
|