hanami-view 1.2.1 → 1.3.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -6
- data/hanami-view.gemspec +1 -1
- data/lib/hanami/layout.rb +2 -20
- data/lib/hanami/view/configuration.rb +1 -1
- data/lib/hanami/view/rendering.rb +1 -1
- data/lib/hanami/view/rendering/layout_finder.rb +1 -1
- data/lib/hanami/view/version.rb +1 -1
- metadata +6 -7
- data/lib/hanami/view/rendering/null_view.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f100d8a194322c23df67578b55d851460fcca93fb7c4302f5a73478829ca079
|
4
|
+
data.tar.gz: f6952d1e8d562ad3de2bdf281a906bf5db7e152f9725769cf92a487ef6ccb44a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e47e684ee507d0ee4977fc03f8d2808876b0b0d77b954152eafe8900b369ea0a4d3be7ba52e9342791ef14bb3a575ade092e8c65126b0e54ae235693d4abf62
|
7
|
+
data.tar.gz: ad9e79bf19fe03863ee01ff57e652116b7d218bfa64b5aa25d8b439d9ff87047de19d419a7317c43e7512ffdae89cbf6fe4f0bd7e59996d603cfb2034bece1c9
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,10 @@
|
|
1
1
|
# Hanami::View
|
2
2
|
View layer for Hanami
|
3
3
|
|
4
|
-
## v1.
|
5
|
-
### Added
|
6
|
-
- [Luca Guidi] Introduced new, backward compatible, signature to render a layout for testing purposes (eg. `ApplicationLayout.new({ format: :html }, "contents").render`)
|
7
|
-
|
4
|
+
## v1.3.0.beta1 - 2018-08-08
|
8
5
|
### Fixed
|
9
|
-
- [
|
10
|
-
- [
|
6
|
+
- [Ferdinand Niedermann] Ensure to set `:disable_escape` option only for Slim and don't let Tilt to emit a warning for other template engines.
|
7
|
+
- [glaszig] Ensure partial rendering to respect `format` overriding
|
11
8
|
|
12
9
|
## v1.2.0 - 2018-04-06
|
13
10
|
|
data/hanami-view.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.required_ruby_version = '>= 2.3.0'
|
21
21
|
|
22
22
|
spec.add_runtime_dependency 'tilt', '~> 2.0', '>= 2.0.1'
|
23
|
-
spec.add_runtime_dependency 'hanami-utils', '~> 1.
|
23
|
+
spec.add_runtime_dependency 'hanami-utils', '~> 1.3.beta'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
26
26
|
spec.add_development_dependency 'rspec', '~> 3.7'
|
data/lib/hanami/layout.rb
CHANGED
@@ -2,7 +2,6 @@ require 'hanami/utils/class_attribute'
|
|
2
2
|
require 'hanami/view/rendering/layout_registry'
|
3
3
|
require 'hanami/view/rendering/layout_scope'
|
4
4
|
require 'hanami/view/rendering/null_layout'
|
5
|
-
require 'hanami/view/rendering/null_view'
|
6
5
|
|
7
6
|
module Hanami
|
8
7
|
# Layout
|
@@ -117,12 +116,7 @@ module Hanami
|
|
117
116
|
|
118
117
|
# Initialize a layout
|
119
118
|
#
|
120
|
-
# @param scope [Hanami::View::Rendering::Scope
|
121
|
-
# Optionally a scope can be expressed as a Ruby `::Hash`, but it MUST contain
|
122
|
-
# the `:format` key, to specify which template to render.
|
123
|
-
# @option scope [Symbol] :format the format to render (e.g. `:html`, `:xml`, `:json`)
|
124
|
-
# This is mandatory only if a `:Hash` is passed as `scope`.
|
125
|
-
#
|
119
|
+
# @param scope [Hanami::View::Rendering::Scope] view rendering scope
|
126
120
|
# @param rendered [String] the output of the view rendering process
|
127
121
|
#
|
128
122
|
# @api private
|
@@ -130,19 +124,7 @@ module Hanami
|
|
130
124
|
#
|
131
125
|
# @see Hanami::View::Rendering#render
|
132
126
|
def initialize(scope, rendered)
|
133
|
-
|
134
|
-
# See https://github.com/hanami/view/pull/156
|
135
|
-
s, r = *case scope
|
136
|
-
when ::Hash
|
137
|
-
[Hanami::View::Rendering::Scope.new(Hanami::View::Rendering::NullView, scope), rendered]
|
138
|
-
when Hanami::View::Template
|
139
|
-
[Hanami::View::Rendering::Scope.new(Hanami::View::Rendering::NullView, rendered.merge(format: scope.format)), ""]
|
140
|
-
else
|
141
|
-
[scope, rendered]
|
142
|
-
end
|
143
|
-
|
144
|
-
@scope = View::Rendering::LayoutScope.new(self, s)
|
145
|
-
@rendered = r
|
127
|
+
@scope, @rendered = View::Rendering::LayoutScope.new(self, scope), rendered
|
146
128
|
end
|
147
129
|
|
148
130
|
# Render the layout
|
@@ -92,7 +92,7 @@ module Hanami
|
|
92
92
|
def self.for(base)
|
93
93
|
# TODO this implementation is similar to Hanami::Controller::Configuration consider to extract it into Hanami::Utils
|
94
94
|
namespace = Utils::String.namespace(base)
|
95
|
-
framework = Utils::Class.
|
95
|
+
framework = Utils::Class.load("#{namespace}::View") || Utils::Class.load!('Hanami::View')
|
96
96
|
framework.configuration
|
97
97
|
end
|
98
98
|
|
@@ -66,7 +66,7 @@ module Hanami
|
|
66
66
|
when Symbol, String
|
67
67
|
# TODO Move this low level logic into a Hanami::Utils solution
|
68
68
|
class_name = "#{ Utils::String.classify(layout) }#{ SUFFIX }"
|
69
|
-
namespace = Utils::Class.
|
69
|
+
namespace = Utils::Class.load!(namespace)
|
70
70
|
namespace.const_get(class_name)
|
71
71
|
when Class
|
72
72
|
layout
|
data/lib/hanami/view/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tilt
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: 1.3.beta
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 1.3.beta
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,7 +113,6 @@ files:
|
|
113
113
|
- lib/hanami/view/rendering/null_layout.rb
|
114
114
|
- lib/hanami/view/rendering/null_local.rb
|
115
115
|
- lib/hanami/view/rendering/null_template.rb
|
116
|
-
- lib/hanami/view/rendering/null_view.rb
|
117
116
|
- lib/hanami/view/rendering/options.rb
|
118
117
|
- lib/hanami/view/rendering/partial.rb
|
119
118
|
- lib/hanami/view/rendering/partial_file.rb
|
@@ -144,9 +143,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
143
|
version: 2.3.0
|
145
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
145
|
requirements:
|
147
|
-
- - "
|
146
|
+
- - ">"
|
148
147
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
148
|
+
version: 1.3.1
|
150
149
|
requirements: []
|
151
150
|
rubyforge_project:
|
152
151
|
rubygems_version: 2.7.7
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Hanami
|
2
|
-
module View
|
3
|
-
module Rendering
|
4
|
-
# Null Object pattern for view
|
5
|
-
#
|
6
|
-
# It's used when a layout is rendered direcly for testing purposes
|
7
|
-
#
|
8
|
-
# @api private
|
9
|
-
# @since 1.2.1
|
10
|
-
class NullView
|
11
|
-
# Render the layout template
|
12
|
-
#
|
13
|
-
# @return [String] an empty string
|
14
|
-
#
|
15
|
-
# @api private
|
16
|
-
# @since 1.2.1
|
17
|
-
#
|
18
|
-
# @see Hanami::Layout#render
|
19
|
-
# @see Hanami::View::Rendering#render
|
20
|
-
def render
|
21
|
-
""
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|