neuron 0.0.4 → 0.0.5

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.
@@ -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, tag = :h1)
75
+ def collection_title(collection = nil, options = {})
76
76
  collection ||= self.collection
77
- options = {count: collection.count}
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}", options))),
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 << link_to(t("#{controller_i18n_scope}.new", scope: :actions, default: [:new, 'New']), new_resource_path)
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
@@ -1,3 +1,3 @@
1
1
  module Neuron
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
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
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-05-30 00:00:00.000000000Z
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.7.2
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: