tramway-core 1.16.1 → 1.16.1.5

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
  SHA256:
3
- metadata.gz: 90e0f6addfaa061388a54435ff519ba09544d1948dc8a2130f51457b23bef215
4
- data.tar.gz: eb50727af2688a79eaa59b64320b1d127deb02658d2f0fc3587e7c6f43069217
3
+ metadata.gz: f6e95b821e3743c540a04d8972861cec96926adb1fb210c9a51a39c5caa711cd
4
+ data.tar.gz: 456b6f0345b026debd72949521ab48b0bbc8b855d38045ca2bd70c7f6868b7de
5
5
  SHA512:
6
- metadata.gz: 7a22b749b982662f6c9aace0e951d5d408107501311143312bd38240d0a8fe33d0f4bfa9c9c58c4766ff4362944b0fc74a402e2bfc228f5729606297ffea7268
7
- data.tar.gz: 8cfa52bb4c944ec0fb3f60875eaa7be874905d58be07943ae93775556bf4e651e6207d91f7216df717af657fae1121e7771e611c2e88c65ddd0ba22eccc2fc8c
6
+ metadata.gz: 8e9d365a1af79128772bec57746ad6fc1bfc61e840179ac98eed919b620b6656ff7d1448a6f6cf12a6ec69c73e8a72f2a9c4666a0ccbd70c34e08e878812d794
7
+ data.tar.gz: 796ce3b5eab185625a02945ff9e90ab78cb2e74bae61de21bb4aa68180c199dae52fd63cd1ef46864edf42cb788d07aa5f4956b1573e3942b9375f73ce512d35
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` основным шрифтом для иконок.
@@ -1,6 +1,8 @@
1
1
  #= require jquery
2
2
  #= require jquery_ujs
3
+ #= require jquery3
3
4
  #= require popper
5
+ #= require bootstrap
4
6
  #= require bootstrap-datepicker-1.8.0
5
7
  #= require bootstrap-datepicker-1.8.0.ru.min
6
8
  #= require font_awesome5
@@ -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
@@ -24,6 +24,10 @@ module Tramway
24
24
 
25
25
  include ::PgSearch::Model
26
26
 
27
+ def creator
28
+ audits.where(action: :create).first.user
29
+ end
30
+
27
31
  # FIXME: detect inhertited locales
28
32
  class << self
29
33
  def human_attribute_name(attribute_name, *_args)
@@ -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.5'
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.5
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-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: audited