express_templates 0.11.2 → 0.11.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8864575cad4427903f6f29d98dd7c4b6853033a
4
- data.tar.gz: e75fa4c6ca726c66a7cc18797a9c00c54bfd40b4
3
+ metadata.gz: 822db99a91968f200eab1966f514a27df56439ec
4
+ data.tar.gz: edaec4289ef7d6c4c5f3814ab893adab767e8e65
5
5
  SHA512:
6
- metadata.gz: 927d0c3eb74ccdb049b95ed85ed783243b6ad5c0ce5beb379f07a33ddf8e91c297af95fdb5c7c7c075d0b0e134a05e24f9b58c83d999e1f2a6a9d7a146776900
7
- data.tar.gz: b21f56f1b31bda2a10b761674d534f5651cedf992765a369f3fee533244ccd7a70a0a9d7ded2541eb550a3de815146338bb05ce63f899a26454a87451195d546
6
+ metadata.gz: 5d622c294ccb1d1bb0f04ce998e6217d5e3d29daa37f5c25930ab1337efe9f440b05224922098f3ff50df31dd513f68aec930f3a6c18dfe6a3eb820e70c218c9
7
+ data.tar.gz: 965081b173f8546fabe7b38ff7b579ca9f1b0fd0f48833437ccf5278c2cfdf89f2002a19c6da1cebee76275d7096da5dec25bf1725589759030479e254b6956f
@@ -17,6 +17,35 @@ module ExpressTemplates
17
17
 
18
18
  class_attribute :builder_method_name
19
19
 
20
+ # mark a component as abstract ie. can't be used
21
+ # in Express Designer
22
+ #
23
+ @is_abstract = false
24
+
25
+ def self.abstract_component(value = true)
26
+ @is_abstract = value
27
+ end
28
+
29
+ def self.abstract_component?
30
+ @is_abstract
31
+ end
32
+
33
+ abstract_component
34
+
35
+ # define the parent componennt ie. can't be used
36
+ # in Express Designer unless parent is present
37
+ #
38
+ @parent_component = nil
39
+
40
+ def self.require_parent(component)
41
+ raise "must pass a sublcass of ExpressTemplates::Components::Base" if !component.kind_of? ExpressTemplates::Components::Base
42
+ @parent_component = component
43
+ end
44
+
45
+ def self.required_parent
46
+ @parent_component
47
+ end
48
+
20
49
  def self.builder_method_and_class(method_name, klass)
21
50
  Arbre::Element::BuilderMethods.class_eval <<-EOF, __FILE__, __LINE__
22
51
  def #{method_name}(*args, &block)
@@ -27,6 +27,8 @@ module ExpressTemplates
27
27
  #
28
28
  class Configurable < Base
29
29
 
30
+ abstract_component
31
+
30
32
  class_attribute :supported_options
31
33
  self.supported_options = {}
32
34
 
@@ -176,4 +178,4 @@ module ExpressTemplates
176
178
 
177
179
  end
178
180
  end
179
- end
181
+ end
@@ -2,6 +2,8 @@ module ExpressTemplates
2
2
  module Components
3
3
  class Container < Configurable
4
4
 
5
+ abstract_component
6
+
5
7
  class_attribute :prepended_blocks
6
8
  self.prepended_blocks = []
7
9
 
@@ -40,4 +42,4 @@ module ExpressTemplates
40
42
 
41
43
  end
42
44
  end
43
- end
45
+ end
@@ -10,7 +10,6 @@ require 'express_templates/components/forms/form_component'
10
10
  require 'express_templates/components/forms/option_support'
11
11
  require 'express_templates/components/forms/submit'
12
12
  require 'express_templates/components/forms/select'
13
- require 'express_templates/components/forms/country_select'
14
13
  require 'express_templates/components/forms/select_collection'
15
14
  require 'express_templates/components/forms/radio'
16
15
  require 'express_templates/components/forms/checkbox'
@@ -1,3 +1,3 @@
1
1
  module ExpressTemplates
2
- VERSION = "0.11.2"
2
+ VERSION = "0.11.3"
3
3
  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.2
4
+ version: 0.11.3
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-10 00:00:00.000000000 Z
12
+ date: 2015-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -53,20 +53,6 @@ dependencies:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.0'
56
- - !ruby/object:Gem::Dependency
57
- name: countries
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: '0'
63
- type: :runtime
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
56
  - !ruby/object:Gem::Dependency
71
57
  name: rails
72
58
  requirement: !ruby/object:Gem::Requirement
@@ -206,7 +192,6 @@ files:
206
192
  - lib/express_templates/components/forms.rb
207
193
  - lib/express_templates/components/forms/basic_fields.rb
208
194
  - lib/express_templates/components/forms/checkbox.rb
209
- - lib/express_templates/components/forms/country_select.rb
210
195
  - lib/express_templates/components/forms/express_form.rb
211
196
  - lib/express_templates/components/forms/form_component.rb
212
197
  - lib/express_templates/components/forms/option_support.rb
@@ -227,7 +212,6 @@ files:
227
212
  - test/components/configurable_test.rb
228
213
  - test/components/forms/basic_fields_test.rb
229
214
  - test/components/forms/checkbox_test.rb
230
- - test/components/forms/country_select_test.rb
231
215
  - test/components/forms/express_form_test.rb
232
216
  - test/components/forms/radio_test.rb
233
217
  - test/components/forms/select_test.rb
@@ -296,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
296
280
  version: '0'
297
281
  requirements: []
298
282
  rubyforge_project:
299
- rubygems_version: 2.4.7
283
+ rubygems_version: 2.4.5
300
284
  signing_key:
301
285
  specification_version: 4
302
286
  summary: Write HTML templates in declarative Ruby. Create reusable view components.
@@ -307,7 +291,6 @@ test_files:
307
291
  - test/components/configurable_test.rb
308
292
  - test/components/forms/basic_fields_test.rb
309
293
  - test/components/forms/checkbox_test.rb
310
- - test/components/forms/country_select_test.rb
311
294
  - test/components/forms/express_form_test.rb
312
295
  - test/components/forms/radio_test.rb
313
296
  - test/components/forms/select_test.rb
@@ -1,23 +0,0 @@
1
- require 'countries'
2
- require_relative 'select'
3
-
4
- module ExpressTemplates
5
- module Components
6
- module Forms
7
- class CountrySelect < Select
8
-
9
- def select_options
10
- country_options = ISO3166::Country.all.map {|country| [country.name.titleize, country.alpha2]}
11
- us = country_options.delete(['United States', 'US'])
12
- country_options.unshift us
13
- helpers.options_for_select(country_options, selected_value)
14
- end
15
-
16
- def select_helper_options
17
- add_select2_class( input_attributes.merge(include_blank: false, prompt: "-- Please Select --" ) )
18
- end
19
-
20
- end
21
- end
22
- end
23
- end
@@ -1,34 +0,0 @@
1
- require 'test_helper'
2
- require 'ostruct'
3
- class CountrySelectTest < ActiveSupport::TestCase
4
-
5
- def assigns
6
- {person: ::Person.new}
7
- end
8
-
9
- def helpers
10
- mock_action_view do
11
- def people_path
12
- '/people'
13
- end
14
- end
15
- end
16
-
17
-
18
- test "country_select renders without an error" do
19
- assert arbre {
20
- express_form(:person) {
21
- country_select :country_code
22
- }
23
- }
24
- end
25
-
26
- test "can change label for country_select" do
27
- html = arbre {
28
- express_form(:person) {
29
- country_select :country_code, label: "Country"
30
- }
31
- }
32
- assert_match(/<label.*Country<\/label>/, html)
33
- end
34
- end