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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c9baef818e61dca4af8b2dc58563e052a18dbe6
4
- data.tar.gz: 380b2be118607d717bd5c9d7adb5b6bb54cd21d9
3
+ metadata.gz: e97ae44b4cd0c3d5e7ce6d0031f435e75f30b42f
4
+ data.tar.gz: 57ed6eeb0157d6f9f02f4eace7b18567cf72c717
5
5
  SHA512:
6
- metadata.gz: 300363fd967967329bbc0a4a783d5affce0c83fa522086735be9df12561484c91e3179e668adf933f1660a4894696c8f6229c3811b56f253e26479533ed751c6
7
- data.tar.gz: c82fd24eb83f898092ebb731f37c60739d29ec09316038ab6605a27fef4feda4b6ad2053c2d303f127fee8de41f482c81bdf317e792e862bfffebaee87999438
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[Arbre::Context.new(assigns.merge(template_virtual_path: @virtual_path), self) { #{src || block.source_body} }.to_s]
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
@@ -7,7 +7,7 @@ module ExpressTemplates
7
7
  contains -> (&block) {
8
8
  prepended
9
9
  collection.each do |item|
10
- assigns[member_name] = item
10
+ assigns[member_name.to_sym] = item
11
11
  block.call(self) if block
12
12
  end
13
13
  appended
@@ -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
@@ -86,7 +86,9 @@ module ExpressTemplates
86
86
  if !!value[:attribute]
87
87
  set_attribute key, value[:default]
88
88
  else
89
- config[key] ||= value[:default]
89
+ if config[key].nil?
90
+ config[key] = value[:default]
91
+ end
90
92
  end
91
93
  end
92
94
  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
@@ -1,3 +1,3 @@
1
1
  module ExpressTemplates
2
- VERSION = "0.10.1"
2
+ VERSION = "0.11.0"
3
3
  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.10.1
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-08-27 00:00:00.000000000 Z
12
+ date: 2015-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport