express_templates 0.10.1 → 0.11.0
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 +2 -2
- data/lib/express_templates/compiler.rb +1 -1
- data/lib/express_templates/components/all.rb +1 -1
- data/lib/express_templates/components/base.rb +0 -4
- data/lib/express_templates/components/configurable.rb +3 -1
- data/lib/express_templates/components/forms/basic_fields.rb +7 -0
- data/lib/express_templates/components/forms/express_form.rb +6 -0
- data/lib/express_templates/version.rb +1 -1
- data/test/components/forms/basic_fields_test.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e97ae44b4cd0c3d5e7ce6d0031f435e75f30b42f
|
4
|
+
data.tar.gz: 57ed6eeb0157d6f9f02f4eace7b18567cf72c717
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a683f5a485998aa996feddedb9a45fbc60c7edcc5734e74863d0bfce3e8052328bfeaa15b8c6c60a72a102111b4e4010ded94986019bd2cfd70bdcdea798d6e
|
7
|
+
data.tar.gz: b2ac9ec3c1cee810f2c0872f8233e0055250e31678b468c5576dcef740f0b491cda9a2cac62e52fcc13fa2f5a7deba74975b433293fdd379e35cd9b06b42aea2
|
data/lib/arbre/patches.rb
CHANGED
@@ -46,8 +46,8 @@ module Arbre
|
|
46
46
|
def method_missing(name, *args, &block)
|
47
47
|
if current_arbre_element.respond_to?(name)
|
48
48
|
current_arbre_element.send name, *args, &block
|
49
|
-
elsif assigns && assigns.has_key?(name)
|
50
|
-
assigns[name]
|
49
|
+
elsif assigns && assigns.has_key?(name.to_sym)
|
50
|
+
assigns[name.to_sym]
|
51
51
|
elsif helpers.respond_to?(name)
|
52
52
|
helper_method(name, *args, &block)
|
53
53
|
elsif route_proxy = possible_route_proxy(name)
|
@@ -4,7 +4,7 @@ module ExpressTemplates
|
|
4
4
|
|
5
5
|
template, src = _normalize(template_or_src)
|
6
6
|
|
7
|
-
%Q[
|
7
|
+
%Q[assigns.merge!(template_virtual_path: @virtual_path) ; Arbre::Context.new(assigns, self) { #{src || block.source_body} }.to_s]
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
@@ -32,10 +32,6 @@ module ExpressTemplates
|
|
32
32
|
add_class _default_classes
|
33
33
|
end
|
34
34
|
|
35
|
-
def assigns
|
36
|
-
@assigns_with_indifferent_access ||= super.merge(helpers.assigns.with_indifferent_access)
|
37
|
-
end
|
38
|
-
|
39
35
|
def self.contains(proc = nil, &block)
|
40
36
|
define_method(:_build_body, &(proc || block))
|
41
37
|
end
|
@@ -28,6 +28,13 @@ RUBY
|
|
28
28
|
# }
|
29
29
|
# end
|
30
30
|
|
31
|
+
class File < FormComponent
|
32
|
+
contains {
|
33
|
+
label_tag(label_name, label_text)
|
34
|
+
file_field_tag field_name_attribute, field_helper_options
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
31
38
|
class Textarea < FormComponent
|
32
39
|
contains {
|
33
40
|
label_tag(label_name, label_text)
|
@@ -10,6 +10,7 @@ module ExpressTemplates
|
|
10
10
|
has_option :action, 'The form action containing the resource path or url.'
|
11
11
|
has_option :on_success, 'Pass a form value indicating where to go on a successful submission.'
|
12
12
|
has_option :on_failure, 'Pass a form value indicating where to go on a failed submission.'
|
13
|
+
has_option :enctype, 'The enctype attribute specifies how the form-data should be encoded when submitting it to the server.'
|
13
14
|
|
14
15
|
prepends -> {
|
15
16
|
div(style: 'display:none') {
|
@@ -24,6 +25,7 @@ module ExpressTemplates
|
|
24
25
|
before_build -> {
|
25
26
|
set_attribute(:id, form_id)
|
26
27
|
set_attribute(:action, form_action)
|
28
|
+
set_attribute(:enctype, form_enctype) if form_enctype
|
27
29
|
add_class(config[:id])
|
28
30
|
}
|
29
31
|
|
@@ -35,6 +37,10 @@ module ExpressTemplates
|
|
35
37
|
config[:action] || (resource.try(:persisted?) ? resource_path(resource) : collection_path)
|
36
38
|
end
|
37
39
|
|
40
|
+
def form_enctype
|
41
|
+
config[:enctype]
|
42
|
+
end
|
43
|
+
|
38
44
|
end
|
39
45
|
end
|
40
46
|
end
|
@@ -3,7 +3,7 @@ require 'active_model'
|
|
3
3
|
|
4
4
|
class BasicFieldsTest < ActiveSupport::TestCase
|
5
5
|
|
6
|
-
BASIC_FIELDS = %w(email phone text password color date datetime
|
6
|
+
BASIC_FIELDS = %w(email phone text password color file date datetime
|
7
7
|
datetime_local number range
|
8
8
|
search telephone time url week)
|
9
9
|
|
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.
|
4
|
+
version: 0.11.0
|
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-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|