occams 1.0.6 → 1.0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +11 -9
- data/lib/occams/content/tags/children.rb +13 -12
- data/lib/occams/content/tags/siblings.rb +23 -20
- data/lib/occams/version.rb +1 -1
- metadata +2 -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,9 @@
|
|
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
|
+
|
3
7
|
## v1.0.6 - 9/5/2023
|
4
8
|
|
5
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
|
data/README.md
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
[![Gem Version](https://img.shields.io/gem/v/occams.svg?style=flat)](http://rubygems.org/gems/occams)
|
4
4
|
[![Gem Downloads](https://img.shields.io/gem/dt/occams.svg?style=flat)](http://rubygems.org/gems/occams)
|
5
5
|
|
6
|
+
***Prefer Simplicity.***
|
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>
|
11
|
+
|
6
12
|
```
|
7
13
|
____ __ __ _ ____
|
8
14
|
___ ___ / ___|__ _| \/ ( ) ___|
|
@@ -10,26 +16,22 @@
|
|
10
16
|
| (_) | (__| |__| (_| | | | | ___) |
|
11
17
|
\___/ \___|\____\__,_|_| |_| |____/
|
12
18
|
|
13
|
-
```
|
14
|
-
|
15
|
-
Prefer Simplicity.
|
19
|
+
```
|
16
20
|
|
17
21
|
## Raison d'etre
|
18
22
|
|
19
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.
|
20
24
|
|
21
|
-
|
22
25
|
## The name
|
23
26
|
|
24
|
-
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.
|
25
28
|
|
26
|
-
## Features
|
27
29
|
|
28
|
-
* Simple drop-in integration with Rails 6.1+ apps with minimal configuration
|
29
|
-
* CMS stays away from the rest of your application
|
30
30
|
|
31
|
-
|
31
|
+
## Features
|
32
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
|
33
35
|
* Powerful page templating capability using [Content Tags](https://github.com/avonderluft/occams/wiki/Content-Tags)
|
34
36
|
* [Multiple Sites](https://github.com/avonderluft/occams/wiki/Sites) from a single installation
|
35
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.
|
@@ -16,7 +16,8 @@
|
|
16
16
|
# as comma-delimited string, e.g. as above - exclude: "404-page, search-page"
|
17
17
|
|
18
18
|
class Occams::Content::Tag::Children < Occams::Content::Tag
|
19
|
-
attr_reader :
|
19
|
+
attr_reader :style, :page_children, :locals
|
20
|
+
attr_accessor :list
|
20
21
|
|
21
22
|
def initialize(context:, params: [], source: nil)
|
22
23
|
super
|
@@ -27,20 +28,20 @@ class Occams::Content::Tag::Children < Occams::Content::Tag
|
|
27
28
|
@exclude = @locals['exclude'].split(',') if @locals['exclude']
|
28
29
|
@list = ''
|
29
30
|
# ActiveRecord_Associations_CollectionProxy
|
30
|
-
page_children = context.children.order(:position).to_ary
|
31
|
-
page_children.delete_if { |child| @exclude.include? child.slug }
|
32
|
-
return unless page_children.any?
|
33
|
-
|
34
|
-
@list = '<ul id="children">'
|
35
|
-
page_children.each do |c|
|
36
|
-
next if Rails.env == 'production' && !c.is_published
|
37
|
-
|
38
|
-
@list += "<li><a href=#{c.url(relative: true)}>#{c.label}</a></li>"
|
39
|
-
end
|
40
|
-
@list += '</ul>'
|
31
|
+
@page_children = context.children.order(:position).to_ary
|
32
|
+
@page_children.delete_if { |child| @exclude.include? child.slug }
|
41
33
|
end
|
42
34
|
|
43
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
|
44
45
|
format("#{@style}#{@list}")
|
45
46
|
end
|
46
47
|
end
|
@@ -18,7 +18,8 @@
|
|
18
18
|
# style and exclude parameters are optional
|
19
19
|
|
20
20
|
class Occams::Content::Tag::Siblings < Occams::Content::Tag
|
21
|
-
attr_reader :locals, :style, :
|
21
|
+
attr_reader :locals, :style, :sibs
|
22
|
+
attr_accessor :links
|
22
23
|
|
23
24
|
def initialize(context:, params: [], source: nil)
|
24
25
|
super
|
@@ -27,29 +28,31 @@ class Occams::Content::Tag::Siblings < Occams::Content::Tag
|
|
27
28
|
@style = "<style>#siblings {#{@locals['style']}}</style>" if @locals['style']
|
28
29
|
@exclude = []
|
29
30
|
@exclude = @locals['exclude'].split(',') if @locals['exclude']
|
30
|
-
@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
|
31
36
|
|
32
|
-
|
33
|
-
sibs
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
40
45
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
47
53
|
end
|
54
|
+
@links += '</div>'
|
48
55
|
end
|
49
|
-
@links += '</div>'
|
50
|
-
end
|
51
|
-
|
52
|
-
def content
|
53
56
|
format("#{@style}#{@links}")
|
54
57
|
end
|
55
58
|
end
|
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.6
|
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-09-
|
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
|