occams 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +12 -1
- data/Gemfile +1 -1
- data/README.md +5 -5
- data/TODOS.md +3 -3
- data/app/controllers/occams/cms/content_controller.rb +5 -5
- data/app/views/layouts/occams/admin/cms/_left.html.haml +3 -1
- data/lib/generators/occams/scaffold/templates/controller.rb.tt +1 -1
- data/lib/occams/content/tags/audio.rb +40 -0
- data/lib/occams/content/tags/breadcrumbs.rb +43 -0
- data/lib/occams/content/tags/siblings.rb +61 -0
- data/lib/occams/content.rb +4 -0
- data/lib/occams/version.rb +1 -1
- data/occams.gemspec +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aca6dd86629db61b2c905c1e54bf45dc6d4153659bf46868ed4a4c8ee70f9ad0
|
4
|
+
data.tar.gz: 151a8b8aab7bcc69405e530a1100f18796515fc1e00fec3131c4cf68736f6778
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67407dbc43513ff16a74bef095001a7c4f6bf544a0ab07bbf1c51388478ebd3e6d078bc82714ecd1f9899079d6832ab326a779ec2addad117d36708279337ca3
|
7
|
+
data.tar.gz: 807c7bd56f6684c6aca8c189bded644f843da7badac3beb883b3471c60ce45252a94486051d08468fc3fa778eff4808b01ff5c497a7c1c0b23586569c5c76242
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## v1.0.
|
3
|
+
## v1.0.4 - 8/26/2023
|
4
|
+
|
5
|
+
- Added [cms:breadcrumbs Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#breadcrumbs)
|
6
|
+
- Added [cms:siblings Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#siblings)
|
7
|
+
- Updated [wiki documentation](https://github.com/avonderluft/occams/wiki)
|
8
|
+
|
9
|
+
## v1.0.3 - 8/15/2023
|
10
|
+
|
11
|
+
- Added a [cms:audio tag](https://github.com/avonderluft/occams/wiki/Content-Tags#audio) for an embedded audio player
|
12
|
+
- Some formatting of admin menu footer
|
13
|
+
|
14
|
+
## v1.0.2 - 8/14/2023
|
4
15
|
|
5
16
|
- Fixed image rendering which rubocop broke in v1.0.1
|
6
17
|
- Show unpublished pages in Rails development mode
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -29,9 +29,9 @@ Referring to the [ComfortableMexicanSofa](https://github.com/comfy/comfortable-m
|
|
29
29
|
* Powerful page templating capability using [Content Tags](https://github.com/avonderluft/occams/wiki/Content-Tags)
|
30
30
|
* [Multiple Sites](https://github.com/avonderluft/occams/wiki/Sites) from a single installation
|
31
31
|
* 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.
|
32
|
-
* [CMS Seeds](https://github.com/
|
33
|
-
* [Revision History](https://github.com/
|
34
|
-
* [Extendable Admin Area](https://github.com/
|
32
|
+
* [CMS Seeds](https://github.com/avonderluft/occams/wiki/CMS-Seeds) for initial content population
|
33
|
+
* [Revision History](https://github.com/avonderluft/occams/wiki/Revisions) to revert changes
|
34
|
+
* [Extendable Admin Area](https://github.com/avonderluft/occams/wiki/HowTo:-Reusing-Admin-Area) built with [Bootstrap 4](http://getbootstrap.com) (responsive design). Using [CodeMirror](http://codemirror.net) for HTML and Markdown highlighing and [Redactor](http://imperavi.com/redactor) as the WYSIWYG editor.
|
35
35
|
|
36
36
|
## Dependencies
|
37
37
|
|
@@ -41,7 +41,7 @@ Referring to the [ComfortableMexicanSofa](https://github.com/comfy/comfortable-m
|
|
41
41
|
|
42
42
|
## Compatibility
|
43
43
|
|
44
|
-
- Install and basic functionality validated on Ruby 3.2.2. with Rails 6.1.7.4 and 7.0.6
|
44
|
+
- Install and basic functionality validated on Ruby 3.2.2. with Rails 6.1.7.4 and 7.0.6+
|
45
45
|
- Rails 7 is recommended, since performance is noticably better
|
46
46
|
|
47
47
|
## Installation
|
@@ -114,4 +114,4 @@ For more detail see [CONTRIBUTING](CONTRIBUTING.md)
|
|
114
114
|
|
115
115
|
---
|
116
116
|
- [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa) Copyright 2010-2019 Oleg Khabarov. Released under the [MIT license](LICENSE)
|
117
|
-
- [Occams]
|
117
|
+
- [Occams](https://github.com/avonderluft/occams) Copyright 2023 Andrew vonderLuft, following suit, also released under the [MIT license](LICENSE)
|
data/TODOS.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ToDos
|
2
2
|
|
3
|
+
- add admin content search to list layouts, pages and snippets - see https://blog.robertsj.com/search/
|
3
4
|
- add application console for testing
|
4
|
-
- feature to resize file_link'd images
|
5
|
-
- get the original [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa) tests working
|
6
|
-
- add documentation to Occams to replace ComfortableMexicanSofa
|
5
|
+
- add feature to resize file_link'd images
|
6
|
+
- get the original [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa) tests working with Rails 7 and Ruby 3
|
@@ -74,11 +74,11 @@ protected
|
|
74
74
|
# Getting page and setting content_cache and fragments data if we need to
|
75
75
|
# serve translation data
|
76
76
|
def find_cms_page_by_full_path(full_path)
|
77
|
-
if Rails.env == 'production'
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
@cms_page = if Rails.env == 'production'
|
78
|
+
@cms_site.pages.published.find_by!(full_path: full_path)
|
79
|
+
else
|
80
|
+
@cms_site.pages.find_by!(full_path: full_path)
|
81
|
+
end
|
82
82
|
|
83
83
|
@cms_page.translate!
|
84
84
|
@cms_layout = @cms_page.layout
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Admin::<%= class_name.pluralize %>Controller <
|
1
|
+
class Admin::<%= class_name.pluralize %>Controller < Occams::Admin::BaseController
|
2
2
|
|
3
3
|
before_action :build_<%= file_name %>, only: [:new, :create]
|
4
4
|
before_action :load_<%= file_name %>, only: [:show, :edit, :update, :destroy]
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Tag for injecting HTML5 audio player. Example tag:
|
4
|
+
# {{ cms:audio "path/to/audio", style: "height: 22px; width: 80%" }}
|
5
|
+
# This expands into:
|
6
|
+
# <audio controls src="path/to/audio"></audio>
|
7
|
+
# To customize your player style, add a 'audioplayer' class to your CSS, e.g
|
8
|
+
# .audioplayer {
|
9
|
+
# border-radius: 6px;
|
10
|
+
# height: 22px;
|
11
|
+
# width: 60%;
|
12
|
+
# margin: 2px 0 2px 8px;
|
13
|
+
# padding: 0;
|
14
|
+
# }
|
15
|
+
# and/or pass in style overrides with the 'style' parameter, as above
|
16
|
+
|
17
|
+
class Occams::Content::Tag::Audio < Occams::Content::Tag
|
18
|
+
attr_reader :path, :locals
|
19
|
+
|
20
|
+
def initialize(context:, params: [], source: nil)
|
21
|
+
super
|
22
|
+
options = params.extract_options!
|
23
|
+
@path = params[0]
|
24
|
+
@style = ''
|
25
|
+
@style = "<style>.audioplayer {#{options['style']}}</style>" if options['style']
|
26
|
+
@style = options['style']
|
27
|
+
|
28
|
+
return if @path.present?
|
29
|
+
|
30
|
+
raise Error, 'Missing path for audio tag'
|
31
|
+
end
|
32
|
+
|
33
|
+
def content
|
34
|
+
format("#{@style}<audio controls class=\"audioplayer\" src=#{@path}></audio>")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Occams::Content::Renderer.register_tag(
|
39
|
+
:audio, Occams::Content::Tag::Audio
|
40
|
+
)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Nav Tag for rendering breadcrumb links to current page
|
4
|
+
# {{ cms:breadcrumbs }}
|
5
|
+
# {{ cms:breadcrumbs style: "font-weight: bold" }}
|
6
|
+
# To customize your breadcrumbs style, add a 'breadcrumbs' id to your CSS, e.g
|
7
|
+
# #breadcrumbs {
|
8
|
+
# color: #006633;
|
9
|
+
# font-family: Verdana, Arial, Helvetica, sans-serif;
|
10
|
+
# font-size: 105%;
|
11
|
+
# font-weight: bold;
|
12
|
+
# margin-top: 12px;
|
13
|
+
# margin-bottom: 4px;
|
14
|
+
# font-style: italic;
|
15
|
+
# }
|
16
|
+
# and/or pass in style overrides with the 'style' parameter, as above
|
17
|
+
|
18
|
+
class Occams::Content::Tag::Breadcrumbs < Occams::Content::Tag
|
19
|
+
attr_reader :path, :locals
|
20
|
+
|
21
|
+
def initialize(context:, params: [], source: nil)
|
22
|
+
super
|
23
|
+
options = params.extract_options!
|
24
|
+
@style = ''
|
25
|
+
@style = "<style>#breadcrumbs {#{options['style']}}</style>" if options['style']
|
26
|
+
|
27
|
+
@links = '<div id="breadcrumbs">'
|
28
|
+
context.ancestors.reverse.each do |a|
|
29
|
+
next if Rails.env == 'production' && !a.is_published
|
30
|
+
|
31
|
+
@links += "<a href=#{a.url(relative: true)}>#{a.label}</a> » "
|
32
|
+
end
|
33
|
+
@links += "#{context.label}</div>"
|
34
|
+
end
|
35
|
+
|
36
|
+
def content
|
37
|
+
format("#{@style}#{@links}")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
Occams::Content::Renderer.register_tag(
|
42
|
+
:breadcrumbs, Occams::Content::Tag::Breadcrumbs
|
43
|
+
)
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Nav Tag for rendering previous and next sibling links relative to current page
|
4
|
+
# {{ cms:siblings }}
|
5
|
+
# {{ cms:siblings style: "font-style: italic", exclude: "404-page, search-page" }}
|
6
|
+
# To customize your siblings style, add a 'siblings' id to your CSS, e.g
|
7
|
+
# #siblings {
|
8
|
+
# color: #006633;
|
9
|
+
# font-family: Verdana, Arial, Helvetica, sans-serif;
|
10
|
+
# font-size: 95%;
|
11
|
+
# margin-top: 12px;
|
12
|
+
# margin-bottom: 4px;
|
13
|
+
# font-style: italic;
|
14
|
+
# }
|
15
|
+
# and/or pass in style overrides with the 'style' parameter (see above)
|
16
|
+
#
|
17
|
+
# To exclude siblings, list their slugs with the 'exclude' parameter
|
18
|
+
# as comma-delimited string, e.g. as above - exclude: "404-page, search-page"
|
19
|
+
#
|
20
|
+
# style and exclude parameters are optional
|
21
|
+
|
22
|
+
class Occams::Content::Tag::Siblings < Occams::Content::Tag
|
23
|
+
attr_reader :path, :locals
|
24
|
+
|
25
|
+
def initialize(context:, params: [], source: nil)
|
26
|
+
super
|
27
|
+
options = params.extract_options!
|
28
|
+
@style = ''
|
29
|
+
@style = "<style>#siblings {#{options['style']}}</style>" if options['style']
|
30
|
+
@exclude = []
|
31
|
+
@exclude = options['exclude'].split(',') if options['exclude']
|
32
|
+
@links = '<div id="siblings">'
|
33
|
+
|
34
|
+
prevp = false
|
35
|
+
sibs = context.self_and_siblings.sort_by(&:position)
|
36
|
+
page_idx = sibs.index(context)
|
37
|
+
sibs.each do |sib|
|
38
|
+
sib_idx = sibs.index(sib)
|
39
|
+
next if sibs.index(sib) == page_idx
|
40
|
+
next if @exclude.include? sib.slug
|
41
|
+
next if Rails.env == 'production' && !sib.is_published
|
42
|
+
|
43
|
+
if sib_idx == page_idx - 1
|
44
|
+
@links += "<a href=#{sib.url(relative: true)}>#{sib.label}</a> « <em>Previous</em> • "
|
45
|
+
prevp = true
|
46
|
+
elsif sib_idx == page_idx + 1
|
47
|
+
@links += '•' unless prevp
|
48
|
+
@links += "<em>Next</em> » <a href=#{sib.url(relative: true)}>#{sib.label}</a>"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
@links += '</div>'
|
52
|
+
end
|
53
|
+
|
54
|
+
def content
|
55
|
+
format("#{@style}#{@links}")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
Occams::Content::Renderer.register_tag(
|
60
|
+
:siblings, Occams::Content::Tag::Siblings
|
61
|
+
)
|
data/lib/occams/content.rb
CHANGED
@@ -29,3 +29,7 @@ require_relative 'content/tags/page_file_link'
|
|
29
29
|
require_relative 'content/tags/helper'
|
30
30
|
require_relative 'content/tags/partial'
|
31
31
|
require_relative 'content/tags/template'
|
32
|
+
|
33
|
+
require_relative 'content/tags/audio'
|
34
|
+
require_relative 'content/tags/breadcrumbs'
|
35
|
+
require_relative 'content/tags/siblings'
|
data/lib/occams/version.rb
CHANGED
data/occams.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_runtime_dependency 'kramdown', '~> 2.4', '>= 2.4.0'
|
29
29
|
s.add_runtime_dependency 'mimemagic', '~> 0.4', '>= 0.4.3'
|
30
30
|
s.add_runtime_dependency 'mini_magick', '~> 4.12', '>= 4.12.0'
|
31
|
-
s.add_dependency 'rails', '>= 6.1.
|
31
|
+
s.add_dependency 'rails', '>= 6.1.0'
|
32
32
|
s.add_runtime_dependency 'rails-i18n', '>= 6.0.0'
|
33
33
|
s.add_runtime_dependency 'sassc-rails', '~> 2.1', '>= 2.1.2'
|
34
34
|
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.
|
4
|
+
version: 1.0.4
|
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-
|
11
|
+
date: 2023-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_link_to
|
@@ -176,14 +176,14 @@ dependencies:
|
|
176
176
|
requirements:
|
177
177
|
- - ">="
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version: 6.1.
|
179
|
+
version: 6.1.0
|
180
180
|
type: :runtime
|
181
181
|
prerelease: false
|
182
182
|
version_requirements: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
184
|
- - ">="
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version: 6.1.
|
186
|
+
version: 6.1.0
|
187
187
|
- !ruby/object:Gem::Dependency
|
188
188
|
name: rails-i18n
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|
@@ -653,6 +653,8 @@ files:
|
|
653
653
|
- lib/occams/content/renderer.rb
|
654
654
|
- lib/occams/content/tag.rb
|
655
655
|
- lib/occams/content/tags/asset.rb
|
656
|
+
- lib/occams/content/tags/audio.rb
|
657
|
+
- lib/occams/content/tags/breadcrumbs.rb
|
656
658
|
- lib/occams/content/tags/checkbox.rb
|
657
659
|
- lib/occams/content/tags/date.rb
|
658
660
|
- lib/occams/content/tags/datetime.rb
|
@@ -666,6 +668,7 @@ files:
|
|
666
668
|
- lib/occams/content/tags/number.rb
|
667
669
|
- lib/occams/content/tags/page_file_link.rb
|
668
670
|
- lib/occams/content/tags/partial.rb
|
671
|
+
- lib/occams/content/tags/siblings.rb
|
669
672
|
- lib/occams/content/tags/snippet.rb
|
670
673
|
- lib/occams/content/tags/template.rb
|
671
674
|
- lib/occams/content/tags/text.rb
|