simple_form_attachments 0.0.7 → 0.0.8

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: 41ace991ff9cf30eed9651db9529b00ae8113c05
4
- data.tar.gz: 4238207dcd3a88c5995065cea8886d00734e2f0d
3
+ metadata.gz: 641098bbed0b28eacffea6d69007491d936aba5e
4
+ data.tar.gz: b2ebb0e99a9f59cc5a8fdeea46e9023215dc75c8
5
5
  SHA512:
6
- metadata.gz: 2358616f3aab859d465d2f84dd45785a6f276532a38dff02a3c88d41d8dbb3f2c956fdafb5b1322eba695cb3eee66a149bbe7347f3965711498fd072d184be01
7
- data.tar.gz: 276b7355b03ec5a4dbe703443deabe7669ff44096816e8bb352f02e96b52d1bce53e3a4cc716b2d1f76cf1da1667961f845b82b70b53c49c7a9f3ff976af9201
6
+ metadata.gz: a073e8106193027b138823d9711591f0bad7298c0a475ce6c3a59a9c4e7134b0a619b09ee95c4c0cbc02f69dc2c2da3b017f7f578ed3ad2d1ee290edb04253a9
7
+ data.tar.gz: dbc9c146a9c34a107042284ef9ccfe58c4687287c14fca9677f49298eb64cb6d87c3704c095f44c29ab788ead665f49f05f5554d7579651877b77620b0b8dd05
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_form_attachments (0.0.7)
4
+ simple_form_attachments (0.0.8)
5
5
  jquery-ui-rails
6
6
  rails (>= 4.2)
7
7
  rails-assets-blueimp-file-upload (>= 9.6.0)
@@ -144,14 +144,14 @@ GEM
144
144
  bundler (>= 1.3.0, < 2.0)
145
145
  railties (= 4.2.3)
146
146
  sprockets-rails
147
- rails-assets-blueimp-canvas-to-blob (2.1.1)
148
- rails-assets-blueimp-file-upload (9.10.4)
147
+ rails-assets-blueimp-canvas-to-blob (2.2.0)
148
+ rails-assets-blueimp-file-upload (9.10.5)
149
149
  rails-assets-blueimp-canvas-to-blob (>= 2.1.1)
150
150
  rails-assets-blueimp-load-image (>= 1.13.0)
151
151
  rails-assets-blueimp-tmpl (>= 2.5.4)
152
152
  rails-assets-jquery (>= 1.6)
153
- rails-assets-blueimp-load-image (1.13.0)
154
- rails-assets-blueimp-tmpl (2.5.4)
153
+ rails-assets-blueimp-load-image (1.13.1)
154
+ rails-assets-blueimp-tmpl (2.5.5)
155
155
  rails-assets-handlebars (3.0.3)
156
156
  rails-assets-jquery (2.1.4)
157
157
  rails-deprecated_sanitizer (1.0.3)
@@ -11,6 +11,10 @@ module SimpleFormAttachments
11
11
 
12
12
  scope :temporary, -> { where(temporary: true) }
13
13
  scope :permanent, -> { where(temporary: false) }
14
+
15
+ def to_simple_form_partial_path
16
+ ['simple_form_attachments', to_partial_path].join('/')
17
+ end
14
18
  end
15
19
  end
16
20
  end
@@ -3,5 +3,4 @@
3
3
  = form.simple_fields_for attachment_relation[:name].to_sym, attachment, { child_index: child_index } do |fields|
4
4
  - partial_locals = { attachment: attachment, form: form, fields: fields, multiple: multiple, relation_key: attachment_relation[:key] }
5
5
  - partial_layout = 'layouts/simple_form_attachments/attachment_layout'
6
-
7
- = render partial: attachment, format: :html, layout: partial_layout, locals: partial_locals rescue render partial: 'simple_form_attachments/attachments/attachment', format: :html, layout: partial_layout, locals: partial_locals
6
+ = render partial: attachment.to_simple_form_partial_path, format: :html, layout: partial_layout, locals: partial_locals rescue render partial: 'simple_form_attachments/attachments/attachment', format: :html, layout: partial_layout, locals: partial_locals
@@ -40,7 +40,7 @@ module SimpleFormAttachments
40
40
  def input_html_options
41
41
  super.merge!(
42
42
  data: {
43
- attachments_path: options.fetch(:route, SimpleFormAttachments::Engine.routes.url_helpers.attachments_path),
43
+ attachments_path: options.fetch(:route, AttachmentInput.configuration.route),
44
44
  max_number_of_files: options.fetch(:max_number_of_files, nil),
45
45
  disabled_submit_text: I18n.t(:disabled, scope: 'simple_form_attachments.buttons'),
46
46
  sortable: sortable?.to_s
@@ -169,7 +169,11 @@ module SimpleFormAttachments
169
169
  # ---------------------------------------------------------------------
170
170
 
171
171
  def attachment_blank_field
172
- template.hidden_field_tag("#{parent_name}[#{relation_key}][]", nil)
172
+ if multiple?
173
+ template.hidden_field_tag("#{parent_name}[#{relation_key}][]", nil)
174
+ else
175
+ template.hidden_field_tag("#{parent_name}[#{relation_key}]", nil)
176
+ end
173
177
  end
174
178
 
175
179
  def attachment_file_field
@@ -1,13 +1,10 @@
1
- # require_relative '../../config/routes'
2
- # This is broken :(
3
-
4
1
  module SimpleFormAttachments
5
2
  class Configuration
6
3
 
7
4
  attr_accessor :route
8
5
 
9
- def initialize
10
- @route = SimpleFormAttachments::Engine.routes.url_helpers.attachments_path
6
+ def route
7
+ @route ||= SimpleFormAttachments::Engine.routes.url_helpers.attachments_path
11
8
  end
12
9
 
13
10
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleFormAttachments
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_attachments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-14 00:00:00.000000000 Z
12
+ date: 2015-07-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails