occams 1.0.5 → 1.0.6

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: efb5d94cf738164a3e046fa7cfb156622bd2bc0e9b8204b4b8351528e071d125
4
- data.tar.gz: 1a258f13ab0e8f4d2bee5389fc35b9aaae9d1e8d21b9cbf785c4c87d4bdf64e5
3
+ metadata.gz: 9d020dd30a0e74d5c86211e061b5018c726f9a07e364c96f9c9cc65ebf4762d3
4
+ data.tar.gz: cf50ea17c8fcc9a5bdc6baa008dbfb7503b0d6acbdfa05389f706d6ce934adce
5
5
  SHA512:
6
- metadata.gz: 9efc2ff6514d9232b567c2db268f2db505662f13c6de0393f4cb263f69883a73514b24bf528316eaadc08d7d077de08b1df806697dc727784291119040f70f05
7
- data.tar.gz: 5599e31e8c182f8ce24cc8c23c1be933b0c84e3044d120d1e4ff3378a24aada88b509e2ac97ea94e1d7de48d6d1b7bcebc7477be6aca804630b0377cd596cf5e
6
+ metadata.gz: bf49d617a083d592d67dd6b5f72c2f3fb15618c64b5a954dd7fdefc71a578b1800279610bce9322867ef5ca5beef1cf4fa3356e766d1b4520810efb79f89ffbd
7
+ data.tar.gz: 37c7949c2bac89e22933d44177a6a713559fe14db0488062f9564cacd240a8b608e56275a4228d457411abce7478c595488d5b399cbd0566f4daafcb2a261942
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.0.6 - 9/5/2023
4
+
5
+ - 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
6
+ - 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
7
+
3
8
  ## v1.0.5 - 8/31/2023
4
9
 
5
10
  - 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,7 @@
1
1
  # ocCaM'S
2
2
 
3
- Prefer Simplicity
4
-
5
- ## Raison d'etre
6
-
7
- 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.
3
+ [![Gem Version](https://img.shields.io/gem/v/occams.svg?style=flat)](http://rubygems.org/gems/occams)
4
+ [![Gem Downloads](https://img.shields.io/gem/dt/occams.svg?style=flat)](http://rubygems.org/gems/occams)
8
5
 
9
6
  ```
10
7
  ____ __ __ _ ____
@@ -15,6 +12,13 @@ ocCaM'S is a revival of [ComfortableMexicanSofa](https://github.com/comfy/comfor
15
12
 
16
13
  ```
17
14
 
15
+ Prefer Simplicity.
16
+
17
+ ## Raison d'etre
18
+
19
+ 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
+
21
+
18
22
  ## The name
19
23
 
20
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.
@@ -36,7 +40,7 @@ Referring to the [ComfortableMexicanSofa](https://github.com/comfy/comfortable-m
36
40
  ## Dependencies
37
41
 
38
42
  * 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 on Rails 7 or greater, with[ImageMagick](http://www.imagemagick.org/script/download.php), so make sure it's installed
43
+ * Image resizing is done with[ImageMagick](http://www.imagemagick.org/script/download.php), so make sure it's installed
40
44
  * 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
45
 
42
46
  ## 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,50 @@
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 :list, :style, :locals
20
+
21
+ def initialize(context:, params: [], source: nil)
22
+ super
23
+ @locals = params.extract_options!
24
+ @style = ''
25
+ @style = "<style>#children {#{@locals['style']}}</style>" if @locals['style']
26
+ @exclude = []
27
+ @exclude = @locals['exclude'].split(',') if @locals['exclude']
28
+ @list = ''
29
+ # 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>'
41
+ end
42
+
43
+ def content
44
+ format("#{@style}#{@list}")
45
+ end
46
+ end
47
+
48
+ Occams::Content::Renderer.register_tag(
49
+ :children, Occams::Content::Tag::Children
50
+ )
@@ -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)
@@ -33,11 +31,11 @@ class Occams::Content::Tag::Siblings < Occams::Content::Tag
33
31
 
34
32
  prevp = false
35
33
  sibs = context.self_and_siblings.sort_by(&:position)
34
+ sibs.delete_if { |sib| @exclude.include? sib.slug }
36
35
  page_idx = sibs.index(context)
37
36
  sibs.each do |sib|
38
37
  sib_idx = sibs.index(sib)
39
38
  next if sibs.index(sib) == page_idx
40
- next if @exclude.include? sib.slug
41
39
  next if Rails.env == 'production' && !sib.is_published
42
40
 
43
41
  if sib_idx == page_idx - 1
@@ -32,4 +32,5 @@ require_relative 'content/tags/template'
32
32
 
33
33
  require_relative 'content/tags/audio'
34
34
  require_relative 'content/tags/breadcrumbs'
35
+ require_relative 'content/tags/children'
35
36
  require_relative 'content/tags/siblings'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Occams
4
- VERSION = '1.0.5'
4
+ VERSION = '1.0.6'
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.5
4
+ version: 1.0.6
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-08-31 00:00:00.000000000 Z
11
+ date: 2023-09-06 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