occams 1.0.5 → 1.0.6.1
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/CHANGELOG.md +9 -0
- data/Gemfile +0 -1
- data/README.md +16 -10
- data/TODOS.md +2 -1
- data/lib/occams/content/tags/children.rb +51 -0
- data/lib/occams/content/tags/siblings.rb +23 -22
- data/lib/occams/content.rb +1 -0
- data/lib/occams/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eed8972c3dacc31a1970b37be6efbc3f2d19d30d197f8342f13adcb171fa11e4
|
|
4
|
+
data.tar.gz: 4735ee50552cb9fd07f9b4dea67e05a53152779b057a1d5b4335a2ffe0bf3769
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2434cbce961464f9d317625ff2d36605a3f0dda92d68516f2d5506683b02c97f936632b9868217529a477739124d4957a9d0d2cfc07f8331bb021083a681fe51
|
|
7
|
+
data.tar.gz: 6a1bc1e3e9ea9d7dab30de818904d7d5cf540afed08d23573c62029b61274050deb3de6c1c4dfd117eaccf28f4ef3873047e3e0d7761e4680b065de7ce984401
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.0.6.1 - 9/5/2023
|
|
4
|
+
|
|
5
|
+
- Fixed siblings and children nav tags which as written had problems creating child pages in the admin panel
|
|
6
|
+
|
|
7
|
+
## v1.0.6 - 9/5/2023
|
|
8
|
+
|
|
9
|
+
- Fixed [cms:siblings Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#siblings) to handle edge case when page(s) are excluded by the `exclude` parameter
|
|
10
|
+
- Added [cms:children Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#children) to render unordered list of links for children of current page
|
|
11
|
+
|
|
3
12
|
## v1.0.5 - 8/31/2023
|
|
4
13
|
|
|
5
14
|
- All tests now green on Rails 6.1 and 7.0, each tested with rubies 2.7.8, 3.1.4 and 3.2.2.
|
data/Gemfile
CHANGED
|
@@ -10,7 +10,6 @@ group :development, :test do
|
|
|
10
10
|
gem 'capybara', '~> 3.39.0'
|
|
11
11
|
gem 'image_processing', '>= 1.2'
|
|
12
12
|
gem 'kaminari', '~> 1.2', '>= 1.2.2'
|
|
13
|
-
gem 'puma', '~> 3.12.2'
|
|
14
13
|
gem 'rubocop', '~> 0.55.0', require: false
|
|
15
14
|
gem 'selenium-webdriver', '~> 4.9.0'
|
|
16
15
|
gem 'sqlite3', '~> 1.4.2'
|
data/README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
# ocCaM'S
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](http://rubygems.org/gems/occams)
|
|
4
|
+
[](http://rubygems.org/gems/occams)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
***Prefer Simplicity.***
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
<a href="https://en.wikipedia.org/wiki/William_of_Ockham" target="_blank">
|
|
9
|
+
<img align="left" height="150" src="https://upload.wikimedia.org/wikipedia/commons/7/70/William_of_Ockham.png" alt="William of Ockham" title="William of Ockham">
|
|
10
|
+
</a>
|
|
8
11
|
|
|
9
12
|
```
|
|
10
13
|
____ __ __ _ ____
|
|
@@ -13,19 +16,22 @@ ocCaM'S is a revival of [ComfortableMexicanSofa](https://github.com/comfy/comfor
|
|
|
13
16
|
| (_) | (__| |__| (_| | | | | ___) |
|
|
14
17
|
\___/ \___|\____\__,_|_| |_| |____/
|
|
15
18
|
|
|
16
|
-
```
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Raison d'etre
|
|
22
|
+
|
|
23
|
+
ocCaM'S is a revival of [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa), with all due thanks and acknowledgements to [Oleg Khabarov](https://github.com/GBH), et al. 'Comfy' was the simplest and cleanest Rails-based CMS that I had used. Its last commit was in 2020, and I simply did not want to see it die on the vine as [RadiantCMS](https://github.com/radiant/radiant) did some years ago.
|
|
17
24
|
|
|
18
25
|
## The name
|
|
19
26
|
|
|
20
|
-
ocCaM'S, pronounced "AH-kums" is a nod to [Occam's Razor](https://en.wikipedia.org/wiki/Occam%27s_razor) - for this Rails-based Content Management System endeavors to follow the principle that
|
|
27
|
+
ocCaM'S, pronounced "AH-kums" is a nod to [Occam's Razor](https://en.wikipedia.org/wiki/Occam%27s_razor) - for this Rails-based Content Management System endeavors to follow the principle that unnecessarily complex models should not be preferred to simpler ones.
|
|
21
28
|
|
|
22
|
-
## Features
|
|
23
29
|
|
|
24
|
-
* Simple drop-in integration with Rails 6.1+ apps with minimal configuration
|
|
25
|
-
* CMS stays away from the rest of your application
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
## Features
|
|
28
32
|
|
|
33
|
+
* Simple drop-in integration with Rails 6.1+ apps with minimal configuration
|
|
34
|
+
* The CMS keeps clear from the rest of your application
|
|
29
35
|
* Powerful page templating capability using [Content Tags](https://github.com/avonderluft/occams/wiki/Content-Tags)
|
|
30
36
|
* [Multiple Sites](https://github.com/avonderluft/occams/wiki/Sites) from a single installation
|
|
31
37
|
* Multi-Language Support (i18n) (ca, cs, da, de, en, es, fi, fr, gr, hr, it, ja, nb, nl, pl, pt-BR, ru, sv, tr, uk, zh-CN, zh-TW) and page localization.
|
|
@@ -36,7 +42,7 @@ Referring to the [ComfortableMexicanSofa](https://github.com/comfy/comfortable-m
|
|
|
36
42
|
## Dependencies
|
|
37
43
|
|
|
38
44
|
* File attachments are handled by [ActiveStorage](https://github.com/rails/rails/tree/master/activestorage). Make sure that you can run appropriate migrations by running: `rails active_storage:install` and then `rake db:migrate`
|
|
39
|
-
* Image resizing is done
|
|
45
|
+
* Image resizing is done with[ImageMagick](http://www.imagemagick.org/script/download.php), so make sure it's installed
|
|
40
46
|
* Pagination is handled by [kaminari](https://github.com/amatsuda/kaminari) or [will_paginate](https://github.com/mislav/will_paginate). Please add one of those to your Gemfile.
|
|
41
47
|
|
|
42
48
|
## Compatibility
|
data/TODOS.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# ToDos
|
|
2
2
|
|
|
3
|
-
- set up CI
|
|
3
|
+
- set up Buildkite CI and add build badge to README
|
|
4
|
+
- add duplicate page function in admin UI
|
|
4
5
|
- add admin content search to list layouts, pages and snippets - see https://blog.robertsj.com/search/
|
|
5
6
|
- add application console for testing
|
|
6
7
|
- add feature to resize file_link'd images
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Nav Tag for unordered list of links to the children of the current page
|
|
4
|
+
# {{ cms:children }}
|
|
5
|
+
# {{ cms:children style: "font-weight: bold", exclude: "404-page, search-page" }}
|
|
6
|
+
# To customize your children style, add a 'children' id to your CSS, e.g
|
|
7
|
+
# #children {
|
|
8
|
+
# color: #006633;
|
|
9
|
+
# font-size: 90%;
|
|
10
|
+
# margin-bottom: 4px;
|
|
11
|
+
# font-style: italic;
|
|
12
|
+
# }
|
|
13
|
+
# and/or pass in style overrides with the 'style' parameter, as above
|
|
14
|
+
#
|
|
15
|
+
# To exclude children, list their slugs with the 'exclude' parameter
|
|
16
|
+
# as comma-delimited string, e.g. as above - exclude: "404-page, search-page"
|
|
17
|
+
|
|
18
|
+
class Occams::Content::Tag::Children < Occams::Content::Tag
|
|
19
|
+
attr_reader :style, :page_children, :locals
|
|
20
|
+
attr_accessor :list
|
|
21
|
+
|
|
22
|
+
def initialize(context:, params: [], source: nil)
|
|
23
|
+
super
|
|
24
|
+
@locals = params.extract_options!
|
|
25
|
+
@style = ''
|
|
26
|
+
@style = "<style>#children {#{@locals['style']}}</style>" if @locals['style']
|
|
27
|
+
@exclude = []
|
|
28
|
+
@exclude = @locals['exclude'].split(',') if @locals['exclude']
|
|
29
|
+
@list = ''
|
|
30
|
+
# ActiveRecord_Associations_CollectionProxy
|
|
31
|
+
@page_children = context.children.order(:position).to_ary
|
|
32
|
+
@page_children.delete_if { |child| @exclude.include? child.slug }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def content
|
|
36
|
+
if @page_children.any?
|
|
37
|
+
@list = '<ul id="children">'
|
|
38
|
+
@page_children.each do |c|
|
|
39
|
+
next if Rails.env == 'production' && !c.is_published
|
|
40
|
+
|
|
41
|
+
@list += "<li><a href=#{c.url(relative: true)}>#{c.label}</a></li>"
|
|
42
|
+
end
|
|
43
|
+
@list += '</ul>'
|
|
44
|
+
end
|
|
45
|
+
format("#{@style}#{@list}")
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
Occams::Content::Renderer.register_tag(
|
|
50
|
+
:children, Occams::Content::Tag::Children
|
|
51
|
+
)
|
|
@@ -6,10 +6,8 @@
|
|
|
6
6
|
# To customize your siblings style, add a 'siblings' id to your CSS, e.g
|
|
7
7
|
# #siblings {
|
|
8
8
|
# color: #006633;
|
|
9
|
-
# font-family: Verdana, Arial, Helvetica, sans-serif;
|
|
10
9
|
# font-size: 95%;
|
|
11
10
|
# margin-top: 12px;
|
|
12
|
-
# margin-bottom: 4px;
|
|
13
11
|
# font-style: italic;
|
|
14
12
|
# }
|
|
15
13
|
# and/or pass in style overrides with the 'style' parameter (see above)
|
|
@@ -20,7 +18,8 @@
|
|
|
20
18
|
# style and exclude parameters are optional
|
|
21
19
|
|
|
22
20
|
class Occams::Content::Tag::Siblings < Occams::Content::Tag
|
|
23
|
-
attr_reader :locals, :style, :
|
|
21
|
+
attr_reader :locals, :style, :sibs
|
|
22
|
+
attr_accessor :links
|
|
24
23
|
|
|
25
24
|
def initialize(context:, params: [], source: nil)
|
|
26
25
|
super
|
|
@@ -29,29 +28,31 @@ class Occams::Content::Tag::Siblings < Occams::Content::Tag
|
|
|
29
28
|
@style = "<style>#siblings {#{@locals['style']}}</style>" if @locals['style']
|
|
30
29
|
@exclude = []
|
|
31
30
|
@exclude = @locals['exclude'].split(',') if @locals['exclude']
|
|
32
|
-
@links = '
|
|
31
|
+
@links = ''
|
|
32
|
+
# ActiveRecord_Associations_CollectionProxy
|
|
33
|
+
@sibs = context.self_and_siblings.order(:position).to_ary
|
|
34
|
+
@sibs.delete_if { |sib| @exclude.include? sib.slug }
|
|
35
|
+
end
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
sibs
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
def content
|
|
38
|
+
if @sibs.count > 1
|
|
39
|
+
@links = '<div id="siblings">'
|
|
40
|
+
prevp = false
|
|
41
|
+
@sibs.each do |sib|
|
|
42
|
+
sib_idx = @sibs.index(sib)
|
|
43
|
+
next if sib.slug == context.slug
|
|
44
|
+
next if Rails.env == 'production' && !sib.is_published
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
if sib_idx == @sibs.index(context) - 1
|
|
47
|
+
@links += "<a href=#{sib.url(relative: true)}>#{sib.label}</a> « <em>Previous</em> • "
|
|
48
|
+
prevp = true
|
|
49
|
+
elsif sib_idx == @sibs.index(context) + 1
|
|
50
|
+
@links += '•' unless prevp
|
|
51
|
+
@links += "<em>Next</em> » <a href=#{sib.url(relative: true)}>#{sib.label}</a>"
|
|
52
|
+
end
|
|
49
53
|
end
|
|
54
|
+
@links += '</div>'
|
|
50
55
|
end
|
|
51
|
-
@links += '</div>'
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def content
|
|
55
56
|
format("#{@style}#{@links}")
|
|
56
57
|
end
|
|
57
58
|
end
|
data/lib/occams/content.rb
CHANGED
data/lib/occams/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: occams
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew vonderLuft
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-09-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: active_link_to
|
|
@@ -685,6 +685,7 @@ files:
|
|
|
685
685
|
- lib/occams/content/tags/audio.rb
|
|
686
686
|
- lib/occams/content/tags/breadcrumbs.rb
|
|
687
687
|
- lib/occams/content/tags/checkbox.rb
|
|
688
|
+
- lib/occams/content/tags/children.rb
|
|
688
689
|
- lib/occams/content/tags/date.rb
|
|
689
690
|
- lib/occams/content/tags/datetime.rb
|
|
690
691
|
- lib/occams/content/tags/file.rb
|