assetable 0.1.9 → 0.1.10

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDZjYTk0MWJjYWE4ZDkxMjVkNGNiOWQ5ODk2MDZkMjQ5M2E3ZTBlZA==
4
+ ZTFjYWI5NzVhMGUzYjhiNjEzMDdmNzJkYmYzY2ZjZDQyMDQ4ZjY4OQ==
5
5
  data.tar.gz: !binary |-
6
- OTAxMTQ4M2YxZjFkYzFlODQ5MTY3MGNmODkzNTBkODJlNjY1OWE4ZQ==
6
+ YWM4OTJiYjY3NWNmODZiODdmNmI1NTZkN2Y1OTM1Y2RkOWY5YmQ4MA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- N2E3YThjNTcyOGYxNGY3NDQ2OTBjNTNhNGRlZjJlYjNmNzc2ZWE2ZmU2YTI1
10
- ZmI3NGU2MTVlOWYzZGQzMjlmOWIxMjY4NTQ1ZTkzOTU3OGRjYWFiMzM5YWE3
11
- MmZiYmIwMTQwOWUzNjE0NzVjYjAxNmFiYmZkYmE0NDQxYzU2NTc=
9
+ YzljYzI4YzE2YWJhOGE1MWNlYTg5YmIxMWI2NmRiZWY1ZjU2YTA4OThmOGUx
10
+ ZDZhZWU2MGYzYzE0NTVkODYwZmZlOWFkOGI4NjczMjFiYzc4NWI5Y2FkMTBm
11
+ YjM0YzEyMzAxMWQ4MTkwNGVhM2FmOWQ2YmZjYWNhMjhiYWI1YTA=
12
12
  data.tar.gz: !binary |-
13
- MDc1YWUwNDlkMjNkNjY3NDE1MjkzYzA3YWVkNzRkY2IzM2RhNmFjODViY2E5
14
- NGM5YWYxOGFlYWE5ZWZmZjMxZmY1MzIxMzEyNGM1MDE3Njc5NTMxOGU1ZDc4
15
- MWI1MzM5NGQyZDgwZmZkMmU1NjA2MWMwNzM3NDBiOTM4MmM3NWE=
13
+ ZTZiZGNiMWQyOGJiYzJhYTE3NjViNWI2OWFiYzYzNGI1NmM4OGI5ZmI0NTQx
14
+ MzJkN2MwMGI0ZmZkYTY1MWNlZGZiODJiNTk5ZDQzYTI1MjE1ZTliYjlkMjk0
15
+ ZjBlMzdjMzVlYTdjYmZiNGExZjRlZGNhMTg0MDVlMTE4N2FiY2E=
@@ -13,7 +13,7 @@
13
13
  fileUpdated: options.fileUpdated
14
14
  gallery: false
15
15
  id: null
16
- max_file_size: "10mb"
16
+ max_file_size: options.max_file_size
17
17
  multiple_queues: true
18
18
  multi_selection: true
19
19
  max_file_count: 0
@@ -213,6 +213,7 @@ bind_uploaders = ->
213
213
  url: "/assetable/assets"
214
214
  fieldname: field
215
215
  directions: $this.attr('data-uploader-directions')
216
+ max_file_size: $this.attr("data-max-file-size")
216
217
  authenticity_token: $("meta[name=\"csrf-token\"]").attr("content")
217
218
  onUploaded: (resp) ->
218
219
  $this.find('.uploader-data-wrapper').html(resp.html)
@@ -30,7 +30,7 @@ class ActionView::Helpers::FormBuilder
30
30
  uploader_html = content_tag(:div, (asset_preview.html_safe), class: "uploader-data-wrapper")
31
31
 
32
32
  # Wrap the previews and uploader in a div
33
- uploader_wrapper = content_tag(:div, uploader_html, class: "gallery-uploader", id: options[:id], :'data-uploader-input-name' => fieldname)
33
+ uploader_wrapper = content_tag(:div, uploader_html, class: "gallery-uploader", id: options[:id], :'data-uploader-input-name' => fieldname, :'data-uploader-directions' => get_directions(options), :'data-max-file-size' => get_max_file_size(options))
34
34
  return uploader_wrapper
35
35
  end
36
36
 
@@ -16,8 +16,6 @@ class ActionView::Helpers::FormBuilder
16
16
  # Set the fieldname
17
17
  fieldname = @object_name + "[#{method}_association_attributes][asset_id]"
18
18
 
19
- directions = options[:directions] || ''
20
-
21
19
  # Create the uploader
22
20
  value = @object.nil? ? nil : @object.send(method)
23
21
 
@@ -32,7 +30,7 @@ class ActionView::Helpers::FormBuilder
32
30
  uploader_html = content_tag(:div, (asset_preview), class: "uploader-data-wrapper")
33
31
 
34
32
  # Create and return the uploader html
35
- uploader_wrapper = content_tag(:div, uploader_html, class: "uploader #{'uploader-has-asset' if asset} #{options[:class]}", id: options[:id], :'data-uploader-input-name' => fieldname, :'data-uploader-directions' => directions)
33
+ uploader_wrapper = content_tag(:div, uploader_html, class: "uploader #{'uploader-has-asset' if asset} #{options[:class]}", id: options[:id], :'data-uploader-input-name' => fieldname, :'data-uploader-directions' => get_directions(options), :'data-max-file-size' => get_max_file_size(options))
36
34
  return uploader_wrapper
37
35
  end
38
36
 
@@ -85,4 +83,12 @@ class ActionView::Helpers::FormBuilder
85
83
  return @object_name + output + "_#{label}"
86
84
  end
87
85
 
86
+ def get_max_file_size options
87
+ (options[:max_file_size] || Assetable.max_file_size || "10MB").to_s
88
+ end
89
+
90
+ def get_directions options
91
+ directions = options[:directions] || ''
92
+ end
93
+
88
94
  end
@@ -3,6 +3,7 @@ module Assetable
3
3
 
4
4
  VALID_OPTION_KEYS = [
5
5
  :storage,
6
+ :max_file_size,
6
7
  :external_document_types,
7
8
  :external_document_icons
8
9
  ]
@@ -1,3 +1,3 @@
1
1
  module Assetable
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assetable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Koht
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-31 00:00:00.000000000 Z
11
+ date: 2014-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails