mtoros-mega_menus 0.5.9 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -5,33 +5,29 @@
5
5
  This gem makes working with menu structures in Rails easier.
6
6
 
7
7
  == FEATURES/PROBLEMS:
8
- The current version creates
9
- * a controller for editing the menu
10
- * views associated to methods written in rjs
11
- * a partial for rendering the menu(for example to be rendered from a menu)
12
- * a helper to configure its working in normal mode and edit mode, selection of menu depths(levels) to be shown
13
- * a model for storing the menu with fields absolute_position and depth to improve performance when the menu is in normal mode
14
- * a generator for rails to ease the developers work for using this gem, the menu generator creates a template menu structure that the developer can customize.
15
- * uses session[:menu_id] to identify the selected menu
16
- * the builtin functions are:
17
- * add
18
- * delete
19
- * edit
20
- * move up
21
- * move down
8
+ The current version creates:
9
+ * a controller for editing the menu
10
+ * views associated to methods written in rjs
11
+ * a partial for rendering the menu(for example to be rendered from a menu)
12
+ * a helper to configure its working in normal mode and edit mode, selection of menu depths(levels) to be shown
13
+ * the builtin functions are (add, delete, edit, move up, move down)
14
+ * a model for storing the menu with fields absolute_position and depth to improve performance when the menu is in normal mode
15
+ * a generator for rails to ease the developers work for using this gem, the menu generator creates a template menu structure that the developer can customize.
16
+ * uses session[:menu_id] to identify the selected menu
17
+
22
18
 
23
19
  == STATUS
24
- * Currently writing tests to ensure proper working for future versions.
20
+ * Currently writing tests to ensure proper working for future versions.
25
21
 
26
22
 
27
23
  == REQUIREMENTS:
28
- * Rails 2.2
24
+ * Rails 2.2
29
25
 
30
26
  == NOTES:
31
- * The menu is located in <div id="mega_menus\">
32
- * The selected menu is located in <li class="li_menu_class_selected">
33
- * This two id and class values can be easly changed by editing the mega_menu partial and its helper.
27
+ * The menu is located in <div id="mega_menus\">
28
+ * The selected menu is located in <li class="li_menu_class_selected">
29
+ * This two id and class values can be easly changed by editing the mega_menu partial and its helper.
34
30
 
35
31
  == INSTALL:
36
- * script/generate menu menu_name
32
+ * script/generate menu menu_name
37
33
 
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake'
4
4
  begin
5
5
  require 'echoe'
6
6
 
7
- Echoe.new('mega_menus', '0.5.9') do |p|
7
+ Echoe.new('mega_menus', '0.6.0') 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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{mega_menus}
3
- s.version = "0.5.9"
3
+ s.version = "0.6.0"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Marko Toros"]
@@ -35,8 +35,15 @@ module <%= "#{file_name.capitalize}Helper" %>
35
35
  allmenus=menu_model.find(:all, :order => "absolute_position")
36
36
  #mdp...previous menu depth
37
37
  pmd=1
38
+
39
+ if(!params[:menu_id].nil?)
40
+ menu_id=params[:menu_id]
41
+ elsif(!session[:menu_id].nil?)
42
+ menu_id=session[:menu_id]
43
+ end
44
+ #concat "p= #{params[:menu_id]} ... s= #{session[:menu_id]} .... menu_id = #{menu_id} "
45
+
38
46
  firstm=TRUE
39
- selectm=TRUE
40
47
  allmenus.each do |m|
41
48
  if(m.id!=1)
42
49
  #check if your depth is correct
@@ -53,14 +60,13 @@ module <%= "#{file_name.capitalize}Helper" %>
53
60
  #write the actual menu line for each record
54
61
 
55
62
  #make the selected view appear nicer
56
- if((m.id==params[:menu_id].to_i or (m.id==session[:menu_id]) and selectm))
63
+ if(m.id==menu_id.to_i)
57
64
  concat "<li id=\"li_menu_#{m.id}\" class=\"li_menu_class_selected\">"
58
- session[:menu_id]=m.id
59
- concat link_to "#{m.title} #{m.id} ", {:url=>m.link, :menu_id => m.id}, {:class => "menu_link_depth_#{m.depth}", :id => "menu_link_#{m.id}"}
60
- selectm=false
65
+ concat "<a class=\"selected_menu\", id =\"menu_link_#{m.id}\" href=\"#{m.link}?menu_id=#{m.id}\"> #{m.title} #{m.id} </a>"
66
+ session[:menu_id]=menu_id
61
67
  else
62
68
  concat "<li id=\"li_menu_#{m.id}\" class=\"li_menu_class\">"
63
- concat link_to "#{m.title} #{m.id} ", {:url=>m.link, :menu_id => m.id}, {:class => "menu_link_depth_#{m.depth}", :id => "menu_link_#{m.id}"}
69
+ concat "<a class=\"menu_link_depth_#{m.depth}\", id =\"menu_link_#{m.id}\" href=\"#{m.link}?menu_id=#{m.id}\"> #{m.title} #{m.id} </a>"
64
70
  end
65
71
  if(admin_condition)
66
72
  concat link_to_remote "Add", {:url => {:controller => menu_controller, :action => 'add_menu_form', :menu_id => m.id,:menu_model=>menu_model, :menu_controller=>menu_controller}}, {:class => "menu_links_add_#{m.depth}", :id => "add_menu_link_#{m.id}"}
@@ -82,15 +88,13 @@ module <%= "#{file_name.capitalize}Helper" %>
82
88
 
83
89
  def add_menu_form(menu_model, menu_controller, menu_id)
84
90
  form_remote_tag :url => {:controller=>menu_controller, :action=> 'add_menu'}, :html => {:id => "add_menu_form_#{menu_id}", :style=>"display: none"} do
85
- concat "<div>"
86
91
  concat "Title:"
87
92
  concat text_field_tag "title", "title"
88
93
  concat "Link:"
89
94
  concat text_field_tag "link", "link"
90
95
  concat hidden_field_tag :menu_id, menu_id
91
96
  #content_tag :button, "Submit", {:type=>"submit", :class=>"button-submit"}
92
- concat submit_tag "Add", :class => "add_edit_button"
93
- concat "</div>"
97
+ concat submit_tag "Add", :class => "add_button"
94
98
  end
95
99
  return nil
96
100
  end
@@ -98,7 +102,6 @@ module <%= "#{file_name.capitalize}Helper" %>
98
102
 
99
103
  def edit_menu_form(menu_model, menu_controller,m)
100
104
  form_remote_tag :url => {:controller=>menu_controller, :action=> 'edit_menu'}, :html => {:id => "edit_menu_form_#{m.id}", :style=>"display: none"} do
101
- concat "<div>"
102
105
  concat "Title:"
103
106
  concat text_field_tag "title", m.title
104
107
  concat "Link:"
@@ -107,8 +110,7 @@ module <%= "#{file_name.capitalize}Helper" %>
107
110
  concat text_field_tag "parent_id", m.parent_id
108
111
  concat hidden_field_tag :menu_id, m.id
109
112
  #concat content_tag :button, "Submit", {:type=>"submit", :class=>"button-submit"}
110
- concat submit_tag "Edit", :class => "add_edit_button"
111
- concat "</div>"
113
+ concat submit_tag "Edit", :class => "edit__button"
112
114
  end
113
115
  return nil
114
116
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtoros-mega_menus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marko Toros