phrasing_plus 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ef6672d71bf447029bc06207fb7134d3c073572
4
- data.tar.gz: fe6bfad3ec7cc62bf8d61a71f73f65a505a2fcdc
3
+ metadata.gz: e6de77ba808b78aee18151f2fa76a1fc741f33c0
4
+ data.tar.gz: 25281dc73a5ad8751e1a565fb90b4e8f2e7872fb
5
5
  SHA512:
6
- metadata.gz: 9aa73a631a395513a7ac1279f6692bbfde7c33c34642f65750c531ab012613a06d7cf4c6e9f8743626116c5be77adaee96cb7cf312493d306a91f82cb2f3a393
7
- data.tar.gz: ecf093f80cda4594073cda1e9f7791c90eceae2ef12e0f5b33f15ab8f5a8e9e9193e5e10bf93824eb8d5d7cedb4446a90f32334df62e5fde0f795b6b5cdccd07
6
+ metadata.gz: 5f8c1500d91e35d5a4cd945d9981072f572f2fb667b1ee8820e2bb682fbfb0cc639b7b17ba41ed9c6dd5fa0bfd46fde107d7491bf3a1e99a8a204b7f7ab4f5e7
7
+ data.tar.gz: ad1dd303591c27aa249fdcc1e3966f814f89478ce066cdcecaea6839ef14b446e8ec1841c94e4ebf52ef51a7ffa0fc0426f5416373eb6f76ae693cf7592e1edd
@@ -4,4 +4,8 @@ class PhrasingImageUploader < CarrierWave::Uploader::Base
4
4
  def extension_white_list
5
5
  %w(jpg jpeg gif png)
6
6
  end
7
+
8
+ def store_dir
9
+ "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
10
+ end
7
11
  end
@@ -11,6 +11,7 @@ class PhrasingBackgroundImageWidget < SimpleDelegator
11
11
  @view_context = view_context
12
12
  @wrapped_html = wrapped_html
13
13
  @options = options
14
+ @default_image = @options.delete(:default_image)
14
15
  @options[:style] = "background-image: url(#{image_url})"
15
16
  @tag = @options.delete(:tag)
16
17
 
@@ -26,7 +27,7 @@ class PhrasingBackgroundImageWidget < SimpleDelegator
26
27
  private
27
28
 
28
29
  def image_url
29
- image.url || PhrasingPlus::DummyImage.new(options).url
30
+ image.url || default_image && view_context.asset_url(default_image) || PhrasingPlus::DummyImage.new(options).url
30
31
  end
31
32
 
32
33
  def add_phrasable_image_class
@@ -5,12 +5,13 @@ class PhrasingImageWidget < SimpleDelegator
5
5
  HTML_CLASS = 'phrasable-image'
6
6
  WRAPPER_HTML_CLASS = 'phrasable-image-wrapper'
7
7
 
8
- attr_accessor :options, :wrapper_options
8
+ attr_accessor :options, :wrapper_options, :default_image
9
9
 
10
10
  def initialize(phrasing_image, view_context, options = {})
11
11
  super(phrasing_image)
12
12
  @view_context = view_context
13
13
  @options = options
14
+ @default_image = @options.delete(:default_image)
14
15
  @wrapper_options = @options.delete(:wrapper_html) || {}
15
16
 
16
17
  return unless view_context.can_edit_phrases?
@@ -20,7 +21,7 @@ class PhrasingImageWidget < SimpleDelegator
20
21
  end
21
22
 
22
23
  def image_url
23
- image.url || PhrasingPlus::DummyImage.new(options).url
24
+ image.url || default_image && view_context.asset_url(default_image) || PhrasingPlus::DummyImage.new(options).url
24
25
  end
25
26
 
26
27
  private
@@ -1,3 +1,3 @@
1
1
  module PhrasingPlus
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phrasing_plus
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
  - Damir Svrtan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-23 00:00:00.000000000 Z
11
+ date: 2015-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails