tramway-core 1.14.5.1 → 1.14.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/README.md +5 -0
- data/app/assets/javascripts/tramway/core/application.js.coffee +0 -1
- data/app/controllers/tramway/core/application_controller.rb +5 -0
- data/app/decorators/tramway/core/concerns/attributes_decorator_helper.rb +25 -23
- data/lib/tramway/collections/helper.rb +6 -2
- data/lib/tramway/core.rb +1 -1
- data/lib/tramway/core/application.rb +1 -1
- data/lib/tramway/core/version.rb +1 -1
- metadata +4 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f46965fe008bd76fc777840560abb3a2a5f079d469ac1ac909657cb8c7e23d1f
|
4
|
+
data.tar.gz: 12a6b2c2716dd7876a98ae216cc25aee95a3916f3b117bbaf5c426e91a2c2992
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19f8b496bfc15c82c7df8d9e371abc6a76b06452d1b44802979cd0b2bc36f26f64df58b76476d1fdce233ec26e51debc29c0be482d62685deb0933440ef71b9f
|
7
|
+
data.tar.gz: 7b8fcf18061b22fc989a77bf02c8b595d2b86ef1a2148c987417e161f17555a4263adb1b52be9cd517acf9136cd48bfaa5e92009656e0c75be88a7ecee11e8d0
|
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
|
|
@@ -4,9 +4,13 @@ module Tramway
|
|
4
4
|
module Collections
|
5
5
|
module Helper
|
6
6
|
def collection_list_by(name:)
|
7
|
-
|
7
|
+
begin
|
8
|
+
require name # needed to load class name with collection
|
9
|
+
rescue LoadError
|
10
|
+
raise "No such file #{name}. You should create file in the `lib/#{name}.rb` or elsewhere you want"
|
11
|
+
end
|
8
12
|
unless ::Tramway::Collection.descendants.map(&:to_s).include?(name.camelize)
|
9
|
-
raise "There no such collection named #{name.camelize}. Please create class with self method `list` and extended of `Tramway::Collection
|
13
|
+
raise "There no such collection named #{name.camelize}. Please create class with self method `list` and extended of `Tramway::Collection`. You should reload your server after creating this collection."
|
10
14
|
end
|
11
15
|
|
12
16
|
name.camelize.constantize.list
|
data/lib/tramway/core.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Tramway::Core::Application
|
4
|
-
attr_accessor :name, :url, :model_class, :title, :tagline, :found_date
|
4
|
+
attr_accessor :name, :url, :model_class, :title, :tagline, :found_date, :phone, :email
|
5
5
|
|
6
6
|
def public_name
|
7
7
|
name.to_s.gsub('_', ' ').camelize
|
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.
|
4
|
+
version: 1.14.7
|
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-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: audited
|
@@ -124,22 +124,16 @@ dependencies:
|
|
124
124
|
name: loofah
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- - "~>"
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
version: '2.2'
|
130
127
|
- - ">="
|
131
128
|
- !ruby/object:Gem::Version
|
132
|
-
version: 2.
|
129
|
+
version: 2.3.1
|
133
130
|
type: :runtime
|
134
131
|
prerelease: false
|
135
132
|
version_requirements: !ruby/object:Gem::Requirement
|
136
133
|
requirements:
|
137
|
-
- - "~>"
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: '2.2'
|
140
134
|
- - ">="
|
141
135
|
- !ruby/object:Gem::Version
|
142
|
-
version: 2.
|
136
|
+
version: 2.3.1
|
143
137
|
- !ruby/object:Gem::Dependency
|
144
138
|
name: mini_magick
|
145
139
|
requirement: !ruby/object:Gem::Requirement
|