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 +4 -4
- data/app/models/c80_news/fphoto.rb +31 -10
- data/lib/c80_news/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: 9a77d657ac65b724ecd4b4dc2bebecc359a5beea
|
4
|
+
data.tar.gz: 2b9d5f3135bab897568d8b2b7b35586173a4ce14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
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
|
-
|
28
|
-
|
29
|
-
|
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
|
-
|
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
|
data/lib/c80_news/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|