tramway-core 1.18.6.1 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/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: cc709cc658e3bb686e5cf2168db2563d04374053cb83d49b6a0b987971b86271
|
4
|
+
data.tar.gz: 3093efbf62bad2d3e8316dd5f98c0d642c4f384529bd9168b85b6651a31f04ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4b131aa515137b26623ff4e9b894ff7d754532b42952d8c39eb9193c1226e90e6008dd76f43e5e9af80a1ef4fe2fa062c1d9c7c43ac3c272b77776cc79a95ed
|
7
|
+
data.tar.gz: 4832bc73d550dd883c87f561c1227caa6e10d5ffe96a700654248eb58c5eade25ab7aed2814e585ac1c08d3ad2541f9a1251fed8727f6d8a8185e161cb4fc26a
|
@@ -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
|
-
object.
|
13
|
+
object.aasm(attribute_name).human_state
|
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}=)|
|
@@ -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'
|
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-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: audited
|