lolita-menu 0.0.6 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,3 +1,12 @@
1
+ === Version 0.0.8 / 2011-06-09
2
+ * Enhancements
3
+ * Delete functionality
4
+
5
+ === Version 0.0.7 / 2011-05-20
6
+ * Enhancements
7
+ * Notification after operations with menu items.
8
+ * Builder accept conditions
9
+
1
10
  === Version 0.0.6 / 2011-05-19
2
11
  * Bug fixes
3
12
  * Can't recognize HAML files in projects without haml.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.8
@@ -6,9 +6,10 @@ class MenuItemsController < ActionController::Base
6
6
 
7
7
  def create
8
8
  menu=Menu.find_by_id(params[:menu_id])
9
- item=MenuItem.create!(:name=>"new item",:url=>"/",:menu_id=>params[:menu_id])
9
+ item=MenuItem.create!(:name=>"new item",:url=>"/",:menu_id => params[:menu_id])
10
10
  menu.append(item)
11
- render :partial=>"row", :locals=>{:item=>item}
11
+ response.headers["Lolita-Notice"] = I18n.t("lolita.menu.branch created")
12
+ render_component "lolita/menu_items", :row, :item => item, :menu => menu
12
13
  end
13
14
 
14
15
  def update
@@ -36,6 +37,7 @@ class MenuItemsController < ActionController::Base
36
37
  def destroy
37
38
  item=MenuItem.find_by_id(params[:id])
38
39
  item.destroy
40
+ response.headers["Lolita-Notice"] = I18n.t("lolita.menu.branch deleted")
39
41
  render :json=>{:id=>item.id}
40
42
  end
41
43
  end
data/app/models/menu.rb CHANGED
@@ -12,7 +12,7 @@ class Menu < ActiveRecord::Base
12
12
  lolita do
13
13
  list do
14
14
  column :name
15
- builder :name=>"lolita/menu",:state=>"list"
15
+ builder :name=>"/lolita/menu",:state=>"list", :if=>{:state=>:display}
16
16
  end
17
17
  tab(:content) do
18
18
  field :name
@@ -4,4 +4,4 @@
4
4
  = "Saglabāt izvēlni"
5
5
  %ol{:class=>"menu-items-tree", :id=>"menu_tree_#{menu.id}", :"data-url"=>update_tree_menu_items_path(:menu_id=>menu.id)}
6
6
  - menu.children.each do |item|
7
- = render_component "lolita/menu_items", :row, :item=>item
7
+ = render_component "lolita/menu_items", :row, :item => item, :menu => menu
@@ -5,6 +5,8 @@
5
5
  %span
6
6
  %input{:type=>"text", :value=>item.url,:name=>"url",:class=>"url-input",:"data-id"=>item.id,:"data-url"=>menu_item_path(item.id)}
7
7
  %span
8
- = image_tag("move.png",:style=>"cursor:move;")
8
+ = image_tag("lolita-menu/move.png",:style=>"cursor:move;")
9
+ %span
10
+ = image_tag("lolita-menu/delete.png", :"data-url" => menu_item_path(item.id), :class => "delete-menu-item", :"data-row" => "#item-#{item.id}", :"data-menu" => "#menu_tree_#{menu.id}")
9
11
  %ol
10
- = render_component "lolita/menu_items", "subtree", :item => item
12
+ = render_component "lolita/menu_items", "subtree", :item => item, :menu => menu
@@ -1,2 +1,2 @@
1
1
  - item.children.each do |child_item|
2
- = render_component "lolita/menu_items", "row", :item=>child_item
2
+ = render_component "lolita/menu_items", "row", :item => child_item, :menu => menu
@@ -2,4 +2,6 @@ en:
2
2
  lolita:
3
3
  menu:
4
4
  notice: "Menu saved."
5
- error: "Couldn't save a menu. Try again."
5
+ error: "Couldn't save a menu. Try again."
6
+ "branch created": "New menu item created."
7
+ "branch deleted": "Menu item deleted."
@@ -2,4 +2,6 @@ lv:
2
2
  lolita:
3
3
  menu:
4
4
  notice: "Izvēlne veiksmīgi saglabāta."
5
- error: "Izvēlni neizdevās saglabāt. Mēģiniet vēlreiz."
5
+ error: "Izvēlni neizdevās saglabāt. Mēģiniet vēlreiz."
6
+ "branch created": "Jauns izvēlnes sadaļa izveidota."
7
+ "branch deleted": "Izvēlnes sadaļa dzēsta."
data/lolita-menu.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{lolita-menu}
8
- s.version = "0.0.6"
8
+ s.version = "0.0.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["ITHouse", "Arturs Meisters"]
12
- s.date = %q{2011-05-19}
12
+ s.date = %q{2011-06-09}
13
13
  s.description = %q{Manage public menus for each project inside Lolita.}
14
14
  s.email = %q{support@ithouse.lv}
15
15
  s.extra_rdoc_files = [
@@ -44,6 +44,8 @@ Gem::Specification.new do |s|
44
44
  "lib/lolita-menu/module.rb",
45
45
  "lib/lolita-menu/rails.rb",
46
46
  "lolita-menu.gemspec",
47
+ "public/images/lolita-menu/delete.png",
48
+ "public/images/lolita-menu/move.png",
47
49
  "public/javascripts/jquery-ui-nested-sortables.js",
48
50
  "public/javascripts/lolita/menu-items.js",
49
51
  "public/stylesheets/lolita/menu/style.css",
Binary file
@@ -57,6 +57,19 @@ $(document).ready(function(){
57
57
  })
58
58
  })
59
59
 
60
+ $(".delete-menu-item").click(function(){
61
+ var self = this;
62
+ $.ajax({
63
+ url:$(this).attr("data-url"),
64
+ type:"delete",
65
+ dataType: "json",
66
+ success:function(data){
67
+ $($(self).attr("data-row")).remove();
68
+ save_menu_tree($($(self).attr("data-menu")));
69
+ }
70
+ })
71
+ })
72
+
60
73
  $(".save_menu_tree").click(function(){
61
74
  save_menu_tree($(this).attr("data-id"))
62
75
  })
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: lolita-menu
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - ITHouse
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-05-19 00:00:00 +03:00
14
+ date: 2011-06-09 00:00:00 +03:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -161,6 +161,8 @@ files:
161
161
  - lib/lolita-menu/module.rb
162
162
  - lib/lolita-menu/rails.rb
163
163
  - lolita-menu.gemspec
164
+ - public/images/lolita-menu/delete.png
165
+ - public/images/lolita-menu/move.png
164
166
  - public/javascripts/jquery-ui-nested-sortables.js
165
167
  - public/javascripts/lolita/menu-items.js
166
168
  - public/stylesheets/lolita/menu/style.css
@@ -189,7 +191,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
189
191
  requirements:
190
192
  - - ">="
191
193
  - !ruby/object:Gem::Version
192
- hash: 756297519
194
+ hash: 336753427
193
195
  segments:
194
196
  - 0
195
197
  version: "0"