youthtree-controller-ext 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,41 @@
1
+ YouthTree::ControllerExt.for(:sidebar) do
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ helper_method :show_sidebar?, :hide_sidebar?
7
+ end
8
+
9
+ module ClassMethods
10
+
11
+ def show_sidebar!(opts = {})
12
+ before_filter :show_sidebar!, opts
13
+ end
14
+
15
+ def hide_sidebar!(opts = {})
16
+ before_filter :hide_sidebar!, opts
17
+ end
18
+
19
+ end
20
+
21
+ module InstanceMethods
22
+
23
+ def show_sidebar!
24
+ @hide_sidebar = false
25
+ end
26
+
27
+ def hide_sidebar!
28
+ @hide_sidebar = true
29
+ end
30
+
31
+ def show_sidebar?
32
+ !hide_sidebar?
33
+ end
34
+
35
+ def hide_sidebar?
36
+ defined?(@hide_sidebar) && @hide_sidebar
37
+ end
38
+
39
+ end
40
+
41
+ end
@@ -10,8 +10,8 @@ YouthTree::ControllerExt.for(:translation) do
10
10
 
11
11
  protected
12
12
 
13
- def tf(key)
14
- I18n.t(key.to_sym, :scope => :flash)
13
+ def tf(key, opts = {})
14
+ I18n.t(key.to_sym, opts.merge(:scope => :flash))
15
15
  end
16
16
 
17
17
  def tu(name, options = {})
@@ -3,7 +3,7 @@ require 'active_support/concern'
3
3
  module YouthTree
4
4
  module ControllerExt
5
5
 
6
- VERSION = "0.1.0".freeze
6
+ VERSION = "0.1.1".freeze
7
7
 
8
8
  mattr_accessor :known_extensions
9
9
  self.known_extensions ||= {}
@@ -22,7 +22,7 @@ module YouthTree
22
22
  return known_extensions[name]
23
23
  else
24
24
  constant_name = "#{name.to_s.classify}Ext"
25
- [nil, "YouthTree::ControllerExt", "YouthTree"].each do |namespace|
25
+ [nil, "YouthTree::ControllerExt", "YouthTree", "ControllerExt"].each do |namespace|
26
26
  full = [namespace, constant_name].compact.join("::")
27
27
  begin
28
28
  constant = full.constantize
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{youthtree-controller-ext}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Darcy Laycock"]
12
- s.date = %q{2010-07-08}
12
+ s.date = %q{2010-08-25}
13
13
  s.description = %q{Provides uses_controller_extension and a set of common mixins.}
14
14
  s.email = %q{sutto@sutto.net}
15
15
  s.extra_rdoc_files = [
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  "lib/youth_tree/controller_ext/authlogic_helpers_ext.rb",
28
28
  "lib/youth_tree/controller_ext/authorization_helpers_ext.rb",
29
29
  "lib/youth_tree/controller_ext/pseudocephalopod_resource_ext.rb",
30
+ "lib/youth_tree/controller_ext/sidebar_ext.rb",
30
31
  "lib/youth_tree/controller_ext/ssl_requirement_ext.rb",
31
32
  "lib/youth_tree/controller_ext/title_estuary_ext.rb",
32
33
  "lib/youth_tree/controller_ext/translation_ext.rb",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: youthtree-controller-ext
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
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Darcy Laycock
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-08 00:00:00 +08:00
18
+ date: 2010-08-25 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -55,6 +55,7 @@ files:
55
55
  - lib/youth_tree/controller_ext/authlogic_helpers_ext.rb
56
56
  - lib/youth_tree/controller_ext/authorization_helpers_ext.rb
57
57
  - lib/youth_tree/controller_ext/pseudocephalopod_resource_ext.rb
58
+ - lib/youth_tree/controller_ext/sidebar_ext.rb
58
59
  - lib/youth_tree/controller_ext/ssl_requirement_ext.rb
59
60
  - lib/youth_tree/controller_ext/title_estuary_ext.rb
60
61
  - lib/youth_tree/controller_ext/translation_ext.rb