express_templates 0.11.3 → 0.11.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arbre/patches.rb +11 -2
- data/lib/express_templates/components/capabilities/resourceful.rb +1 -0
- data/lib/express_templates/template/handler.rb +1 -1
- data/lib/express_templates/version.rb +1 -1
- data/test/components/configurable_test.rb +1 -3
- data/test/components/forms/radio_test.rb +6 -10
- data/test/components/forms/select_test.rb +3 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9974ff2ee9b43a2995de75414d2b03b7923d589d
|
4
|
+
data.tar.gz: 62bdff14270e90b4b3ce41a5a208f1645cf8fa84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50e19ae0db48d7831f1ba311ffdacb6fb458e744064c6ebb907334f0558971fdce62550f3e455b5505f5a5ab09237e5fa328499bcc3b87b23f32dd154665212d
|
7
|
+
data.tar.gz: 05c26ab0186720edde5d339dff39b9511cb2b594106836629f02791c2d7033efee61cfc825510522ce79b65607054d6d5f22e7cf3085d78cac0a7c7d02ea79d4
|
data/lib/arbre/patches.rb
CHANGED
@@ -18,11 +18,20 @@ module Arbre
|
|
18
18
|
tag.parent = current_arbre_element
|
19
19
|
|
20
20
|
with_current_arbre_element tag do
|
21
|
-
|
21
|
+
begin
|
22
|
+
tag.build(*args, &block)
|
23
|
+
rescue Exception => e
|
24
|
+
on_component_error(tag, e)
|
25
|
+
end
|
22
26
|
end
|
23
27
|
|
24
28
|
tag
|
25
29
|
end
|
30
|
+
|
31
|
+
def on_component_error(tag, exception)
|
32
|
+
tag.content = "Error rendering #{tag.class} component: #{exception.message}"
|
33
|
+
::Rails.logger.error exception
|
34
|
+
end
|
26
35
|
end
|
27
36
|
|
28
37
|
def possible_route_proxy(name)
|
@@ -73,4 +82,4 @@ module Arbre
|
|
73
82
|
|
74
83
|
end
|
75
84
|
|
76
|
-
end
|
85
|
+
end
|
@@ -12,7 +12,7 @@ module ExpressTemplates
|
|
12
12
|
|
13
13
|
# returns a string to be eval'd
|
14
14
|
source = "(#{ExpressTemplates.compile(template)}).html_safe"
|
15
|
-
warn_contains_logic(source)
|
15
|
+
warn_contains_logic(source) if ENV['NO_TEMPLATE_WARN'].nil? # pass the source code
|
16
16
|
source
|
17
17
|
end
|
18
18
|
|
@@ -66,9 +66,7 @@ class ConfigurableTest < ActiveSupport::TestCase
|
|
66
66
|
end
|
67
67
|
|
68
68
|
test "required options are required" do
|
69
|
-
|
70
|
-
render { config_with_required_options }
|
71
|
-
end
|
69
|
+
assert_match "Error rendering ConfigurableTest::ConfigWithRequiredOptions component", render { config_with_required_options }
|
72
70
|
assert render { config_with_required_options(title: 'foo') }
|
73
71
|
end
|
74
72
|
|
@@ -19,10 +19,8 @@ class RadioTest < ActiveSupport::TestCase
|
|
19
19
|
end
|
20
20
|
|
21
21
|
test "radio requires a parent component" do
|
22
|
-
|
23
|
-
|
24
|
-
radio :preferred_email_format, options: ['HTML', 'Text']
|
25
|
-
}
|
22
|
+
assert_match "Error rendering ExpressTemplates::Components::Forms::Radio", arbre {
|
23
|
+
radio :preferred_email_format, options: ['HTML', 'Text']
|
26
24
|
}
|
27
25
|
end
|
28
26
|
|
@@ -59,12 +57,10 @@ class RadioTest < ActiveSupport::TestCase
|
|
59
57
|
assert_match 'input class="radio" type="radio" value="1" name="person[subscribed]" id="person_subscribed_1" />Yes', compiled
|
60
58
|
end
|
61
59
|
|
62
|
-
test "radio
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
radio :subscribed, "Garbage options"
|
67
|
-
}
|
60
|
+
test "radio displays error if given improper options" do
|
61
|
+
assert_match "Error rendering ExpressTemplates::Components::Forms::Radio component: No association collection for: person.subscribed", arbre {
|
62
|
+
express_form(:person) {
|
63
|
+
radio :subscribed, "Garbage options"
|
68
64
|
}
|
69
65
|
}
|
70
66
|
end
|
@@ -16,10 +16,8 @@ class SelectTest < ActiveSupport::TestCase
|
|
16
16
|
|
17
17
|
|
18
18
|
test "select requires a parent component" do
|
19
|
-
|
20
|
-
|
21
|
-
select :gender, options: ['Male', 'Female'], selected: 'Male'
|
22
|
-
}
|
19
|
+
assert_match "Error rendering ExpressTemplates::Components::Forms::Select component: FormComponent must have a parent form", arbre {
|
20
|
+
select :gender, options: ['Male', 'Female'], selected: 'Male'
|
23
21
|
}
|
24
22
|
end
|
25
23
|
|
@@ -126,4 +124,4 @@ class SelectTest < ActiveSupport::TestCase
|
|
126
124
|
end
|
127
125
|
|
128
126
|
|
129
|
-
end
|
127
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: express_templates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Talcott Smith
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-10-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -280,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
280
|
version: '0'
|
281
281
|
requirements: []
|
282
282
|
rubyforge_project:
|
283
|
-
rubygems_version: 2.4.
|
283
|
+
rubygems_version: 2.4.7
|
284
284
|
signing_key:
|
285
285
|
specification_version: 4
|
286
286
|
summary: Write HTML templates in declarative Ruby. Create reusable view components.
|