tramway-core 1.18.6 → 2.0.0.3
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/attributes/view_helper.rb +1 -1
- data/app/decorators/tramway/core/concerns/attributes_decorator_helper.rb +3 -1
- data/app/forms/tramway/core/application_forms/submit_helper.rb +6 -2
- data/app/forms/tramway/core/extendable_forms_helpers/properties_helper.rb +1 -1
- data/app/helpers/tramway/core/title_helper.rb +1 -0
- data/app/models/tramway/core/application_record.rb +8 -3
- 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: 8cb5f162d7f0c25e14716d625868a33da89c697af2ec591d7f7979a1be186ec3
|
4
|
+
data.tar.gz: '09d897ed92f6a1231178781b82bcf2b670887287f04e1d73404750db13ce44a2'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91fa7227004fdd8703de213ac2bdef4d82235389cc807da5ebce079e31549d00543fc01693405bc20784817e2e7ce2e4d4ea36ec8be7451c9244c1979d2e5bfb
|
7
|
+
data.tar.gz: d8ebf4899596a26019744c1a93070aa8229d160bec462ea9951e37dfc2faecd57e861fbef4f5bfe2989c133a9b3b8e2cb1c908f1bf794c9f95e538f3dd418581
|
@@ -9,7 +9,7 @@ module Tramway::Core::Attributes::ViewHelper
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def state_machine?(object, attribute_name)
|
12
|
-
attribute_name.to_s.in? object.class.
|
12
|
+
attribute_name.to_s.in? object.class.state_machines_names.map(&:to_s)
|
13
13
|
end
|
14
14
|
|
15
15
|
def view_by_value(object, value, attribute)
|
@@ -10,7 +10,9 @@ module Tramway::Core::Concerns::AttributesDecoratorHelper
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def state_machine_view(object, attribute_name)
|
13
|
-
|
13
|
+
I18n.t("state_machines.#{object.class.model_name.to_s.underscore}.#{attribute_name}.states.#{object.send(attribute_name)}")
|
14
|
+
rescue
|
15
|
+
object.aasm.human_state
|
14
16
|
end
|
15
17
|
|
16
18
|
BASE64_REGEXP = %r{^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|
|
@@ -18,7 +18,11 @@ module Tramway::Core::ApplicationForms::SubmitHelper
|
|
18
18
|
rescue ArgumentError => e
|
19
19
|
Tramway::Error.raise_error :tramway, :core, :application_form, :save, :argument_error, message: e.message
|
20
20
|
rescue StandardError => e
|
21
|
-
|
22
|
-
|
21
|
+
if e.try :name
|
22
|
+
Tramway::Error.raise_error :tramway, :core, :application_form, :save, :looks_like_you_have_method,
|
23
|
+
method_name: e.name.to_s.gsub('=', ''), model_class: @@model_class, class_name: self.class
|
24
|
+
else
|
25
|
+
raise e
|
26
|
+
end
|
23
27
|
end
|
24
28
|
end
|
@@ -4,7 +4,7 @@ module Tramway::Core::ExtendableFormsHelpers::PropertiesHelper
|
|
4
4
|
def define_properties_method(simple_properties, more_properties)
|
5
5
|
define_method 'properties' do
|
6
6
|
hash = simple_properties.each_with_object({}) do |property, h|
|
7
|
-
h.merge! property[0] => property[1] unless model.class.
|
7
|
+
h.merge! property[0] => property[1] unless model.class.state_machines_names.include?(property[0])
|
8
8
|
end
|
9
9
|
more_properties.reduce(hash) do |h, property|
|
10
10
|
h.merge! property[0] => {
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
module Tramway::Core::TitleHelper
|
4
4
|
def title(page_title = default_title)
|
5
|
+
@application ||= Tramway::Core.application&.model_class&.first || Tramway::Core.application
|
5
6
|
if @application.present?
|
6
7
|
title_text = "#{page_title} | #{@application.try(:title) || @application.public_name}"
|
7
8
|
content_for(:title) { title_text }
|
@@ -6,13 +6,14 @@ class Tramway::Core::ApplicationRecord < ActiveRecord::Base
|
|
6
6
|
self.abstract_class = true
|
7
7
|
audited
|
8
8
|
extend ::Enumerize
|
9
|
+
include ::AASM
|
9
10
|
|
10
|
-
|
11
|
-
state :active
|
11
|
+
aasm column: :state do
|
12
|
+
state :active, initial: true
|
12
13
|
state :removed
|
13
14
|
|
14
15
|
event :remove do
|
15
|
-
|
16
|
+
transitions from: :active, to: :removed
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
@@ -57,6 +58,10 @@ class Tramway::Core::ApplicationRecord < ActiveRecord::Base
|
|
57
58
|
def file_extensions
|
58
59
|
@extensions
|
59
60
|
end
|
61
|
+
|
62
|
+
def state_machines_names
|
63
|
+
AASM::StateMachineStore.fetch(self).machine_names
|
64
|
+
end
|
60
65
|
end
|
61
66
|
|
62
67
|
# FIXME: detect inhertited locales
|
data/lib/tramway/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: audited
|