c80_news 0.1.0.6 → 0.1.0.7

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: c7d3b329124251285ae0d5426f81dae49f2feb78
4
- data.tar.gz: 5792c9d5fdf855adbeca0a47c3da000dfad5219f
3
+ metadata.gz: 9a77d657ac65b724ecd4b4dc2bebecc359a5beea
4
+ data.tar.gz: 2b9d5f3135bab897568d8b2b7b35586173a4ce14
5
5
  SHA512:
6
- metadata.gz: b67c2b12a86e15642135d4aa92d3d0f7d70b2e9a18939290357599ff7aad2873aaf7d13d28792854233c1a8eb956fec38f8532f3cadb1d969fb90eab3e918d7c
7
- data.tar.gz: ebb876edf912f94d8e03adbc4a1f5e877816cca618e87f101b510187de3d8f4969d04347709f1adb152db1b4d221da929069da422a981b26dd367938caad5fce
6
+ metadata.gz: c6dc4a3d2d18eb95fdc47db553dc5312ef5e00963eab0cf10dfbeb96bab0c3a3a12f76abe883e77f0fc9916015f1929f16f5c94971f5b9c23048497fe312ff90
7
+ data.tar.gz: 2fd613fee6a4523fa9fe9e70862ab1d58e8a87f0b40a495846ca180aa0dbd16b2593f753f2070aae93073e44eb3f164837fe1d6e550b0ad20de5b88e1ac9a32d
@@ -12,24 +12,45 @@ module C80News
12
12
  # в ~ от размеров thumb-ов и page_content_width - выдать соответствующую картинку
13
13
  # • Если у картинки thumb_big шириной ≥ page_content_width - вставляем этот thumb_big.
14
14
  # • Иначе: вставлем thumb_small.
15
- def content_image
16
- img = MiniMagick::Image.open(image.thumb_big.path)
17
- w = SiteProp.first.page_content_width
18
- if img["width"] < w
15
+ def content_image(type='normal')
16
+
17
+ if type == 'normal'
18
+ img = MiniMagick::Image.open(image.thumb_big.path)
19
+ w = SiteProp.first.page_content_width
20
+ if img["width"] < w
21
+ image.thumb_small
22
+ else
23
+ image.thumb_big
24
+ end
25
+
26
+ elsif type == 'small'
19
27
  image.thumb_small
20
- else
28
+
29
+ elsif type == 'big'
21
30
  image.thumb_big
22
31
  end
32
+
23
33
  end
24
34
 
25
35
  # выдать размеры картинки, которая будет вставлена в текст страницы
26
- def content_image_size
27
- img = MiniMagick::Image.open(image.thumb_big.path)
28
- w = SiteProp.first.page_content_width
29
- if img["width"] < w
36
+ def content_image_size(type='normal')
37
+
38
+ if type == 'normal'
39
+ img = MiniMagick::Image.open(image.thumb_big.path)
40
+ w = SiteProp.first.page_content_width
41
+ if img["width"] < w
42
+ img = MiniMagick::Image.open(image.thumb_small.path)
43
+ [img["width"],img["height"]]
44
+ else
45
+ [img["width"],img["height"]]
46
+ end
47
+
48
+ elsif type == 'small'
30
49
  img = MiniMagick::Image.open(image.thumb_small.path)
31
50
  [img["width"],img["height"]]
32
- else
51
+
52
+ elsif type == 'big'
53
+ img = MiniMagick::Image.open(image.thumb_big.path)
33
54
  [img["width"],img["height"]]
34
55
  end
35
56
  end
@@ -1,3 +1,3 @@
1
1
  module C80News
2
- VERSION = "0.1.0.6"
2
+ VERSION = "0.1.0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c80_news
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.6
4
+ version: 0.1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - C80609A
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-29 00:00:00.000000000 Z
11
+ date: 2016-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler