tramway-core 1.16.1.5 → 1.16.2
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/decorators/tramway/core/application_decorator.rb +5 -1
- data/app/forms/tramway/core/application_form.rb +6 -0
- data/app/forms/tramway/core/extendable_form.rb +1 -1
- data/app/uploaders/photo_uploader.rb +2 -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: adc76271757be0c7460400fff39e98dcf26d0b82de5fb53cbf6f1e603d581a2c
|
4
|
+
data.tar.gz: 0d1dbda847666e5a1eee2b1b244d9902706f475019c42c4337ac248ab24c519d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48e33eaa840cebc55156308ec72175a92c8938d930549d768247f9d96b8584662d9eb5648192da535e485070236d5904e340933a3621f9068bde5e6ecb5bc6db
|
7
|
+
data.tar.gz: f2d61018cd3571c8dff6f943a6cceb2f39c1bdc8947f951d1c64a050a9d9c962f7ef1cc9bb1bc525f068f627d6228052727e8be2eb3df837ae302b5daa5c5c80
|
@@ -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
|
@@ -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.first => model.values[property.first.to_s]
|
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.#{
|
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
|
@@ -11,7 +11,8 @@ class PhotoUploader < ApplicationUploader
|
|
11
11
|
if file.present? && File.exist?(file.file)
|
12
12
|
file.file.match(%r{/system/uploads/.*}).to_s
|
13
13
|
else
|
14
|
-
'/assets/tramway/core/mona_lisa_from_prado_square.jpg'
|
14
|
+
default_url = '/assets/tramway/core/mona_lisa_from_prado_square.jpg'
|
15
|
+
File.exists?(default_url) ? default_url : ''
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
@@ -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.
|
4
|
+
version: 1.16.2
|
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-
|
11
|
+
date: 2020-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: audited
|