tramway-core 1.18.6.1 → 2.0.0.4
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/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: c979b311b87c5092521ece9d85af2b7f926eaaf9c5c2e3ed95988e79aaf8236a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9ef4edc25ac5f405334c09ab72b72b3fa196b544ad37cf369213e971c91e5432
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8e35b31657316cfa10c136e5a462f6b70358a43cead00ccb68091fe5c953010be01164a1682cfa563f102b805a02a81ea9a2ba24ecbac5b49642f82a30acb369
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: '03833355b07b4ceb608941c4f3ec07d9427a638ce732b067a137cd161a41410d9384f77bc20f36a4b5f57d352a15078a3822fec7399a46f1a1117005278d0666'
         
     | 
| 
         @@ -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}=)|
         
     | 
| 
         @@ -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.4
         
     | 
| 
       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
         
     |