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 +4 -4
- data/lib/express_templates/components/base.rb +29 -0
- data/lib/express_templates/components/configurable.rb +3 -1
- data/lib/express_templates/components/container.rb +3 -1
- data/lib/express_templates/components/forms.rb +0 -1
- data/lib/express_templates/version.rb +1 -1
- metadata +3 -20
- data/lib/express_templates/components/forms/country_select.rb +0 -23
- data/test/components/forms/country_select_test.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 822db99a91968f200eab1966f514a27df56439ec
|
4
|
+
data.tar.gz: edaec4289ef7d6c4c5f3814ab893adab767e8e65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
@@ -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'
|
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.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-
|
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.
|
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
|