express_templates 0.11.3 → 0.11.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 822db99a91968f200eab1966f514a27df56439ec
4
- data.tar.gz: edaec4289ef7d6c4c5f3814ab893adab767e8e65
3
+ metadata.gz: 9974ff2ee9b43a2995de75414d2b03b7923d589d
4
+ data.tar.gz: 62bdff14270e90b4b3ce41a5a208f1645cf8fa84
5
5
  SHA512:
6
- metadata.gz: 5d622c294ccb1d1bb0f04ce998e6217d5e3d29daa37f5c25930ab1337efe9f440b05224922098f3ff50df31dd513f68aec930f3a6c18dfe6a3eb820e70c218c9
7
- data.tar.gz: 965081b173f8546fabe7b38ff7b579ca9f1b0fd0f48833437ccf5278c2cfdf89f2002a19c6da1cebee76275d7096da5dec25bf1725589759030479e254b6956f
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
- tag.build(*args, &block)
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
@@ -179,6 +179,7 @@ module ExpressTemplates
179
179
  end
180
180
  else
181
181
  if helpers.respond_to?(:resource_path) &&
182
+ object.nil? &&
182
183
  helpers.resource.to_param.present? # skip on nil resource
183
184
  helpers.resource_path
184
185
  else
@@ -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) # pass the source code
15
+ warn_contains_logic(source) if ENV['NO_TEMPLATE_WARN'].nil? # pass the source code
16
16
  source
17
17
  end
18
18
 
@@ -1,3 +1,3 @@
1
1
  module ExpressTemplates
2
- VERSION = "0.11.3"
2
+ VERSION = "0.11.4"
3
3
  end
@@ -66,9 +66,7 @@ class ConfigurableTest < ActiveSupport::TestCase
66
66
  end
67
67
 
68
68
  test "required options are required" do
69
- assert_raises(RuntimeError) do
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
- assert_raises(RuntimeError) {
23
- html = arbre {
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 throws error if given improper options" do
63
- assert_raises(RuntimeError) {
64
- html = arbre {
65
- express_form(:person) {
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
- assert_raises(RuntimeError) {
20
- html = arbre {
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.3
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-09-11 00:00:00.000000000 Z
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.5
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.