occams 1.0.3 → 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 +6 -0
- data/Gemfile +1 -1
- data/README.md +3 -3
- data/TODOS.md +2 -2
- data/app/views/layouts/occams/admin/cms/_left.html.haml +1 -1
- data/lib/generators/occams/scaffold/templates/controller.rb.tt +1 -1
- data/lib/occams/content/tags/audio.rb +12 -13
- data/lib/occams/content/tags/breadcrumbs.rb +43 -0
- data/lib/occams/content/tags/siblings.rb +61 -0
- data/lib/occams/content.rb +4 -1
- data/lib/occams/version.rb +1 -1
- metadata +4 -2
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,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
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
|
+
|
3
9
|
## v1.0.3 - 8/15/2023
|
4
10
|
|
5
11
|
- Added a [cms:audio tag](https://github.com/avonderluft/occams/wiki/Content-Tags#audio) for an embedded audio player
|
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
|
|
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
5
|
- add feature to resize file_link'd images
|
5
|
-
- get the original [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa) tests working
|
6
|
-
- add and update documentation to Occams to replace ComfortableMexicanSofa
|
6
|
+
- get the original [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa) tests working with Rails 7 and Ruby 3
|
@@ -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]
|
@@ -5,13 +5,14 @@
|
|
5
5
|
# This expands into:
|
6
6
|
# <audio controls src="path/to/audio"></audio>
|
7
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
|
-
#
|
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
|
15
16
|
|
16
17
|
class Occams::Content::Tag::Audio < Occams::Content::Tag
|
17
18
|
attr_reader :path, :locals
|
@@ -20,7 +21,9 @@ class Occams::Content::Tag::Audio < Occams::Content::Tag
|
|
20
21
|
super
|
21
22
|
options = params.extract_options!
|
22
23
|
@path = params[0]
|
23
|
-
@style
|
24
|
+
@style = ''
|
25
|
+
@style = "<style>.audioplayer {#{options['style']}}</style>" if options['style']
|
26
|
+
@style = options['style']
|
24
27
|
|
25
28
|
return if @path.present?
|
26
29
|
|
@@ -28,11 +31,7 @@ class Occams::Content::Tag::Audio < Occams::Content::Tag
|
|
28
31
|
end
|
29
32
|
|
30
33
|
def content
|
31
|
-
format(
|
32
|
-
'<style>.audioplayer {%<style>s}</style><audio controls class="audioplayer" src=%<path>p></audio>',
|
33
|
-
path: @path,
|
34
|
-
style: @style
|
35
|
-
)
|
34
|
+
format("#{@style}<audio controls class=\"audioplayer\" src=#{@path}></audio>")
|
36
35
|
end
|
37
36
|
end
|
38
37
|
|
@@ -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
@@ -24,9 +24,12 @@ require_relative 'content/tags/files'
|
|
24
24
|
|
25
25
|
require_relative 'content/tags/snippet'
|
26
26
|
require_relative 'content/tags/asset'
|
27
|
-
require_relative 'content/tags/audio'
|
28
27
|
require_relative 'content/tags/file_link'
|
29
28
|
require_relative 'content/tags/page_file_link'
|
30
29
|
require_relative 'content/tags/helper'
|
31
30
|
require_relative 'content/tags/partial'
|
32
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
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
|
@@ -654,6 +654,7 @@ files:
|
|
654
654
|
- lib/occams/content/tag.rb
|
655
655
|
- lib/occams/content/tags/asset.rb
|
656
656
|
- lib/occams/content/tags/audio.rb
|
657
|
+
- lib/occams/content/tags/breadcrumbs.rb
|
657
658
|
- lib/occams/content/tags/checkbox.rb
|
658
659
|
- lib/occams/content/tags/date.rb
|
659
660
|
- lib/occams/content/tags/datetime.rb
|
@@ -667,6 +668,7 @@ files:
|
|
667
668
|
- lib/occams/content/tags/number.rb
|
668
669
|
- lib/occams/content/tags/page_file_link.rb
|
669
670
|
- lib/occams/content/tags/partial.rb
|
671
|
+
- lib/occams/content/tags/siblings.rb
|
670
672
|
- lib/occams/content/tags/snippet.rb
|
671
673
|
- lib/occams/content/tags/template.rb
|
672
674
|
- lib/occams/content/tags/text.rb
|