qui-toolbar 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/lib/qui-toolbar-base.rb +15 -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.
|
|
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
|
data/lib/qui-toolbar-base.rb
CHANGED
|
@@ -11,10 +11,22 @@ module QUI
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def create
|
|
14
|
-
add_toolbar_link_to({ :controller =>
|
|
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
|
|
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:
|
|
4
|
+
hash: 27
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.
|
|
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-
|
|
18
|
+
date: 2010-08-22 00:00:00 +02:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies: []
|
|
21
21
|
|