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 +4 -4
- data/app/assets/javascripts/tramway/core/application.js.coffee +2 -0
- data/app/decorators/tramway/core/application_decorator.rb +5 -1
- data/app/decorators/tramway/core/concerns/attributes_decorator_helper.rb +1 -1
- data/app/forms/tramway/core/application_form.rb +6 -0
- data/app/forms/tramway/core/extendable_form.rb +1 -1
- data/app/views/tramway/core/shared/input_extended_types/_checkbox.html.haml +1 -1
- data/app/views/tramway/core/shared/input_extended_types/_select.html.haml +6 -6
- data/app/views/tramway/core/shared/input_extended_types/_simple.html.haml +2 -2
- data/lib/tramway/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60d00cc4eefcb7e0fc62112aa9f0b8659feb9a2e8cae3b6e3706cbbf8b282faa
|
4
|
+
data.tar.gz: 917fa60aa8ab295c6cccc627b1b78ece7facfd7eda0e7cdb0832d415f570d0d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0716a142a635f9ed3f24221650644b3d88f1537665bebb60defe69b65028aa01d45d065b300b30752daacb2e73edc42d9ad33b3c764c68f6b52608f5018181c2
|
7
|
+
data.tar.gz: a110f54c9eaf350d96009f9ea55c5918a1521339cf0935af30b9486960be9aa14a5fe4a9a582123252ab5fb53a34bf9f17a9ba21583cd74801fad0a2c1f8b5c3
|
@@ -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
|
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.#{
|
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
|
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.16.1.
|
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
|
+
date: 2020-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: audited
|