cmor_blog 0.0.53.pre → 0.0.58.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/cmor/blog/asset_detail.rb +4 -0
- data/app/models/cmor/blog/post.rb +3 -3
- data/app/views/cmor/blog/application_view_helper/_render_post.html.haml +5 -2
- data/app/views/cmor/blog/posts/_post.html.haml +27 -20
- data/app/views/cmor/blog/posts/_post_in_index.html.haml +2 -1
- data/app/views/cmor/blog/posts/_post_in_index_with_preview_picture.haml +2 -1
- data/app/views/cmor/blog/posts/show.html.haml +6 -1
- data/config/locales/de.yml +6 -0
- data/config/locales/en.yml +6 -0
- data/lib/cmor/blog/configuration.rb +6 -2
- data/lib/generators/cmor/blog/install/templates/initializer.rb +24 -5
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92c7199544f0b76e3a48592371627184a1f07384a1b7cf8a2c57a51b4113801d
|
4
|
+
data.tar.gz: 2dae5c1513863c62b6d7a5cd1694b17825617c43a654dcf033617a482f82cf08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ebcdc68bed95dfeb11abdd837cacaf0fc22b311e8164f8bc183e3b46bf5a8c7c3104a12f457a895081f971914fbc1df58dd0122012198fe7d110ff3c7418c64
|
7
|
+
data.tar.gz: 6febcd753fc20547c6cdd8525d0a6b482a4a57339a3eeaa113afed91267f0694f520fb506aa002244f308fb3cf17ab2d63c365265e0f429d5af4a9aad6f53b36
|
@@ -5,6 +5,10 @@ module Cmor::Blog
|
|
5
5
|
|
6
6
|
acts_as_list scope: :post_id
|
7
7
|
|
8
|
+
# acts as published
|
9
|
+
include ActsAsPublished::ActiveRecord
|
10
|
+
acts_as_published
|
11
|
+
|
8
12
|
scope :images, -> { joins(asset: [:blob]).where("active_storage_blobs.content_type LIKE '%image/%'") }
|
9
13
|
scope :non_images, -> { joins(asset: [:blob]).where("active_storage_blobs.content_type NOT LIKE '%image/%'") }
|
10
14
|
|
@@ -34,7 +34,7 @@ module Cmor
|
|
34
34
|
def body(format: nil)
|
35
35
|
case format
|
36
36
|
when :html
|
37
|
-
|
37
|
+
markdown_to_html(read_attribute(:body))
|
38
38
|
else
|
39
39
|
read_attribute(:body)
|
40
40
|
end
|
@@ -42,8 +42,8 @@ module Cmor
|
|
42
42
|
|
43
43
|
private
|
44
44
|
|
45
|
-
def
|
46
|
-
|
45
|
+
def markdown_to_html(string)
|
46
|
+
instance_exec(string, &Cmor::Blog::Configuration.markdown_to_html_proc)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -1,10 +1,13 @@
|
|
1
1
|
%div{ id: dom_id(post), class: "row #{dom_class(post)} bottom-margin-5 mb-4" }
|
2
|
-
.col-lg-
|
2
|
+
.col-lg-4
|
3
|
+
.post-preview-picture
|
4
|
+
= image_tag(main_app.url_for(post.preview_picture.asset.variant(Cmor::Blog::Configuration.preview_picture_asset_variant_options)), class: 'img-fluid')
|
5
|
+
.col-lg-8
|
3
6
|
%h2.post-title
|
4
7
|
= link_to(post.title, cmor_blog.url_for(post))
|
5
8
|
%small
|
6
9
|
%span.post-creation-information.text-muted
|
7
|
-
=
|
10
|
+
= instance_exec(post, &Cmor::Blog::Configuration.post_creation_information_proc)
|
8
11
|
- if Cmor::Core.features?(:cmor_comments)
|
9
12
|
|
|
10
13
|
%span.comments-information
|
@@ -1,19 +1,24 @@
|
|
1
1
|
%div{ id: dom_id(post), class: dom_class(post) }
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
%span.comments-information
|
10
|
-
= link_to(t('cmor.comments.commentable.comments_information', comments_count: post.comments.count), cmor_blog.post_url(post, anchor: 'comments'))
|
11
|
-
- if Cmor::Core.features?(:cmor_tags)
|
12
|
-
|
|
13
|
-
%span.post-tags
|
14
|
-
= tags_helper(self).render_tags_for(post)
|
2
|
+
.row
|
3
|
+
.col-12
|
4
|
+
%h1.post-title
|
5
|
+
= post.title
|
6
|
+
%small
|
7
|
+
%span.post-creation-information.text-muted
|
8
|
+
= instance_exec(post, &Cmor::Blog::Configuration.post_creation_information_proc)
|
15
9
|
|
16
|
-
|
10
|
+
- if Cmor::Core.features?(:cmor_comments)
|
11
|
+
|
|
12
|
+
%span.comments-information
|
13
|
+
= link_to(t('cmor.comments.commentable.comments_information', comments_count: post.comments.count), cmor_blog.post_url(post, anchor: 'comments'))
|
14
|
+
- if Cmor::Core.features?(:cmor_tags)
|
15
|
+
|
|
16
|
+
%span.post-tags
|
17
|
+
= tags_helper(self).render_tags_for(post)
|
18
|
+
|
19
|
+
.row
|
20
|
+
.col-12
|
21
|
+
%p.post-body= post.body(format: :html).html_safe
|
17
22
|
|
18
23
|
- if post.asset_details.images.any?
|
19
24
|
.row
|
@@ -21,7 +26,7 @@
|
|
21
26
|
.col-lg-4.d-flex.align-items-stretch
|
22
27
|
.card.text-center.border-0
|
23
28
|
%a{ href: main_app.url_for(picture_detail.asset), data: { gallery: dom_id(post) } }
|
24
|
-
%img{ src: main_app.url_for(picture_detail.asset.variant(Cmor::Blog::Configuration.preview_picture_asset_variant_options)) }
|
29
|
+
%img.ing-fluid.w-100{ src: main_app.url_for(picture_detail.asset.variant(Cmor::Blog::Configuration.preview_picture_asset_variant_options)) }
|
25
30
|
.card-body
|
26
31
|
%h5.card-title
|
27
32
|
= picture_detail.title
|
@@ -29,8 +34,10 @@
|
|
29
34
|
= picture_detail.description
|
30
35
|
|
31
36
|
- if post.asset_details.non_images.any?
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
+
.row
|
38
|
+
.col-12
|
39
|
+
= collection_table(collection: post.asset_details.non_images.order(position: :asc)) do |t|
|
40
|
+
= t.column :filename
|
41
|
+
= t.column :actions do |resource|
|
42
|
+
- link_to(main_app.url_for(resource.asset), class: 'btn btn-primary') do
|
43
|
+
- t('.download')
|
@@ -4,7 +4,8 @@
|
|
4
4
|
= link_to(post.title, cmor_blog.url_for(post))
|
5
5
|
%small
|
6
6
|
%span.post-creation-information.text-muted
|
7
|
-
=
|
7
|
+
= instance_exec(post, &Cmor::Blog::Configuration.post_creation_information_proc)
|
8
|
+
|
8
9
|
- if Cmor::Core.features?(:cmor_comments)
|
9
10
|
|
|
10
11
|
%span.comments-information
|
@@ -7,7 +7,8 @@
|
|
7
7
|
= link_to(post.title, cmor_blog.url_for(post))
|
8
8
|
%small
|
9
9
|
%span.post-creation-information.text-muted
|
10
|
-
=
|
10
|
+
= instance_exec(post, &Cmor::Blog::Configuration.post_creation_information_proc)
|
11
|
+
|
11
12
|
- if Cmor::Core.features?(:cmor_comments)
|
12
13
|
|
|
13
14
|
%span.comments-information
|
data/config/locales/de.yml
CHANGED
@@ -12,12 +12,14 @@ de:
|
|
12
12
|
attributes:
|
13
13
|
cmor/blog/post:
|
14
14
|
id: ID
|
15
|
+
append_assets: Dateien hinzufügen
|
15
16
|
asset_details_count: Anhänge
|
16
17
|
assets: Anhänge
|
17
18
|
body: Inhalt
|
18
19
|
created_by_id: Erstellt von
|
19
20
|
creator: Erstellt von
|
20
21
|
locale: Sprache
|
22
|
+
overwrite_assets: Dateien ersetzen
|
21
23
|
position: Position
|
22
24
|
published: Veröffentlicht
|
23
25
|
published_at: Veröffentlicht am
|
@@ -40,6 +42,7 @@ de:
|
|
40
42
|
title: Titel
|
41
43
|
preview_picture: Vorschau
|
42
44
|
position: Position
|
45
|
+
published: Veröffentlicht
|
43
46
|
published_at: Veröffentlicht am
|
44
47
|
created_at: Erstellt am
|
45
48
|
updated_at: Aktualisiert am
|
@@ -48,5 +51,8 @@ de:
|
|
48
51
|
application_view_helper:
|
49
52
|
render_post:
|
50
53
|
more: 'Mehr'
|
54
|
+
posts:
|
55
|
+
show:
|
56
|
+
back: 'Zurück'
|
51
57
|
routes:
|
52
58
|
cmor_blog_engine: blog
|
data/config/locales/en.yml
CHANGED
@@ -12,12 +12,14 @@ en:
|
|
12
12
|
attributes:
|
13
13
|
cmor/blog/post:
|
14
14
|
id: ID
|
15
|
+
append_assets: Append files
|
15
16
|
asset_details_count: Assets
|
16
17
|
assets: Asset
|
17
18
|
body: Body
|
18
19
|
created_by_id: Created by
|
19
20
|
creator: Created by
|
20
21
|
locale: Locale
|
22
|
+
overwrite_assets: Overwrite files
|
21
23
|
position: Position
|
22
24
|
published: Published
|
23
25
|
published_at: Published at
|
@@ -40,6 +42,7 @@ en:
|
|
40
42
|
title: Title
|
41
43
|
preview_picture: Preview
|
42
44
|
position: Position
|
45
|
+
published: Published
|
43
46
|
published_at: Published at
|
44
47
|
created_at: Created at
|
45
48
|
updated_at: Updated at
|
@@ -48,5 +51,8 @@ en:
|
|
48
51
|
application_view_helper:
|
49
52
|
render_post:
|
50
53
|
more: 'More'
|
54
|
+
posts:
|
55
|
+
post:
|
56
|
+
back: 'Back'
|
51
57
|
routes:
|
52
58
|
cmor_blog_engine: blog
|
@@ -32,8 +32,12 @@ module Cmor
|
|
32
32
|
{ combine_options: { resize: "320x240^", extent: "384x216", gravity: "center" } }
|
33
33
|
end
|
34
34
|
|
35
|
-
mattr_accessor(:
|
36
|
-
-> (post) { post.creator&.
|
35
|
+
mattr_accessor(:post_creation_information_proc) do
|
36
|
+
-> (post) { "#{l(post.created_at)} | #{post.creator&.human}" }
|
37
|
+
end
|
38
|
+
|
39
|
+
mattr_accessor(:markdown_to_html_proc) do
|
40
|
+
-> (string) { Kramdown::Document.new(string).to_html }
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
@@ -46,17 +46,36 @@ Cmor::Blog.configure do |config|
|
|
46
46
|
#
|
47
47
|
config.preview_picture_asset_variant_options = { combine_options: { resize: "320x240^", extent: "384x216", gravity: "center" } }
|
48
48
|
|
49
|
-
# Define how the author will be shown on posts.
|
49
|
+
# Define how the author and post date will be shown on posts.
|
50
50
|
#
|
51
51
|
# You can generalize the label by not taking the creator into account at all:
|
52
52
|
#
|
53
|
-
# config.
|
53
|
+
# config.post_creation_information_proc = -> (post) { "#{l(post.created_at)} | "Site Owner" }
|
54
54
|
#
|
55
55
|
# You can show a default when the creator is not set:
|
56
56
|
#
|
57
|
-
# config.
|
57
|
+
# config.post_creation_information_proc = -> (post) { post.creator&.to_s || "Site owner" }
|
58
58
|
#
|
59
|
-
#
|
59
|
+
# You can remove the date:
|
60
60
|
#
|
61
|
-
config.
|
61
|
+
# config.post_creation_information_proc = -> (post) { post.creator&.to_s }
|
62
|
+
#
|
63
|
+
# default: config.post_creation_information_proc = -> (post) { "#{l(post.created_at)} | #{post.creator&.to_s}" }
|
64
|
+
#
|
65
|
+
config.post_creation_information_proc = -> (post) { "#{l(post.created_at)} | #{post.creator&.to_s}" }
|
66
|
+
|
67
|
+
# Configure how the post body is transformed from markup to html. The default
|
68
|
+
# format is markdown. Kramdown is used for the transformation and is a
|
69
|
+
# dependency of this gem.
|
70
|
+
#
|
71
|
+
# If you want to use a different markdown language you can configure it here.
|
72
|
+
#
|
73
|
+
# For example you may want to use textile as markup. First you will need to
|
74
|
+
# add RedCloth to your Gemfile. Then you can configure it as follows:
|
75
|
+
#
|
76
|
+
# config.markdown_to_html_proc = -> (string) { RedCloth.new(string).to_html }
|
77
|
+
#
|
78
|
+
# default: config.markdown_to_html_proc = -> (string) { Kramdown::Document.new(string).to_html }
|
79
|
+
#
|
80
|
+
config.markdown_to_html_proc = -> (string) { Kramdown::Document.new(string).to_html }
|
62
81
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmor_blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.58.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-
|
11
|
+
date: 2020-07-17 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.58.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.58.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.58.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.58.pre
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sqlite3
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -499,7 +499,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
499
499
|
- !ruby/object:Gem::Version
|
500
500
|
version: 1.3.1
|
501
501
|
requirements: []
|
502
|
-
rubygems_version: 3.1.
|
502
|
+
rubygems_version: 3.1.4
|
503
503
|
signing_key:
|
504
504
|
specification_version: 4
|
505
505
|
summary: Cmor::Blog.
|