unidom-action 1.9.2 → 1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c14a7a16256d7b7245fda31131cb51a2d801a3be
4
- data.tar.gz: 87ea8aa1937718df6a47c4e92f72809ba6cc2b3b
3
+ metadata.gz: b2deaee6276c97fd1733d2451217ed26997735a5
4
+ data.tar.gz: a0da4cd35a4aba30877b3fc7ff322709d51326a7
5
5
  SHA512:
6
- metadata.gz: c122304057a644714cd8ec0a2b83269bf5c9d7d7687c3155cd9b34bc91cb07b1ccea1eedea3597a0179be4a33b84ff0d3381c287e65ff35149736ac53155a039
7
- data.tar.gz: 64685d0a99fd621e42ddc111a57399cf20b43f52133f953bdbc6a6bb625b7bc414571e5937bbf61f6386ed592cffe9454b3a72c9b8a7c8c05c756b721ce3d46d
6
+ metadata.gz: ddbb1bc597148571ff17e4669cc393cc9d5509bc91a68b0618025cd3a5ca425a69b984c4392f65dd5f55f7bcf72830f64ca68aeb6f7916a1a1e32944f3cd1981
7
+ data.tar.gz: 3b18f7f51e9dd0e76e755fb8269c871a25568f62b3b6c59d98af2fbc1f5d6cebf380caf33ed6df68d4b291f07e4a8828341c0f9bbfa6a8dd8376a9568aa8aa5c
data/README.md CHANGED
@@ -122,3 +122,14 @@ The As State Transitor Party concern do the following tasks for the includer aut
122
122
  1. Define the has_many :transited_state_transitions macro as: ``has_many :transited_state_transitions, class_name: 'Unidom::Action::StateTransition', as: :transitor_party``
123
123
  2. Define the #transit! method as: ``transit!(it, from: nil, thru: nil, due_to: nil, via: nil, at: Time.now)``
124
124
  3. Define the #transit? method as: ``transit?(it, from: nil, thru: nil, due_to: nil, via: nil, at: Time.now)``
125
+
126
+
127
+
128
+ ## Enum codes
129
+
130
+ ### Obsolescence enum code
131
+
132
+ ```ruby
133
+ Unidom::Action::Obsolescence::Obsolesce
134
+ Unidom::Action::Obsolescence::Recover
135
+ ```
@@ -8,6 +8,7 @@ class Unidom::Action::Obsolescing < Unidom::Action::ApplicationRecord
8
8
  self.table_name = 'unidom_obsolescings'
9
9
 
10
10
  include Unidom::Common::Concerns::ModelExtension
11
+ include ProgneTapera::EnumCode
11
12
 
12
13
  belongs_to :obsolescer_visitor, polymorphic: true
13
14
  belongs_to :obsolescer_party, polymorphic: true
@@ -19,6 +20,8 @@ class Unidom::Action::Obsolescing < Unidom::Action::ApplicationRecord
19
20
  scope :obsolesced_is, ->(obsolesced) { where obsolesced: obsolesced }
20
21
  scope :caused_by, ->(reason) { where reason_id: to_id(reason) }
21
22
 
23
+ code :obsolescence, Unidom::Action::Obsolescence
24
+
22
25
  def self.obsolesce!(obsolesced: nil, obsolescer_visitor: nil, obsolescer_party: nil, reason: nil, obsolescence_code: 'OBSL', opened_at: Time.now)
23
26
  create! obsolesced: obsolesced, obsolescer_visitor: obsolescer_visitor, obsolescer_party: obsolescer_party, reason: reason, obsolescence_code: obsolescence_code, opened_at: opened_at
24
27
  end
@@ -0,0 +1,7 @@
1
+ class Unidom::Action::Obsolescence < ActiveRecord::Type::Value
2
+
3
+ include ProgneTapera::EnumConfig
4
+
5
+ enum :unidom_obsolescence
6
+
7
+ end
data/config/enum.yml ADDED
@@ -0,0 +1,7 @@
1
+ enum:
2
+
3
+ unidom_obsolescence:
4
+ obsolesce:
5
+ code: 'OBSL'
6
+ recover:
7
+ code: 'RCVR'
@@ -0,0 +1,6 @@
1
+ 'zh-CN':
2
+ enum:
3
+
4
+ unidom_obsolescence:
5
+ obsolesce: 过期
6
+ recover: 恢复
@@ -1,3 +1,5 @@
1
+ require 'unidom/common/yaml_helper'
2
+
1
3
  module Unidom
2
4
  module Action
3
5
 
@@ -5,6 +7,10 @@ module Unidom
5
7
 
6
8
  isolate_namespace ::Unidom::Action
7
9
 
10
+ initializer :load_config_initializers do |app|
11
+ Unidom::Common::YamlHelper.load_enum config: app.config, root: config.root
12
+ end
13
+
8
14
  initializer :append_migrations do |app|
9
15
  config.paths['db/migrate'].expanded.each { |expanded_path| app.config.paths['db/migrate'] << expanded_path } unless app.root.to_s.match root.to_s
10
16
  end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Action
3
- VERSION = '1.9.2'.freeze
3
+ VERSION = '1.10'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-action
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.2
4
+ version: '1.10'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-09 00:00:00.000000000 Z
11
+ date: 2016-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -54,7 +54,10 @@ files:
54
54
  - app/models/unidom/action/obsolescing.rb
55
55
  - app/models/unidom/action/reason.rb
56
56
  - app/models/unidom/action/state_transition.rb
57
+ - app/types/unidom/action/obsolescence.rb
57
58
  - app/views/layouts/unidom/action/application.html.erb
59
+ - config/enum.yml
60
+ - config/locales/enum.zh-CN.yml
58
61
  - config/routes.rb
59
62
  - db/migrate/20000501000000_create_unidom_reasons.rb
60
63
  - db/migrate/20000510000000_create_unidom_actings.rb