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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67520e0545e8293085e270f99fc18d9f7ce1482e6337957d33f733ab6dc9f11b
4
- data.tar.gz: 82abd4eaced8e99a658e2d2b14e4850ed3ce3794914f4472cf9321c491bd59a5
3
+ metadata.gz: 92c7199544f0b76e3a48592371627184a1f07384a1b7cf8a2c57a51b4113801d
4
+ data.tar.gz: 2dae5c1513863c62b6d7a5cd1694b17825617c43a654dcf033617a482f82cf08
5
5
  SHA512:
6
- metadata.gz: 9d3791ffa0a8693f02379c3b07eaf3b28e2ff2fe54036c465c0e2d91119c420c1284fa38f6adc4e9157e9f9a290698ca965631af224593637382171c2463088f
7
- data.tar.gz: 198de425f2f1b930a8b1393470f5ac013c8d230c043fda4cfc31f8c0679a414ae542dd6130110d67a00459839b08e327bb3365cda3791a0c8915550024b6d2b5
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
- to_markdown(read_attribute(:body))
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 to_markdown(string)
46
- Kramdown::Document.new(string).to_html
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-12
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
- = "#{l(post.created_at)} | #{Cmor::Blog::Configuration.creator_label_for_post_proc.call(post)}"
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
- %h1.post-title
3
- = link_to(post.title, cmor_blog.url_for(post))
4
- %small
5
- %span.post-creation-information.text-muted
6
- = "#{l(post.created_at)} | #{Cmor::Blog::Configuration.creator_label_for_post_proc.call(post)}"
7
- - if Cmor::Core.features?(:cmor_comments)
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
- %p.post-body= post.body(format: :html).html_safe
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
- = collection_table(collection: post.asset_details.non_images.order(position: :asc)) do |t|
33
- = t.column :filename
34
- = t.column :actions do |resource|
35
- - link_to(main_app.url_for(resource.asset), class: 'btn btn-primary') do
36
- - t('.download')
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
- = "#{l(post.created_at)} | #{Cmor::Blog::Configuration.creator_label_for_post_proc.call(post)}"
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
- = "#{l(post.created_at)} | #{Cmor::Blog::Configuration.creator_label_for_post_proc.call(post)}"
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
@@ -1,4 +1,9 @@
1
- = render @resource
1
+ .mb-4
2
+ = render @resource
3
+
4
+ .page-actions.row
5
+ .col-12
6
+ = link_to(t('.back'), last_location, class: 'btn btn-primary')
2
7
 
3
8
  - if Cmor::Core.features?(:cmor_comments)
4
9
  = commentable(@resource)
@@ -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
@@ -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(:creator_label_for_post_proc) do
36
- -> (post) { post.creator&.to_s }
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.creator_label_for_post_proc = -> (post) { "Site Owner" }
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.creator_label_for_post_proc = -> (post) { post.creator&.to_s || "Site owner" }
57
+ # config.post_creation_information_proc = -> (post) { post.creator&.to_s || "Site owner" }
58
58
  #
59
- # default: config.creator_label_for_post_proc = -> (post) { post.creator&.to_s }
59
+ # You can remove the date:
60
60
  #
61
- config.creator_label_for_post_proc = -> (post) { post.creator&.to_s }
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.53.pre
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-03-26 00:00:00.000000000 Z
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.53.pre
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.53.pre
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.53.pre
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.53.pre
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.2
502
+ rubygems_version: 3.1.4
503
503
  signing_key:
504
504
  specification_version: 4
505
505
  summary: Cmor::Blog.