panda_cms 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/panda_cms/admin/posts_controller.rb +1 -1
- data/app/controllers/panda_cms/posts_controller.rb +4 -11
- data/app/lib/panda_cms/demo_site_generator.rb +4 -1
- data/app/models/panda_cms/post.rb +11 -5
- data/app/views/panda_cms/admin/posts/_form.html.erb +0 -1
- data/config/routes.rb +2 -1
- data/lib/panda_cms/version.rb +1 -1
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8d2e30561848d6e53c6717861b56681eff580b74b81dbe14fdd26d72dd964a1
|
4
|
+
data.tar.gz: 60c6219ab70bda2f649b6354277dcb730d500135a6d1d399f15cc3ee0c34942c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f25a5a0b0bbe6a616caff5e7d57ec4c2d3471b03c2ea031e15a9c94b8b62531e8f6115f94555bae102e6561b499c38d9bf7051bbf52fdd2f1dc30de84bbf9e5
|
7
|
+
data.tar.gz: 2fbca70b88f2c37ae46f512e6c2c1ed228f1ab8ac45b34ec2ede63f9aaf0c44fe724a543e80020301a8e3c3b07292e34b17d2c06e54e2a198450b186e8339405
|
@@ -1,18 +1,11 @@
|
|
1
1
|
module PandaCms
|
2
2
|
class PostsController < ApplicationController
|
3
|
-
def index
|
4
|
-
end
|
5
|
-
|
6
3
|
def show
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
globals = {
|
11
|
-
post: post,
|
12
|
-
title: post.title
|
13
|
-
}
|
4
|
+
@posts_index_page = PandaCms::Page.find_by(path: "/#{PandaCms.posts[:prefix]}")
|
5
|
+
@post = PandaCms::Post.find_by(slug: "/#{params[:slug]}")
|
6
|
+
@title = @post.title
|
14
7
|
|
15
|
-
render inline: "",
|
8
|
+
render inline: "", status: :ok, layout: "layouts/post"
|
16
9
|
end
|
17
10
|
end
|
18
11
|
end
|
@@ -38,6 +38,9 @@ module PandaCms
|
|
38
38
|
@pages[:about] = PandaCms::Page.find_or_create_by!({path: "/about", title: "About", template: @templates[:page], parent: @pages[:home]})
|
39
39
|
@pages[:terms] = PandaCms::Page.find_or_create_by!({path: "/terms-and-conditions", title: "Terms & Conditions", template: @templates[:page], parent: @pages[:home]})
|
40
40
|
|
41
|
+
PandaCms::Page.reset_column_information
|
42
|
+
PandaCms::Page.rebuild!
|
43
|
+
|
41
44
|
@pages
|
42
45
|
end
|
43
46
|
|
@@ -52,7 +55,7 @@ module PandaCms
|
|
52
55
|
|
53
56
|
# Automatically create main menu from homepage
|
54
57
|
unless @pages[:home].nil?
|
55
|
-
@menus[:main].update(kind: :auto, start_page: @pages[:home])
|
58
|
+
@menus[:main].update(kind: :auto, start_page: @pages[:home], depth: 1)
|
56
59
|
@menus[:main].generate_auto_menu_items
|
57
60
|
end
|
58
61
|
|
@@ -11,7 +11,13 @@ module PandaCms
|
|
11
11
|
belongs_to :user, class_name: "PandaCms::User"
|
12
12
|
|
13
13
|
validates :title, presence: true
|
14
|
-
validates :slug,
|
14
|
+
validates :slug,
|
15
|
+
presence: true,
|
16
|
+
uniqueness: true,
|
17
|
+
format: {
|
18
|
+
with: /\A\/[a-z0-9-]+\z/,
|
19
|
+
message: "must start with a forward slash and contain only lowercase letters, numbers, and hyphens"
|
20
|
+
}
|
15
21
|
|
16
22
|
scope :ordered, -> { order(published_at: :desc) }
|
17
23
|
scope :with_user, -> { includes(:user) }
|
@@ -28,7 +34,7 @@ module PandaCms
|
|
28
34
|
}
|
29
35
|
|
30
36
|
def to_param
|
31
|
-
|
37
|
+
formatted_slug.to_s
|
32
38
|
end
|
33
39
|
|
34
40
|
def excerpt(length = 100, squish: true)
|
@@ -42,10 +48,10 @@ module PandaCms
|
|
42
48
|
end
|
43
49
|
|
44
50
|
def formatted_slug
|
45
|
-
if
|
46
|
-
|
51
|
+
if slug[0] == "/"
|
52
|
+
slug[1, slug.length].to_s
|
47
53
|
else
|
48
|
-
|
54
|
+
slug
|
49
55
|
end
|
50
56
|
end
|
51
57
|
end
|
@@ -10,7 +10,6 @@
|
|
10
10
|
<%= f.button %>
|
11
11
|
</div>
|
12
12
|
<% end %>
|
13
|
-
|
14
13
|
<% content_for :head do %>
|
15
14
|
<link rel="stylesheet" type="text/css" href="https://unpkg.com/trix@2.0.8/dist/trix.css">
|
16
15
|
<script type="text/javascript" src="https://unpkg.com/trix@2.0.8/dist/trix.umd.min.js"></script>
|
data/config/routes.rb
CHANGED
@@ -37,7 +37,8 @@ PandaCms::Engine.routes.draw do
|
|
37
37
|
|
38
38
|
if PandaCms.posts
|
39
39
|
# TODO: Allow multiple types of post in future
|
40
|
-
|
40
|
+
# TODO: This now requires a page to be created, make it explicit (with a rendering posts helper?)
|
41
|
+
# get PandaCms.posts[:prefix], to: "posts#index", as: :posts
|
41
42
|
get "#{PandaCms.posts[:prefix]}/:slug", to: "posts#show", as: :post
|
42
43
|
end
|
43
44
|
|
data/lib/panda_cms/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: panda_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Panda Software Limited
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activestorage-office-previewer
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: amazing_print
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: awesome_nested_set
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -388,20 +402,6 @@ dependencies:
|
|
388
402
|
- - "~>"
|
389
403
|
- !ruby/object:Gem::Version
|
390
404
|
version: '2.0'
|
391
|
-
- !ruby/object:Gem::Dependency
|
392
|
-
name: amazing_print
|
393
|
-
requirement: !ruby/object:Gem::Requirement
|
394
|
-
requirements:
|
395
|
-
- - "~>"
|
396
|
-
- !ruby/object:Gem::Version
|
397
|
-
version: '1.6'
|
398
|
-
type: :development
|
399
|
-
prerelease: false
|
400
|
-
version_requirements: !ruby/object:Gem::Requirement
|
401
|
-
requirements:
|
402
|
-
- - "~>"
|
403
|
-
- !ruby/object:Gem::Version
|
404
|
-
version: '1.6'
|
405
405
|
- !ruby/object:Gem::Dependency
|
406
406
|
name: annotate
|
407
407
|
requirement: !ruby/object:Gem::Requirement
|