tramway-core 1.16.1.3 → 1.16.1.8

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: ce1a0b7cdeee547346146b94f4562a717b1b1fd20f4d8708a75e1304b5ad212b
4
- data.tar.gz: eb75b3c797f5d7637ed7a343731d73ed35151e50d4146447497632693929e5e3
3
+ metadata.gz: 60d00cc4eefcb7e0fc62112aa9f0b8659feb9a2e8cae3b6e3706cbbf8b282faa
4
+ data.tar.gz: 917fa60aa8ab295c6cccc627b1b78ece7facfd7eda0e7cdb0832d415f570d0d4
5
5
  SHA512:
6
- metadata.gz: cabfde795da437d015c64c257de6ac2bc025002032bb95aa5b01324ca4e4c6b963e30e4c364a1d9b2938bec996cafc47912ecc7381e5bdf0a6e670c905770657
7
- data.tar.gz: ff5a52deb2ff392ffd217562e6dc40da8a91ca33f0dd704f0a293521da71067e87c029b351e6bd2f8b1dc6424aaff734214382ed34b193986e199b6de45ce686
6
+ metadata.gz: 0716a142a635f9ed3f24221650644b3d88f1537665bebb60defe69b65028aa01d45d065b300b30752daacb2e73edc42d9ad33b3c764c68f6b52608f5018181c2
7
+ data.tar.gz: a110f54c9eaf350d96009f9ea55c5918a1521339cf0935af30b9486960be9aa14a5fe4a9a582123252ab5fb53a34bf9f17a9ba21583cd74801fad0a2c1f8b5c3
@@ -1,5 +1,7 @@
1
1
  #= require jquery
2
2
  #= require jquery_ujs
3
+ #= require jquery3
4
+ #= require popper
3
5
  #= require bootstrap
4
6
  #= require bootstrap-datepicker-1.8.0
5
7
  #= require bootstrap-datepicker-1.8.0.ru.min
@@ -49,7 +49,7 @@ class Tramway::Core::ApplicationDecorator
49
49
  end
50
50
  end
51
51
 
52
- def decorate_association(association_name, decorator: nil, as: nil)
52
+ def decorate_association(association_name, decorator: nil, as: nil, state_machines: [])
53
53
  @@decorated_associations ||= []
54
54
  @@decorated_associations << association_name
55
55
 
@@ -82,6 +82,10 @@ class Tramway::Core::ApplicationDecorator
82
82
  define_method "#{association_name}_as" do
83
83
  as
84
84
  end
85
+
86
+ define_method "#{association_name}_state_machines" do
87
+ state_machines
88
+ end
85
89
  end
86
90
 
87
91
  def model_class
@@ -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}===))$})
@@ -97,6 +97,12 @@ module Tramway::Core
97
97
  end
98
98
  end
99
99
 
100
+ def attributes
101
+ properties.reduce({}) do |hash, property|
102
+ hash.merge! property => send(property.first)
103
+ end
104
+ end
105
+
100
106
  class << self
101
107
  delegate :defined_enums, to: :model_class
102
108
 
@@ -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
@@ -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.3'
5
+ VERSION = '1.16.1.8'
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.3
4
+ version: 1.16.1.8
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-11 00:00:00.000000000 Z
11
+ date: 2020-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: audited