qui-toolbar 0.0.1 → 0.0.2

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 +15 -3
  3. metadata +4 -4
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.1"
12
+ gemspec.version = "0.0.2"
13
13
  gemspec.files = Rake::FileList.new [ "MIT-LICENSE", "Rakefile", "public/stylesheets/qui/*", "lib/*", "rails/*", "README.rdoc" ]
14
14
  end
15
15
  rescue LoadError
@@ -11,10 +11,22 @@ module QUI
11
11
  end
12
12
 
13
13
  def create
14
- add_toolbar_link_to({ :controller => @controller.class.to_s.gsub("Controller", "").tableize, :action => "new" })
14
+ add_toolbar_link_to({ :controller =>controller_name, :action => "new" }, :action => :create)
15
+ end
16
+
17
+ def edit
18
+ add_toolbar_link_to({ :controller => controller_name, :action => "edit" }, :action => :edit)
19
+ end
20
+
21
+ def delete
22
+ add_toolbar_link_to({ :controller => controller_name, :action => "destroy", :method => :post }, :action => :delete)
15
23
  end
16
24
 
17
25
  protected
26
+ def controller_name
27
+ @controller.class.to_s.gsub("Controller", "").tableize
28
+ end
29
+
18
30
  def toolbar_link_to(description, url, options = {})
19
31
  if description.is_a? Symbol
20
32
  d = I18n.t(description)
@@ -29,8 +41,8 @@ module QUI
29
41
  link_to d, url, options
30
42
  end
31
43
 
32
- def add_toolbar_link_to(url)
33
- toolbar_link_to :"toolbar.create", url, :icon => "create.png"
44
+ def add_toolbar_link_to(url, options = {})
45
+ toolbar_link_to :"toolbar.#{options[:action]}", url, :icon => "#{options[:action]}.png"
34
46
  end
35
47
  end
36
48
  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: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marcin Lewandowski
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-12 00:00:00 +02:00
18
+ date: 2010-08-22 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21