simple_form_attachments 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/app/models/concerns/simple_form_attachments/attachment.rb +4 -0
- data/app/views/simple_form_attachments/_attachment_upload_template.html.slim +1 -2
- data/lib/simple_form_attachments/attachment_input.rb +6 -2
- data/lib/simple_form_attachments/configuration.rb +2 -5
- data/lib/simple_form_attachments/version.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: 641098bbed0b28eacffea6d69007491d936aba5e
|
4
|
+
data.tar.gz: b2ebb0e99a9f59cc5a8fdeea46e9023215dc75c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
148
|
-
rails-assets-blueimp-file-upload (9.10.
|
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.
|
154
|
-
rails-assets-blueimp-tmpl (2.5.
|
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,
|
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
|
-
|
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
|
10
|
-
@route
|
6
|
+
def route
|
7
|
+
@route ||= SimpleFormAttachments::Engine.routes.url_helpers.attachments_path
|
11
8
|
end
|
12
9
|
|
13
10
|
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.
|
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-
|
12
|
+
date: 2015-07-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|