annex-cms 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/views/annex/_block.html.haml +1 -1
- data/lib/annex/version.rb +1 -1
- data/lib/annex/view_helpers.rb +13 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e53ab40749b572e54d4e1c076bcb17a541ec2b79
|
4
|
+
data.tar.gz: a8ebc3d23c04e76f38c7ffd4a6aba4980e54b1ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43b5bcffaa71cffce6d65d9ee0a6226a620c0e9e8e03d9500e1bc24ce6583742a7dc3202cea362a47dd83791fca3beabf57abc4c6f423d38558656fa501eb482
|
7
|
+
data.tar.gz: 0b672162d4d7c79259a981e00ada87ded35d2fd7e52a7460953a7b7d35238fc87b90b10588c6193a4ac6c7ae163a41ec1b0c5f9bb2b961e2dc1a437fd5b73c06
|
@@ -1,2 +1,2 @@
|
|
1
|
-
.redactor{ { :
|
1
|
+
.redactor{ { data: { identifier: identifier, route: route }.deep_merge(opts) } }
|
2
2
|
= content.html_safe if content
|
data/lib/annex/version.rb
CHANGED
data/lib/annex/view_helpers.rb
CHANGED
@@ -1,26 +1,24 @@
|
|
1
1
|
require 'active_support/hash_with_indifferent_access'
|
2
2
|
|
3
3
|
module Annex
|
4
|
+
#
|
5
|
+
# Create global view helpers
|
6
|
+
#
|
4
7
|
module ViewHelpers
|
8
|
+
#
|
9
|
+
# annex_block is a universal helper to render content from
|
10
|
+
# mongodb and display it on the page
|
11
|
+
#
|
12
|
+
# @TODO: implement caching
|
13
|
+
#
|
5
14
|
def annex_block(identifier, opts = {})
|
6
|
-
opts[:
|
15
|
+
opts[:route] ||= current_route
|
7
16
|
|
8
|
-
|
9
|
-
route = opts[:route]
|
10
|
-
opts[:route].delete
|
11
|
-
else
|
12
|
-
route = current_route
|
13
|
-
end
|
17
|
+
doc = Annex::Block.where(route: opts[:route]).first_or_create
|
14
18
|
|
15
|
-
|
19
|
+
content = doc.content.try(:[], identifier.to_s) || opts[:default]
|
16
20
|
|
17
|
-
|
18
|
-
content = doc.content[identifier.to_s] || opts[:default]
|
19
|
-
else
|
20
|
-
content = opts[:default]
|
21
|
-
end
|
22
|
-
|
23
|
-
render partial: 'annex/block', locals: { content: content, route: route, identifier: identifier, opts: opts }
|
21
|
+
render partial: 'annex/block', locals: { content: content, route: opts[:route], identifier: identifier, opts: opts }
|
24
22
|
end
|
25
23
|
|
26
24
|
def annex_clips(clip)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: annex-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clay McIlrath
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|