qui-toolbar 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/qui-toolbar-base.rb +13 -6
  3. metadata +3 -3
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ begin
9
9
  gemspec.email = "marcin@saepia.net"
10
10
  gemspec.homepage = "http://q.saepia.net"
11
11
  gemspec.authors = ["Marcin Lewandowski"]
12
- gemspec.version = "0.0.2"
12
+ gemspec.version = "0.0.3"
13
13
  gemspec.files = Rake::FileList.new [ "MIT-LICENSE", "Rakefile", "public/stylesheets/qui/*", "lib/*", "rails/*", "README.rdoc" ]
14
14
  end
15
15
  rescue LoadError
@@ -4,7 +4,7 @@ module QUI
4
4
  include ActionView::Helpers::UrlHelper
5
5
  include ActionView::Helpers::AssetTagHelper
6
6
  include ActionView::Helpers::TagHelper
7
-
7
+
8
8
  def initialize(binding)
9
9
  @binding = binding
10
10
  @controller = eval("controller", @binding)
@@ -19,7 +19,7 @@ module QUI
19
19
  end
20
20
 
21
21
  def delete
22
- add_toolbar_link_to({ :controller => controller_name, :action => "destroy", :method => :post }, :action => :delete)
22
+ add_toolbar_link_to({ :controller => controller_name, :action => "destroy" }, { :link_options => { :confirm => true, :method => :delete }, :action => :delete })
23
23
  end
24
24
 
25
25
  protected
@@ -34,15 +34,22 @@ module QUI
34
34
  d = description
35
35
  end
36
36
 
37
- if options[:icon]
37
+ if options[:action]
38
38
  options[:icon_alt] ||= ""
39
- d = image_tag(File.join("qui/toolbar/", options[:icon]), :alt => options[:icon_alt]) + d
39
+ d = image_tag(File.join("qui/toolbar/", "#{options[:action]}.png"), :alt => options[:icon_alt]) + d
40
+ end
41
+
42
+ link_to_options = {}
43
+ if options[:link_options]
44
+ link_to_options[:confirm] = I18n.t(:"toolbar.deleteConfirmation") if options[:link_options][:confirm]
45
+ link_to_options[:method] = options[:link_options][:method] if options[:link_options][:method]
40
46
  end
41
- link_to d, url, options
47
+
48
+ eval "link_to #{d.inspect}, #{url.inspect}, #{link_to_options.inspect}", @binding
42
49
  end
43
50
 
44
51
  def add_toolbar_link_to(url, options = {})
45
- toolbar_link_to :"toolbar.#{options[:action]}", url, :icon => "#{options[:action]}.png"
52
+ toolbar_link_to :"toolbar.#{options[:action]}", url, options
46
53
  end
47
54
  end
48
55
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qui-toolbar
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marcin Lewandowski