merb_viewfu 0.3.4 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'merb-core'
5
5
  require 'merb-core/tasks/merb'
6
6
 
7
7
  GEM_NAME = "merb_viewfu"
8
- GEM_VERSION = "0.3.4"
8
+ GEM_VERSION = "0.5"
9
9
  AUTHOR = "Jacques Crocker"
10
10
  EMAIL = "merbjedi@gmail.com"
11
11
  HOMEPAGE = "http://merbjedi.com/"
@@ -1,6 +1,5 @@
1
1
  require "view_fu/tag_helper"
2
2
  require "view_fu/meta_helper"
3
-
4
3
  require "browser_detect/helper"
5
4
  require "headliner/helper"
6
5
 
@@ -8,12 +7,18 @@ require "headliner/helper"
8
7
  if defined?(Merb::Plugins)
9
8
 
10
9
  # Merb gives you a Merb::Plugins.config hash...feel free to put your stuff in your piece of it
11
- Merb::Plugins.config[:viewfu] = {}
10
+ Merb::Plugins.config[:viewfu] = {
11
+ :tags => true,
12
+ :meta => true,
13
+ :headliner => true,
14
+ :browser_detect => true
15
+ }
12
16
 
13
- Merb::BootLoader.before_app_loads do
14
- Merb::Controller.send(:include, ViewFu::MetaHelper)
15
- Merb::Controller.send(:include, ViewFu::TagHelper)
16
- Merb::Controller.send(:include, Headliner::Helper)
17
- Merb::Controller.send(:include, BrowserDetect::Helper)
17
+ Merb::BootLoader.after_app_loads do
18
+ Merb::Plugins.config[:viewfu] ||= {}
19
+ Merb::Controller.send(:include, ViewFu::MetaHelper) if Merb::Plugins.config[:viewfu][:meta]
20
+ Merb::Controller.send(:include, ViewFu::TagHelper) if Merb::Plugins.config[:viewfu][:tags]
21
+ Merb::Controller.send(:include, Headliner::Helper) if Merb::Plugins.config[:viewfu][:headliner]
22
+ Merb::Controller.send(:include, BrowserDetect::Helper) if Merb::Plugins.config[:viewfu][:browser_detect]
18
23
  end
19
24
  end
@@ -43,7 +43,7 @@ module ViewFu
43
43
  #
44
44
  # Now you can use the alternate layout in any of your views as normal
45
45
  # and it will reuse the wrapping html on application.html.erb
46
- def parent_layout
46
+ def parent_layout(layout, &block)
47
47
  render capture(&block), :layout => layout
48
48
  end
49
49
 
@@ -129,19 +129,15 @@ module ViewFu
129
129
  def add_class(css_class, options = {})
130
130
  return {} unless css_class
131
131
 
132
- unless options[:unless].nil?
133
- if options[:unless]
134
- return {}
135
- end
132
+ if options.has_key?(:unless) && options[:unless]
133
+ return {}
136
134
  end
137
135
 
138
- unless options[:if].nil?
139
- if options[:if]
140
- return {:class => css_class}
141
- end
136
+ if options.has_key?(:if) && options[:if]
137
+ return {:class => css_class}
142
138
  end
143
139
 
144
- if options[:if].nil? and options[:unless].nil?
140
+ if !options.has_key?(:if) and !options.has_key?(:unless)
145
141
  {:class => css_class}
146
142
  else
147
143
  {}
@@ -158,16 +154,12 @@ module ViewFu
158
154
 
159
155
  # Return a hidden attribute hash (useful in Haml tags - %div{hidden})
160
156
  def hide(options = {})
161
- unless options[:unless].nil?
162
- if options[:unless]
163
- return {}
164
- end
157
+ if options.has_key?(:unless) && options[:unless]
158
+ return {}
165
159
  end
166
160
 
167
- unless options[:if].nil?
168
- unless options[:if]
169
- return {}
170
- end
161
+ if options.has_key?(:if) && !options[:if]
162
+ return {}
171
163
  end
172
164
 
173
165
  {:style => "display:none"}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb_viewfu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: "0.5"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacques Crocker
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-20 00:00:00 -07:00
12
+ date: 2010-01-09 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -35,17 +35,16 @@ files:
35
35
  - LICENSE
36
36
  - README
37
37
  - Rakefile
38
- - lib/browser_detect
39
38
  - lib/browser_detect/helper.rb
40
- - lib/headliner
41
39
  - lib/headliner/helper.rb
42
40
  - lib/headliner/README
43
41
  - lib/merb_viewfu.rb
44
- - lib/view_fu
45
42
  - lib/view_fu/meta_helper.rb
46
43
  - lib/view_fu/tag_helper.rb
47
44
  has_rdoc: true
48
45
  homepage: http://merbjedi.com/
46
+ licenses: []
47
+
49
48
  post_install_message:
50
49
  rdoc_options: []
51
50
 
@@ -66,9 +65,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
65
  requirements: []
67
66
 
68
67
  rubyforge_project: merb
69
- rubygems_version: 1.3.1
68
+ rubygems_version: 1.3.5
70
69
  signing_key:
71
- specification_version: 2
70
+ specification_version: 3
72
71
  summary: View Helpers for Title, Meta tags, Browser Detect, and Common Tag Helpers
73
72
  test_files: []
74
73