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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d020dd30a0e74d5c86211e061b5018c726f9a07e364c96f9c9cc65ebf4762d3
4
- data.tar.gz: cf50ea17c8fcc9a5bdc6baa008dbfb7503b0d6acbdfa05389f706d6ce934adce
3
+ metadata.gz: eed8972c3dacc31a1970b37be6efbc3f2d19d30d197f8342f13adcb171fa11e4
4
+ data.tar.gz: 4735ee50552cb9fd07f9b4dea67e05a53152779b057a1d5b4335a2ffe0bf3769
5
5
  SHA512:
6
- metadata.gz: bf49d617a083d592d67dd6b5f72c2f3fb15618c64b5a954dd7fdefc71a578b1800279610bce9322867ef5ca5beef1cf4fa3356e766d1b4520810efb79f89ffbd
7
- data.tar.gz: 37c7949c2bac89e22933d44177a6a713559fe14db0488062f9564cacd240a8b608e56275a4228d457411abce7478c595488d5b399cbd0566f4daafcb2a261942
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 the preferred solution is that which is simplest and built with the smallest possible set of components.
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
- Referring to the [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa) documentation, substituting 'Occams' for 'ComfortableMexicanSofa' where appropriate.
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 :list, :style, :locals
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, :links
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 = '<div id="siblings">'
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
- prevp = false
33
- sibs = context.self_and_siblings.sort_by(&:position)
34
- sibs.delete_if { |sib| @exclude.include? sib.slug }
35
- page_idx = sibs.index(context)
36
- sibs.each do |sib|
37
- sib_idx = sibs.index(sib)
38
- next if sibs.index(sib) == page_idx
39
- next if Rails.env == 'production' && !sib.is_published
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
- if sib_idx == page_idx - 1
42
- @links += "<a href=#{sib.url(relative: true)}>#{sib.label}</a> &laquo;&nbsp;<em>Previous</em> &bull; "
43
- prevp = true
44
- elsif sib_idx == page_idx + 1
45
- @links += '&bull;' unless prevp
46
- @links += "<em>Next</em>&nbsp;&raquo; <a href=#{sib.url(relative: true)}>#{sib.label}</a>"
46
+ if sib_idx == @sibs.index(context) - 1
47
+ @links += "<a href=#{sib.url(relative: true)}>#{sib.label}</a> &laquo;&nbsp;<em>Previous</em> &bull; "
48
+ prevp = true
49
+ elsif sib_idx == @sibs.index(context) + 1
50
+ @links += '&bull;' unless prevp
51
+ @links += "<em>Next</em>&nbsp;&raquo; <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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Occams
4
- VERSION = '1.0.6'
4
+ VERSION = '1.0.6.1'
5
5
  end
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-06 00:00:00.000000000 Z
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