tramway-core 1.14.5.1 → 1.14.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/app/decorators/tramway/core/concerns/attributes_decorator_helper.rb +25 -23
- data/lib/tramway/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56203f0c0c9fcdf1e08f10c7053127a979cb953ba11bc638e22326a8cc4a9953
|
4
|
+
data.tar.gz: ac6e6a9d095a882662a0f725b0980637d75501f07dabff3395276c9af35cc9f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b263cc4fc7bdb6fd10a463c26064749e90b75ebe9a45c002c910d1a74ecb1190191253b348486d982eadfea6831a3200bf047b80aad12f814b10f2d857b0f14
|
7
|
+
data.tar.gz: 24667714b920410c7f022c8a958cbcd71d302fd7b31d3207b5f8bc12b9df6e4d76f1a751418e14db8c89d25abc64bcef73d29951e83518168112616fc9cb40cc
|
data/README.md
CHANGED
@@ -27,6 +27,11 @@ Tramway::Core.initialize_application name: "Your application's name"
|
|
27
27
|
Tramway::Core.initialize_application model_class: ::Tramway::Conference::Unity # example was taken from tramway-conference gem
|
28
28
|
```
|
29
29
|
|
30
|
+
*config/initializers/assets.rb*
|
31
|
+
```ruby
|
32
|
+
Rails.application.config.assets.precompile += %w( *.jpg *.png *.js )
|
33
|
+
```
|
34
|
+
|
30
35
|
# Базовые классы
|
31
36
|
|
32
37
|
* ApplicationDecorator - Базовый класс декоратора. В него по умолчанию включены `ActionView::Helpers` и `ActionView::Context` и `FontAwesome5` (версия гема FontAwesome, которая поддерживает 5 версию шрифта). `FontAwesome` считается в `Tramway` основным шрифтом для иконок.
|
@@ -14,30 +14,32 @@ module Tramway::Core::Concerns::AttributesDecoratorHelper
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def image_view(original, thumb: nil, filename: nil)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
17
|
+
if original.present?
|
18
|
+
thumb ||= original.small
|
19
|
+
filename ||= original.path.split('/').last
|
20
|
+
src_thumb = if thumb.is_a?(CarrierWave::Uploader::Base)
|
21
|
+
thumb.url
|
22
|
+
elsif thumb.match(%r{^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$})
|
23
|
+
"data:image/jpeg;base64,#{thumb}"
|
24
|
+
else
|
25
|
+
thumb
|
26
|
+
end
|
27
|
+
src_original = if original.is_a?(CarrierWave::Uploader::Base)
|
28
|
+
original.url
|
29
|
+
elsif original.match(%r{^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$})
|
30
|
+
"data:image/jpeg;base64,#{original}"
|
31
|
+
else
|
32
|
+
original
|
33
|
+
end
|
34
|
+
content_tag(:div) do
|
35
|
+
begin
|
36
|
+
concat image_tag src_thumb
|
37
|
+
rescue NoMethodError => e
|
38
|
+
error = Tramway::Error.new plugin: :core, method: :image_view, message: "You should mount PhotoUploader to your model. Just add `mount_uploader \#{attribute_name}, PhotoUploader` to your model. #{e.message}"
|
39
|
+
raise error.message
|
40
|
+
end
|
41
|
+
concat link_to(fa_icon(:download), src_original, class: 'btn btn-success', download: filename)
|
39
42
|
end
|
40
|
-
concat link_to(fa_icon(:download), src_original, class: 'btn btn-success', download: filename)
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
data/lib/tramway/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.5.
|
4
|
+
version: 1.14.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: audited
|