cmor_cms 0.0.41.pre → 0.0.42.pre
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/{models/concerns/model → concerns}/cmor/cms/navigation_item/properties_concern.rb +2 -4
- data/app/models/cmor/cms/navigation.rb +5 -1
- data/app/models/cmor/cms/navigation_item.rb +5 -3
- data/app/models/cmor/cms/page.rb +5 -1
- data/app/models/cmor/cms/partial.rb +13 -9
- data/app/models/cmor/cms/template.rb +14 -8
- data/app/resolvers/cmor/cms/database_resolver.rb +3 -0
- data/app/view_helpers/cmor/cms/navigation_view_helper.rb +4 -4
- data/config/locales/de.yml +14 -20
- data/config/locales/en.yml +14 -22
- data/db/migrate/20200120134306_add_published_at_to_cmor_cms_pages.rb +5 -0
- data/db/migrate/20200120134342_add_published_at_to_cmor_cms_templates.rb +5 -0
- data/db/migrate/20200120134400_add_published_at_to_cmor_cms_partials.rb +5 -0
- data/db/migrate/20200120134422_add_published_at_to_cmor_cms_navigation_items.rb +5 -0
- data/db/migrate/20200120141440_set_all_publishable_to_published.rb +27 -0
- data/lib/cmor_cms.rb +1 -0
- metadata +26 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90f0546f5a5685f505565098b2661619c9ebd7709e9f417afec3c59ce148c57f
|
4
|
+
data.tar.gz: 692e92872c9310bcb78619d4a9c2daf11ca479ec95bee3fce82393be4fefeea9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70caf6861fb95e2443cc061457052fafc548429abd3959dfea37eb33128b88795a8daa998801504b711a36ddc2b023829bc870fe3471e78d59e4fef5f62ed080
|
7
|
+
data.tar.gz: ef85c25428f70e360cab41df214b30ba6267b2922af79c759a4f3f94253ad94d1b441cfa5d92b84fb0eebd66de137de6ff99925bd7244a38e2991429b3831921
|
@@ -1,7 +1,11 @@
|
|
1
1
|
class Cmor::Cms::Navigation < ActiveRecord::Base
|
2
2
|
# associations
|
3
3
|
has_many :navigation_items,
|
4
|
-
dependent: :destroy
|
4
|
+
dependent: :destroy do
|
5
|
+
def published
|
6
|
+
merge(Cmor::Cms::NavigationItem.published)
|
7
|
+
end
|
8
|
+
end
|
5
9
|
|
6
10
|
# validations
|
7
11
|
validates :locale, inclusion: I18n.available_locales.map(&:to_s),
|
@@ -1,8 +1,6 @@
|
|
1
|
-
require_dependency 'model/cmor/cms/navigation_item/properties_concern'
|
2
|
-
|
3
1
|
module Cmor::Cms
|
4
2
|
class NavigationItem < ActiveRecord::Base
|
5
|
-
include
|
3
|
+
include Cmor::Cms::NavigationItem::PropertiesConcern
|
6
4
|
|
7
5
|
# associations
|
8
6
|
belongs_to :navigation,
|
@@ -10,6 +8,10 @@ module Cmor::Cms
|
|
10
8
|
belongs_to :page,
|
11
9
|
optional: true
|
12
10
|
|
11
|
+
# publishing
|
12
|
+
include ActsAsPublished::ActiveRecord
|
13
|
+
acts_as_published
|
14
|
+
|
13
15
|
# awesome nested set
|
14
16
|
acts_as_nested_set dependent: :destroy, counter_cache: :children_count, scope: :navigation_id
|
15
17
|
|
data/app/models/cmor/cms/page.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Cmor::Cms
|
2
2
|
class Page < ActiveRecord::Base
|
3
3
|
# add shared behaviour for database backed templates
|
4
|
-
include DatabaseTemplate
|
4
|
+
include Cmor::Cms::DatabaseTemplate
|
5
5
|
|
6
6
|
# associations
|
7
7
|
has_many :navigation_items,
|
@@ -12,6 +12,10 @@ module Cmor::Cms
|
|
12
12
|
|
13
13
|
accepts_nested_attributes_for :content_blocks, allow_destroy: true
|
14
14
|
|
15
|
+
# publishing
|
16
|
+
include ActsAsPublished::ActiveRecord
|
17
|
+
acts_as_published
|
18
|
+
|
15
19
|
# callbacks
|
16
20
|
after_save :touch_navigation_items
|
17
21
|
|
@@ -1,15 +1,19 @@
|
|
1
|
-
|
1
|
+
module Cmor::Cms
|
2
|
+
class Partial < ActiveRecord::Base
|
3
|
+
# add shared behaviour for database backed templates
|
4
|
+
include Cmor::Cms::DatabaseTemplate
|
2
5
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
+
# publishing
|
7
|
+
include ActsAsPublished::ActiveRecord
|
8
|
+
acts_as_published
|
6
9
|
|
7
|
-
|
8
|
-
|
10
|
+
# callbacks
|
11
|
+
before_validation :ensure_basename_starts_with_underscore, if: proc { |t| t.basename.present? }
|
9
12
|
|
10
|
-
|
13
|
+
private
|
11
14
|
|
12
|
-
|
13
|
-
|
15
|
+
def ensure_basename_starts_with_underscore
|
16
|
+
basename.insert(0, '_') unless basename.start_with?('_')
|
17
|
+
end
|
14
18
|
end
|
15
19
|
end
|
@@ -1,13 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module Cmor::Cms
|
2
|
+
class Template < ActiveRecord::Base
|
3
|
+
# add shared behaviour for database backed templates
|
4
|
+
include Cmor::Cms::DatabaseTemplate
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
# publishing
|
7
|
+
include ActsAsPublished::ActiveRecord
|
8
|
+
acts_as_published
|
7
9
|
|
8
|
-
|
10
|
+
# callbacks
|
11
|
+
before_validation :ensure_basename_starts_without_underscore, if: proc { |t| t.basename.present? }
|
9
12
|
|
10
|
-
|
11
|
-
|
13
|
+
private
|
14
|
+
|
15
|
+
def ensure_basename_starts_without_underscore
|
16
|
+
basename.slice!(0) if basename.start_with?('_')
|
17
|
+
end
|
12
18
|
end
|
13
19
|
end
|
@@ -27,6 +27,9 @@ module Cmor
|
|
27
27
|
|
28
28
|
query = template_class.constantize.where(conditions)
|
29
29
|
|
30
|
+
# 1) Only include published templates
|
31
|
+
query = query.published
|
32
|
+
|
30
33
|
# 2) Check for templates with the given format or format is nil
|
31
34
|
query = query.where(["format = ? OR format = '' OR format IS NULL", format])
|
32
35
|
|
@@ -22,7 +22,7 @@ module Cmor
|
|
22
22
|
#
|
23
23
|
def render(name, options = {})
|
24
24
|
options.reverse_merge!(
|
25
|
-
renderer: :
|
25
|
+
renderer: :list,
|
26
26
|
expand_all: true,
|
27
27
|
level: 1,
|
28
28
|
selected_class: nil,
|
@@ -48,7 +48,7 @@ module Cmor
|
|
48
48
|
return I18n.t('cmor.cms.navigation.messages.not_found', lang: I18n.locale.to_s, name: name.to_s)
|
49
49
|
end
|
50
50
|
|
51
|
-
roots = navigation.navigation_items.roots.all
|
51
|
+
roots = navigation.navigation_items.roots.published.all
|
52
52
|
if roots.empty?
|
53
53
|
return I18n.t('cmor.cms.navigation.messages.empty', lang: I18n.locale.to_s, name: name)
|
54
54
|
end
|
@@ -72,9 +72,9 @@ module Cmor
|
|
72
72
|
options.reverse_merge!(html: item_html.dup, link_html: link_html)
|
73
73
|
|
74
74
|
navigation.dom_class = container_css_class
|
75
|
-
if item.children.present?
|
75
|
+
if item.children.published.present?
|
76
76
|
navigation.item(item.key, item.name, item.url, options) do |sub_navigation|
|
77
|
-
item.children.each do |sub_item|
|
77
|
+
item.children.published.each do |sub_item|
|
78
78
|
build_navigation_item(sub_navigation, sub_item, container_css_class, item_html, link_html)
|
79
79
|
end
|
80
80
|
end
|
data/config/locales/de.yml
CHANGED
@@ -23,8 +23,14 @@ de:
|
|
23
23
|
one: Vorlage
|
24
24
|
other: Vorlagen
|
25
25
|
attributes:
|
26
|
-
|
26
|
+
defaults: &defaults
|
27
27
|
id: ID
|
28
|
+
created_at: Erstellt am
|
29
|
+
updated_at: Aktualisiert am
|
30
|
+
published_at: Veröffentlicht am
|
31
|
+
published: Veröffentlicht
|
32
|
+
cmor/cms/content_block:
|
33
|
+
<<: *defaults
|
28
34
|
body: Inhalt
|
29
35
|
page: Seite
|
30
36
|
page_id: Seite
|
@@ -33,24 +39,20 @@ de:
|
|
33
39
|
created_at: Erstellt am
|
34
40
|
updated_at: Aktualisiert am
|
35
41
|
cmor/cms/content_box:
|
36
|
-
|
42
|
+
<<: *defaults
|
37
43
|
name: Name
|
38
44
|
body: Inhalt
|
39
45
|
content_blocks: Content Blöcke
|
40
46
|
content_blocks_count: Content Blöcke
|
41
|
-
created_at: Erstellt am
|
42
|
-
updated_at: Aktualisiert am
|
43
47
|
cmor/cms/navigation:
|
44
|
-
|
45
|
-
created_at: Erstellt am
|
48
|
+
<<: *defaults
|
46
49
|
navigation_items: Navigationseinträge
|
47
50
|
navigation_items_count: Navigationseinträge
|
48
51
|
locale: Sprache
|
49
52
|
name: Name
|
50
53
|
slug: Freundliche ID
|
51
|
-
updated_at: Aktualisiert am
|
52
54
|
cmor/cms/navigation_item:
|
53
|
-
|
55
|
+
<<: *defaults
|
54
56
|
children_count: Unterelemente
|
55
57
|
data_add_icon: Symbol
|
56
58
|
depth: Baumtiefe
|
@@ -70,10 +72,8 @@ de:
|
|
70
72
|
rgt: Rechts
|
71
73
|
slug: Freundliche ID
|
72
74
|
url: Ziel-URL
|
73
|
-
created_at: Erstellt am
|
74
|
-
updated_at: Aktualisiert am
|
75
75
|
cmor/cms/page:
|
76
|
-
|
76
|
+
<<: *defaults
|
77
77
|
basename: Name
|
78
78
|
body: Inhalt
|
79
79
|
cmor_cms_folder_id: Ordner
|
@@ -89,10 +89,8 @@ de:
|
|
89
89
|
path_and_filename: Dateipfad
|
90
90
|
pathname: Pfad
|
91
91
|
title: Titel
|
92
|
-
created_at: Erstellt am
|
93
|
-
updated_at: Aktualisiert am
|
94
92
|
cmor/cms/partial:
|
95
|
-
|
93
|
+
<<: *defaults
|
96
94
|
basename: Name
|
97
95
|
body: Inhalt
|
98
96
|
cmor_cms_folder_id: Ordner
|
@@ -104,10 +102,8 @@ de:
|
|
104
102
|
locale: Sprache
|
105
103
|
path_and_filename: Dateipfad
|
106
104
|
pathname: Pfad
|
107
|
-
created_at: Erstellt am
|
108
|
-
updated_at: Aktualisiert am
|
109
105
|
cmor/cms/template:
|
110
|
-
|
106
|
+
<<: *defaults
|
111
107
|
basename: Name
|
112
108
|
body: Inhalt
|
113
109
|
cmor_cms_folder_id: Ordner
|
@@ -119,8 +115,6 @@ de:
|
|
119
115
|
locale: Sprache
|
120
116
|
path_and_filename: Dateipfad
|
121
117
|
pathname: Pfad
|
122
|
-
created_at: Erstellt am
|
123
|
-
updated_at: Aktualsiert am
|
124
118
|
classes:
|
125
119
|
cmor/cms/add_homepages_service: 'Dienst zum hinzufügen von Homepages'
|
126
120
|
cmor/cms/import_partials_service: 'Dienst zum importieren von Fragmenten'
|
@@ -130,7 +124,7 @@ de:
|
|
130
124
|
menu: CMS
|
131
125
|
navigation:
|
132
126
|
messages:
|
133
|
-
empty: Navigation
|
127
|
+
empty: Navigation %{name} (%{lang}) ist leer
|
134
128
|
not_found: Navigation %{name} (%{lang}) nicht gefunden
|
135
129
|
resources:
|
136
130
|
navigations: navigationen
|
data/config/locales/en.yml
CHANGED
@@ -23,34 +23,34 @@ en:
|
|
23
23
|
one: Template
|
24
24
|
other: Templates
|
25
25
|
attributes:
|
26
|
-
|
26
|
+
defaults: &defaults
|
27
27
|
id: ID
|
28
|
+
created_at: Created at
|
29
|
+
updated_at: Updated at
|
30
|
+
published_at: Published at
|
31
|
+
published: Published
|
32
|
+
cmor/cms/content_block:
|
33
|
+
<<: *defaults
|
28
34
|
body: Body
|
29
35
|
page: Page
|
30
36
|
page_id: Page
|
31
37
|
content_box: Content box
|
32
38
|
content_box_id: Content box
|
33
|
-
created_at: Created at
|
34
|
-
updated_at: Updated at
|
35
39
|
cmor/cms/content_box:
|
36
|
-
|
40
|
+
<<: *defaults
|
37
41
|
name: Name
|
38
42
|
body: Body
|
39
43
|
content_blocks: Content blocks
|
40
|
-
content_blocks_count: Content
|
41
|
-
created_at: Created at
|
42
|
-
updated_at: updated at
|
44
|
+
content_blocks_count: Content blocksx
|
43
45
|
cmor/cms/navigation:
|
44
|
-
|
46
|
+
<<: *defaults
|
45
47
|
navigation_items: Navigation items
|
46
48
|
navigation_items_count: Navigation items
|
47
49
|
locale: Language
|
48
50
|
name: Name
|
49
51
|
slug: Slug
|
50
|
-
created_at: Created at
|
51
|
-
updated_at: updated at
|
52
52
|
cmor/cms/navigation_item:
|
53
|
-
|
53
|
+
<<: *defaults
|
54
54
|
children_count: Subitems
|
55
55
|
data_add_icon: Icon
|
56
56
|
depth: Tree depth
|
@@ -70,10 +70,8 @@ en:
|
|
70
70
|
rgt: Right
|
71
71
|
slug: Slug
|
72
72
|
url: Target url
|
73
|
-
created_at: Created at
|
74
|
-
updated_at: Updated at
|
75
73
|
cmor/cms/page:
|
76
|
-
|
74
|
+
<<: *defaults
|
77
75
|
basename: Name
|
78
76
|
body: Body
|
79
77
|
cmor_cms_folder_id: Folder
|
@@ -89,10 +87,8 @@ en:
|
|
89
87
|
path_and_filename: Filepath
|
90
88
|
pathname: Path
|
91
89
|
title: Title
|
92
|
-
created_at: Created at
|
93
|
-
updated_at: Updated at
|
94
90
|
cmor/cms/partial:
|
95
|
-
|
91
|
+
<<: *defaults
|
96
92
|
basename: Name
|
97
93
|
body: Body
|
98
94
|
cmor_cms_folder_id: Folder
|
@@ -104,10 +100,8 @@ en:
|
|
104
100
|
locale: Language
|
105
101
|
path_and_filename: Filepath
|
106
102
|
pathname: Path
|
107
|
-
created_at: Created at
|
108
|
-
updated_at: Updated at
|
109
103
|
cmor/cms/template:
|
110
|
-
|
104
|
+
<<: *defaults
|
111
105
|
basename: Name
|
112
106
|
body: Body
|
113
107
|
cmor_cms_folder_id: Folder
|
@@ -119,8 +113,6 @@ en:
|
|
119
113
|
locale: Language
|
120
114
|
path_and_filename: Filepath
|
121
115
|
pathname: Path
|
122
|
-
created_at: Created at
|
123
|
-
updated_at: Updated at
|
124
116
|
classes:
|
125
117
|
cmor/cms/add_homepages_service: 'Add homepages service'
|
126
118
|
cmor/cms/import_partials_service: 'Import partials service'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class SetAllPublishableToPublished < ActiveRecord::Migration[5.2]
|
2
|
+
def self.up
|
3
|
+
ActiveRecord::Base.transaction do
|
4
|
+
[
|
5
|
+
Cmor::Cms::NavigationItem,
|
6
|
+
Cmor::Cms::Page,
|
7
|
+
Cmor::Cms::Partial,
|
8
|
+
Cmor::Cms::Template
|
9
|
+
].each do |klass|
|
10
|
+
klass.update_all(published_at: Time.zone.now)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def down.up
|
16
|
+
ActiveRecord::Base.transaction do
|
17
|
+
[
|
18
|
+
Cmor::Cms::NavigationItem,
|
19
|
+
Cmor::Cms::Page,
|
20
|
+
Cmor::Cms::Partial,
|
21
|
+
Cmor::Cms::Template
|
22
|
+
].each do |klass|
|
23
|
+
klass.update_all(published_at: nil)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/cmor_cms.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmor_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.42.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-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.42.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.42.pre
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: cmor_core_frontend
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.0.
|
47
|
+
version: 0.0.42.pre
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.0.
|
54
|
+
version: 0.0.42.pre
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sqlite3
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -304,6 +304,20 @@ dependencies:
|
|
304
304
|
- - ">="
|
305
305
|
- !ruby/object:Gem::Version
|
306
306
|
version: '0'
|
307
|
+
- !ruby/object:Gem::Dependency
|
308
|
+
name: acts_as_published
|
309
|
+
requirement: !ruby/object:Gem::Requirement
|
310
|
+
requirements:
|
311
|
+
- - ">="
|
312
|
+
- !ruby/object:Gem::Version
|
313
|
+
version: '0'
|
314
|
+
type: :runtime
|
315
|
+
prerelease: false
|
316
|
+
version_requirements: !ruby/object:Gem::Requirement
|
317
|
+
requirements:
|
318
|
+
- - ">="
|
319
|
+
- !ruby/object:Gem::Version
|
320
|
+
version: '0'
|
307
321
|
- !ruby/object:Gem::Dependency
|
308
322
|
name: awesome_nested_set
|
309
323
|
requirement: !ruby/object:Gem::Requirement
|
@@ -404,6 +418,7 @@ files:
|
|
404
418
|
- app/assets/stylesheets/cmor/cms/application.css
|
405
419
|
- app/assets/stylesheets/cmor/cms/application/keep.css
|
406
420
|
- app/assets/stylesheets/cmor_cms.css
|
421
|
+
- app/concerns/cmor/cms/navigation_item/properties_concern.rb
|
407
422
|
- app/controllers/cmor/cms/page_controller.rb
|
408
423
|
- app/importers/cmor/cms/importers/navigation.rb
|
409
424
|
- app/importers/cmor/cms/importers/navigation_item.rb
|
@@ -415,7 +430,6 @@ files:
|
|
415
430
|
- app/models/cmor/cms/page.rb
|
416
431
|
- app/models/cmor/cms/partial.rb
|
417
432
|
- app/models/cmor/cms/template.rb
|
418
|
-
- app/models/concerns/model/cmor/cms/navigation_item/properties_concern.rb
|
419
433
|
- app/resolvers/cmor/cms/database_resolver.rb
|
420
434
|
- app/resolvers/cmor/cms/page_resolver.rb
|
421
435
|
- app/resolvers/cmor/cms/partial_resolver.rb
|
@@ -445,6 +459,11 @@ files:
|
|
445
459
|
- db/migrate/006_create_cmor_cms_navigation_items.rb
|
446
460
|
- db/migrate/007_create_cmor_cms_content_boxes.rb
|
447
461
|
- db/migrate/008_create_cmor_cms_content_blocks.rb
|
462
|
+
- db/migrate/20200120134306_add_published_at_to_cmor_cms_pages.rb
|
463
|
+
- db/migrate/20200120134342_add_published_at_to_cmor_cms_templates.rb
|
464
|
+
- db/migrate/20200120134400_add_published_at_to_cmor_cms_partials.rb
|
465
|
+
- db/migrate/20200120134422_add_published_at_to_cmor_cms_navigation_items.rb
|
466
|
+
- db/migrate/20200120141440_set_all_publishable_to_published.rb
|
448
467
|
- lib/cmor/cms.rb
|
449
468
|
- lib/cmor/cms/action_view/template_patch.rb
|
450
469
|
- lib/cmor/cms/action_view/template_renderer_patch.rb
|