cells 3.7.0 → 3.7.1
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/CHANGES.textile +4 -0
- data/lib/cell/base.rb +41 -0
- data/lib/cell/rails.rb +1 -1
- data/lib/cells.rb +2 -2
- data/lib/cells/version.rb +1 -1
- data/test/cells_module_test.rb +7 -4
- metadata +4 -3
data/CHANGES.textile
CHANGED
data/lib/cell/base.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'abstract_controller'
|
2
|
+
require 'cell/builder'
|
3
|
+
require 'cell/caching'
|
4
|
+
require 'cell/rendering'
|
5
|
+
require 'cell/rails3_0_strategy' if Cells.rails3_0?
|
6
|
+
require 'cell/rails3_1_strategy' if Cells.rails3_1_or_more?
|
7
|
+
|
8
|
+
module Cell
|
9
|
+
class Base < AbstractController::Base
|
10
|
+
abstract!
|
11
|
+
DEFAULT_VIEW_PATHS = [File.join('app', 'cells')]
|
12
|
+
|
13
|
+
extend Builder
|
14
|
+
include AbstractController
|
15
|
+
include AbstractController::Rendering, Layouts, Helpers, Callbacks, Translation, Logger
|
16
|
+
|
17
|
+
include VersionStrategy
|
18
|
+
include Rendering
|
19
|
+
include Caching
|
20
|
+
|
21
|
+
|
22
|
+
class View < ActionView::Base
|
23
|
+
def render(*args, &block)
|
24
|
+
options = args.first.is_a?(::Hash) ? args.first : {} # this is copied from #render by intention.
|
25
|
+
|
26
|
+
return controller.render(*args, &block) if options[:state] or options[:view]
|
27
|
+
super
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
# Called in Railtie at initialization time.
|
33
|
+
def self.setup_view_paths!
|
34
|
+
self.view_paths = DEFAULT_VIEW_PATHS
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.controller_path
|
38
|
+
@controller_path ||= name.sub(/Cell$/, '').underscore unless anonymous?
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/cell/rails.rb
CHANGED
data/lib/cells.rb
CHANGED
data/lib/cells/version.rb
CHANGED
data/test/cells_module_test.rb
CHANGED
@@ -20,12 +20,15 @@ class CellsModuleTest < ActiveSupport::TestCase
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
should "respond to #
|
23
|
+
should "respond to #rails3_1_or_more?" do
|
24
24
|
if Rails::VERSION::MINOR == 0
|
25
|
-
assert ! Cells.
|
25
|
+
assert ! Cells.rails3_1_or_more?
|
26
26
|
assert Cells.rails3_0?
|
27
|
-
elsif
|
28
|
-
assert Cells.
|
27
|
+
elsif Rails::VERSION::MINOR == 1
|
28
|
+
assert Cells.rails3_1_or_more?
|
29
|
+
assert ! Cells.rails3_0?
|
30
|
+
elsif Rails::VERSION::MINOR == 2
|
31
|
+
assert Cells.rails3_1_or_more?
|
29
32
|
assert ! Cells.rails3_0?
|
30
33
|
end
|
31
34
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 3
|
7
7
|
- 7
|
8
|
-
-
|
9
|
-
version: 3.7.
|
8
|
+
- 1
|
9
|
+
version: 3.7.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Nick Sutterer
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-12-20 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- about.yml
|
130
130
|
- cells.gemspec
|
131
131
|
- lib/cell.rb
|
132
|
+
- lib/cell/base.rb
|
132
133
|
- lib/cell/caching.rb
|
133
134
|
- lib/cell/deprecations.rb
|
134
135
|
- lib/cell/rails.rb
|