tramway-core 1.16.1 → 1.16.1.1

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
  SHA256:
3
- metadata.gz: 90e0f6addfaa061388a54435ff519ba09544d1948dc8a2130f51457b23bef215
4
- data.tar.gz: eb50727af2688a79eaa59b64320b1d127deb02658d2f0fc3587e7c6f43069217
3
+ metadata.gz: 7338b8f074bd608f2df2cbc5a375a32244088c869971717b2893bfd0d6d6d7bb
4
+ data.tar.gz: ee31d9fb50b6e57162f2e33624ed7560a36f3b0254f76f21fd67a9f815419826
5
5
  SHA512:
6
- metadata.gz: 7a22b749b982662f6c9aace0e951d5d408107501311143312bd38240d0a8fe33d0f4bfa9c9c58c4766ff4362944b0fc74a402e2bfc228f5729606297ffea7268
7
- data.tar.gz: 8cfa52bb4c944ec0fb3f60875eaa7be874905d58be07943ae93775556bf4e651e6207d91f7216df717af657fae1121e7771e611c2e88c65ddd0ba22eccc2fc8c
6
+ metadata.gz: 620061bc49ddca5425b1117ba685fa147de7cbc8ed3409d240f9d3288f730a17610f5567d7468bc23282962c5563773bff6530e9120f40da186a4889c6f8b8e0
7
+ data.tar.gz: '064825fc0d377cb01afae81d07a5d5cfebc9706ea566076c7166b869883aa9c3bc450131f3a9df7498e0309d8a7665a0627d45cec4cc24e5eb8cbfdadea023af'
data/README.md CHANGED
@@ -12,6 +12,7 @@ tramway-core - это ядро проекта [tramway](https://github.com/ulmic
12
12
  ```ruby
13
13
  gem 'tramway-core'
14
14
  gem 'audited'
15
+ gem 'clipboard-rails'
15
16
  ```
16
17
 
17
18
  ```shell
@@ -81,6 +82,31 @@ def field_type
81
82
  end
82
83
  ```
83
84
 
85
+ ## Other helpers
86
+
87
+ ### CopyToClipboardHelper
88
+
89
+ [app/helpers/tramway/core/copy_to_clipboard_helper.rb](https://github.com/ulmic/tramway-dev/blob/develop/tramway-core/app/helpers/tramway/core/copy_to_clipboard_helper.rb)
90
+
91
+ #### Install
92
+
93
+ ```ruby
94
+ include ::Tramway::Core::CopyToClipboardHelper
95
+ ```
96
+
97
+ #### How to use it
98
+
99
+ It will show you in the view in bootstrap styles with font-awesome `copy` icon.
100
+
101
+ Something like this:
102
+
103
+ ![copy_to_clipboard_button](https://raw.githubusercontent.com/ulmic/tramway-dev/develop/tramway-core/docs/copy_to_clipboard_button.png)
104
+
105
+ ```ruby
106
+ copy_to_clipboard "some_id" # some_id is HTML id of element. Content of this element will be copied to the clipboard after pressing the button
107
+ ```
108
+
109
+
84
110
  # Базовые классы
85
111
 
86
112
  * ApplicationDecorator - Базовый класс декоратора. В него по умолчанию включены `ActionView::Helpers` и `ActionView::Context` и `FontAwesome5` (версия гема FontAwesome, которая поддерживает 5 версию шрифта). `FontAwesome` считается в `Tramway` основным шрифтом для иконок.
@@ -15,11 +15,11 @@ module Tramway::Core::Concerns::AttributesDecoratorHelper
15
15
 
16
16
  def image_view(original, thumb: nil, filename: nil)
17
17
  if original.present?
18
- thumb ||= original.small
19
- filename ||= original.path.split('/').last
20
- src_thumb = if thumb.is_a?(CarrierWave::Uploader::Base)
18
+ thumb ||= original.is_a?(CarrierWave::Uploader::Base) ? original.small : nil
19
+ filename ||= original.is_a?(CarrierWave::Uploader::Base) ? original.path.split('/').last : nil
20
+ src_thumb = if thumb&.is_a?(CarrierWave::Uploader::Base)
21
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}===))$})
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
23
  "data:image/jpeg;base64,#{thumb}"
24
24
  else
25
25
  thumb
@@ -33,12 +33,12 @@ module Tramway::Core::Concerns::AttributesDecoratorHelper
33
33
  end
34
34
  content_tag(:div) do
35
35
  begin
36
- concat image_tag src_thumb
36
+ concat image_tag src_thumb || src_original
37
37
  rescue NoMethodError => e
38
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
39
  raise error.message
40
40
  end
41
- concat link_to(fa_icon(:download), src_original, class: 'btn btn-success', download: filename)
41
+ concat link_to(fa_icon(:download), src_original, class: 'btn btn-success', download: filename) if filename
42
42
  end
43
43
  end
44
44
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  class FileUploader < ApplicationUploader
4
4
  def extension_white_list
5
- %w[pdf doc docx xls csv xlsx jpg]
5
+ %w[pdf doc docx xls csv xlsx jpg svg png jpeg gif]
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Core
5
- VERSION = '1.16.1'
5
+ VERSION = '1.16.1.1'
6
6
  end
7
7
  end
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.16.1
4
+ version: 1.16.1.1
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-28 00:00:00.000000000 Z
11
+ date: 2020-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: audited