cmor_core 0.0.44.pre → 0.0.45.pre
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53ed5b83e139b9acf2527e109a41c64992b42f1623a7bfeb05d9d86a5900ee44
|
4
|
+
data.tar.gz: 89467bd5e1a64ae94cfc1dcc6cc615dd55aaa7e388bbce0b8cd7a102d9f69227
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cea218343f7eafc2fe2dbcbcd9c0ca5c93aed61dc623600a0cda02cf9413076b2d4056317ddfe4ebcf54dc7e957d18331c6b94496517a21e300d593d902ea7bd
|
7
|
+
data.tar.gz: 38be3f9e2aa5fc04513b7b99b644364b2bb368b3c550356686cd637bfd1f043010364d0ac4e22d1456573c2a3730ebaa2de2a6c9f53ccf59dac849ebf5eeacb8
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Cmor
|
2
|
+
module Core
|
3
|
+
module Model
|
4
|
+
module CollectionConcern
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
include Cmor::Core::Model::LocalizationConcern
|
9
|
+
include Cmor::Core::Model::IdentifierConcern
|
10
|
+
|
11
|
+
# acts as published
|
12
|
+
include ActsAsPublished::ActiveRecord
|
13
|
+
acts_as_published
|
14
|
+
|
15
|
+
# acts as list
|
16
|
+
acts_as_list
|
17
|
+
default_scope { order(position: :asc) }
|
18
|
+
|
19
|
+
# slugs
|
20
|
+
extend FriendlyId
|
21
|
+
friendly_id :name, use: :slugged
|
22
|
+
|
23
|
+
validates :name, presence: true, uniqueness: { scope: [ :locale ] }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Cmor
|
2
|
+
module Core
|
3
|
+
module Model
|
4
|
+
module LocalizationConcern
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
validates :locale, inclusion: { in: I18n.available_locales.map(&:to_s) }, allow_nil: true, allow_blank: true
|
9
|
+
|
10
|
+
scope :for_locale, ->(locale = I18n.locale, options = {}) do
|
11
|
+
options.reverse_merge!(include_without_locale: true)
|
12
|
+
|
13
|
+
if options[:include_without_locale]
|
14
|
+
where(locale: locale).or(where(locale: nil))
|
15
|
+
else
|
16
|
+
where(locale: locale)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmor_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.45.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01
|
11
|
+
date: 2020-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.45.pre
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0.
|
40
|
+
version: 0.0.45.pre
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: delayed_job_active_record
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -340,6 +340,9 @@ files:
|
|
340
340
|
- lib/cmor/core/configuration.rb
|
341
341
|
- lib/cmor/core/engine.rb
|
342
342
|
- lib/cmor/core/feature.rb
|
343
|
+
- lib/cmor/core/model/collection_concern.rb
|
344
|
+
- lib/cmor/core/model/identifier_concern.rb
|
345
|
+
- lib/cmor/core/model/localization_concern.rb
|
343
346
|
- lib/cmor/core/spec_helpers/feature.rb
|
344
347
|
- lib/cmor/core/version.rb
|
345
348
|
- lib/cmor_core.rb
|