lalala 4.0.0.dev.126 → 4.0.0.dev.128

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: 6060c6b53af5a9c9c3de6fb7a2b5fc10c7cf1b4e
4
- data.tar.gz: 3e55f1d9fc338b48de3d8362f33403c7f89cdb91
3
+ metadata.gz: 0da73c5555e578485c8df8b6dc103ee52979291c
4
+ data.tar.gz: 2f59ea454308bd2b49142c135d35f803f5074034
5
5
  SHA512:
6
- metadata.gz: 333e9cc5316f5eccc5aea857823bf8cfae09b213b559c28ce71d55dba1e6be192c523b32172c727fbca0c5b1ffa5d8c3987243f48c538de1224ae1dac8b08807
7
- data.tar.gz: 2508a55160619c01b96a254280596be715a63aae2ae7a94c1734e3af8c6e2b762f2ecee6392b43d62d168a9502439d4d29621a23a2624b8216a264d865f13285
6
+ metadata.gz: b0e0d67b87ed890810cdbdedce96a9e7f21c86f5f2dc12c25db98ef4dc944641aed55e10c07d4d132b72ba7c65ff5f7229b9b757896bb4baf05d9697b7cd6bac
7
+ data.tar.gz: aa31db8c0c12f1ed3d82784bba3d8da2098982d86fbe69c4995faa23c7b1f6059931466dd197d637bb4e7ce195e0380eb6c8a6da6ddc8747d1e58edbd91c6c9d
@@ -5,9 +5,9 @@ class Formtastic::Inputs::GridInput
5
5
  object = builder.object
6
6
  assets = object.send(method)
7
7
 
8
- image_model_class = object.class.reflect_on_association(method).class_name.constantize
9
- image_attributes = image_model_class.accessible_attributes.to_a
10
- image_attributes.select! { |x| x.size > 0 and !%w(asset translations_writer).include?(x) }
8
+ asset_model_class = object.class.reflect_on_association(method).class_name.constantize
9
+ asset_attributes = asset_model_class.accessible_attributes.to_a
10
+ asset_attributes.select! { |x| x.size > 0 and !%w(asset translations_writer).include?(x) }
11
11
 
12
12
  ul = template.content_tag :ul do
13
13
  html = template.raw("")
@@ -15,11 +15,18 @@ class Formtastic::Inputs::GridInput
15
15
  assets.each_with_index do |asset, idx|
16
16
  html += template.content_tag :li, class: "asset" do
17
17
  builder.fields_for(method, asset) do |f|
18
- thumbnail_html = template.image_tag f.object.asset.lalala_thumb.url
18
+ lalala_thumb = f.object.asset.lalala_thumb
19
+
20
+ if lalala_thumb
21
+ link_inner_html = template.image_tag(lalala_thumb.url)
22
+ else
23
+ link_inner_html = ""
24
+ end
25
+
19
26
  asset_html = template.raw("")
20
- asset_html << template.link_to(thumbnail_html, f.object.asset.url)
27
+ asset_html << template.link_to(link_inner_html, f.object.asset.url)
21
28
  asset_html << template.content_tag(:ol, { class: "attributes" }) do
22
- inputs = image_attributes.map do |ia|
29
+ inputs = asset_attributes.map do |ia|
23
30
  f.input ia.to_sym, placeholder: ia
24
31
  end
25
32
 
@@ -34,7 +41,7 @@ class Formtastic::Inputs::GridInput
34
41
 
35
42
  html += template.content_tag :li do
36
43
  builder.fields_for(method, assets.build) do |f|
37
- f.file_field :asset, multiple: true, accept: image_model_class.extension_white_list
44
+ f.file_field :asset, multiple: true, accept: asset_model_class.extension_white_list
38
45
  end
39
46
  end
40
47
 
@@ -12,7 +12,7 @@ class Lalala::Uploaders::File < CarrierWave::Uploader::Base
12
12
  super_url = super
13
13
  if Rails.env.production? or Rails.env.staging?
14
14
  if super_url
15
- File.join("/storage/assets", super_url)
15
+ AssetURL.new(File.join("/storage/assets", super_url))
16
16
  else
17
17
  super_url
18
18
  end
@@ -21,4 +21,26 @@ class Lalala::Uploaders::File < CarrierWave::Uploader::Base
21
21
  end
22
22
  end
23
23
 
24
+ # This class circumvents the Sprockets asset path rewriting
25
+ # by pretending that it is a full URL.
26
+ #
27
+ # @see
28
+ # https://mrhenry.basecamphq.com/projects/10235776-hetpaleis/todo_items/164031435/comments (internal)
29
+ # http://apidock.com/rails/ActionView/Helpers/AssetTagHelper/image_tag
30
+ # http://apidock.com/rails/v3.2.13/ActionView/Helpers/AssetTagHelper/path_to_image
31
+ # http://apidock.com/rails/ActionView/Helpers/AssetTagHelper/image_path
32
+ # http://apidock.com/rails/ActionView/AssetPaths/compute_public_path
33
+ # http://apidock.com/rails/v3.2.13/ActionView/AssetPaths/is_uri%3F
34
+ class AssetURL < String
35
+
36
+ def to_s
37
+ self
38
+ end
39
+
40
+ def =~(pattern)
41
+ return true
42
+ end
43
+
44
+ end
45
+
24
46
  end
@@ -1,6 +1,6 @@
1
1
  module Lalala
2
2
  VERSION = "4.0.0"
3
- BUILD = "126"
3
+ BUILD = "128"
4
4
 
5
5
  if BUILD != ("{{BUILD_NUMBER" + "}}") # prevent sed replacement (see script/ci)
6
6
  BUILD_VERSION = "#{VERSION}.dev.#{BUILD}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lalala
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.dev.126
4
+ version: 4.0.0.dev.128
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Menke