tramway-core 1.16.1.2 → 1.16.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 017a580d651db5e34a2c210e4a437d4814fa24e113282c671947d0bedc9da5d8
4
- data.tar.gz: 54bbf37e085bf2301deaa7a278a0ef160e7827e09cc69dc59f6912f139d9e26f
3
+ metadata.gz: 9c4dc12324826f488061ffa8c8b64be952eecb644662b40b379fae7e26fa800e
4
+ data.tar.gz: 7eab62f3bd89ed42afc09bd5ab56178945466ce3bb5c10a1c75493bf1d80a2ff
5
5
  SHA512:
6
- metadata.gz: a93990b8d078e22ac41a97c3e92cdad1218c514df376734c4a9b3eccbcd7f2854aadc0463f850d3f85be1d85557c80fed0c154a88364f032b727dbba6ac5e61e
7
- data.tar.gz: 2746e346742da0c30994c7c4c4e95a519a038e7739291ad49761c607b1a70e06860e3d0671d3d9d584e169f356b985d4d05faf30b60275200337fcf19afa5b48
6
+ metadata.gz: 81ec9c1e2e0622078f59120c966dd9613d7ee659464da2cc6ca683fd01025872b7dbaa190d03c358f8e875122f08ec51ef6972fe8f4a4e5744037471449bd703
7
+ data.tar.gz: 99f2a9dd8417c18b2b910c4e6c1279bb54e8f2cc7932c4fc409cd8326659bf1aa0009f5b98ce3036ec136b6cd2e661f746f6e09d93fa77627b9ca67810374147
@@ -16,7 +16,7 @@ module Tramway::Core::Concerns::AttributesDecoratorHelper
16
16
  def image_view(original, thumb: nil, filename: nil)
17
17
  if original.present?
18
18
  thumb ||= original.is_a?(CarrierWave::Uploader::Base) ? original.small : nil
19
- filename ||= original.is_a?(CarrierWave::Uploader::Base) ? original.path.split('/').last : nil
19
+ filename ||= original.is_a?(CarrierWave::Uploader::Base) ? original.path&.split('/')&.last : nil
20
20
  src_thumb = if thumb&.is_a?(CarrierWave::Uploader::Base)
21
21
  thumb.url
22
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}===))$})
@@ -54,7 +54,7 @@ class Tramway::Core::ExtendableForm
54
54
  validator_object = "#{pair[0].camelize}Validator".constantize.new(attributes: :not_blank)
55
55
  if pair[1] == 'true' && !validator_object.send(:valid?, value)
56
56
  model.errors.add property[0],
57
- I18n.t("activerecord.errors.models.#{model.class.name.underscore}.attributes.#{property[0]}.#{pair[0]}", value: value)
57
+ I18n.t("activerecord.errors.models.#{model.class.name.underscore}.attributes.default.#{pair[0]}", value: value)
58
58
  end
59
59
  end
60
60
  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)
@@ -1 +1 @@
1
- = f.input field.title.to_sym, as: :boolean, input_html: { class: class_name, id: "#{class_name}_#{field.title.to_sym}", name: "#{class_name}[#{field.title}]" }, checked_value: value == field.title.to_sym
1
+ = f.input field.title.to_sym, as: :boolean, input_html: { class: class_name, id: "#{class_name}_#{field.title.to_sym}", name: "#{class_name}[#{field.title}]" }, checked_value: value == field.title.to_sym, required: field.required
@@ -1,16 +1,16 @@
1
1
  - parsed_json = field.options.is_a?(Hash) ? field.options : (JSON.parse(field.options) unless field.options == '')
2
2
  - if parsed_json&.dig('collection', 'name')
3
3
  - if value.present?
4
- = f.input field.title.to_sym, as: :select, collection: collection_list_by(name: parsed_json['collection']['name']), input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }, selected: value
4
+ = f.input field.title.to_sym, as: :select, collection: collection_list_by(name: parsed_json['collection']['name']), input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }, selected: value, required: field.required
5
5
  - else
6
- = f.input field.title.to_sym, as: :select, collection: collection_list_by(name: parsed_json['collection']['name']), input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }
6
+ = f.input field.title.to_sym, as: :select, collection: collection_list_by(name: parsed_json['collection']['name']), input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }, required: field.required
7
7
  - elsif parsed_json&.dig('collection', 'array')
8
8
  - if value.present?
9
- = f.input field.title.to_sym, as: :select, collection: parsed_json.dig('collection', 'array'), input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }, selected: value
9
+ = f.input field.title.to_sym, as: :select, collection: parsed_json.dig('collection', 'array'), input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }, selected: value, required: field.required
10
10
  - else
11
- = f.input field.title.to_sym, as: :select, collection: parsed_json.dig('collection', 'array'), input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }
11
+ = f.input field.title.to_sym, as: :select, collection: parsed_json.dig('collection', 'array'), input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }, required: field.required
12
12
  - else
13
13
  - if value.present?
14
- = f.input field.title.to_sym, as: :select, input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }, selected: value
14
+ = f.input field.title.to_sym, as: :select, input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }, selected: value, required: field.required
15
15
  - else
16
- = f.input field.title.to_sym, as: :select, input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }
16
+ = f.input field.title.to_sym, as: :select, input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }, required: field.required
@@ -1,4 +1,4 @@
1
1
  - if value.present?
2
- = f.input field.title.to_sym, as: field.field_type, input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]", value: value }
2
+ = f.input field.title.to_sym, as: field.field_type, input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]", value: value }, required: field.required
3
3
  - else
4
- = f.input field.title.to_sym, as: field.field_type, input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }
4
+ = f.input field.title.to_sym, as: field.field_type, input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }, required: field.required
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Core
5
- VERSION = '1.16.1.2'
5
+ VERSION = '1.16.1.7'
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.2
4
+ version: 1.16.1.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-02-07 00:00:00.000000000 Z
11
+ date: 2020-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: audited