neuron 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/neuron/resources.rb +7 -5
- data/lib/neuron/version.rb +1 -1
- metadata +3 -4
data/lib/neuron/resources.rb
CHANGED
@@ -72,15 +72,17 @@ module Neuron
|
|
72
72
|
link_to(options[:as].html_safe, url, html_options)
|
73
73
|
end
|
74
74
|
|
75
|
-
def collection_title(collection = nil,
|
75
|
+
def collection_title(collection = nil, options = {})
|
76
76
|
collection ||= self.collection
|
77
|
-
|
77
|
+
tag = options.delete(:tag) { :h1 }
|
78
|
+
new_link = options.delete(:new_link) { link_to(t("#{controller_i18n_scope}.new", scope: :actions, default: [:new, 'New']), new_resource_path) }
|
79
|
+
i18n_options = options.delete(:i18n) { {count: collection.count} }
|
78
80
|
''.html_safe.tap do |result|
|
79
81
|
result << title(t("#{controller_i18n_scope}.#{view_name}.title",
|
80
|
-
options.merge(default: t("navigation.#{controller_i18n_scope}.#{action_name}",
|
82
|
+
options.merge(default: t("navigation.#{controller_i18n_scope}.#{action_name}", i18n_options))),
|
81
83
|
tag: tag)
|
82
|
-
if can?(:create, resource_class) && controller.respond_to?(:create)
|
83
|
-
result <<
|
84
|
+
if new_link && can?(:create, resource_class) && controller.respond_to?(:create)
|
85
|
+
result << new_link
|
84
86
|
end
|
85
87
|
end
|
86
88
|
end
|
data/lib/neuron/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neuron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-06-04 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: Code reused in many applications
|
15
15
|
email:
|
@@ -62,9 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
64
|
rubyforge_project: neuron
|
65
|
-
rubygems_version: 1.
|
65
|
+
rubygems_version: 1.8.5
|
66
66
|
signing_key:
|
67
67
|
specification_version: 3
|
68
68
|
summary: Tools for decrease code duplication in rails applications
|
69
69
|
test_files: []
|
70
|
-
has_rdoc:
|