contents_core 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -2
- data/app/models/contents_core/block.rb +9 -0
- data/lib/contents_core/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d212911271d9e937055d2067095b19e57c51a81
|
4
|
+
data.tar.gz: 72aa8a36a003e5eb250f75dd6dfebbedd32cbc1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4696315423af0f4ed09f2bb6c87fb32be6c2ed43ae5ff050df66caa092097febdf46f718151dbe0b789af409badecb5d170352c305de2eb6457ae95524f7d4c5
|
7
|
+
data.tar.gz: bc56126d1b9e97a9a426c4a44dc15d8c0e5e79bc88353c867ea946ab340b3b5fb06906fcea394cf6a0524cd32019ec9e12e3bca09e553a8b8cb66c27add21d6e
|
data/README.md
CHANGED
@@ -103,16 +103,22 @@ To add a new field to an existing block (ex. to first Page, on the first Block):
|
|
103
103
|
|
104
104
|
```rb
|
105
105
|
block = Page.first.get_block 'text-1'
|
106
|
-
block.create_item( 'ContentsCore::ItemString', '
|
106
|
+
block.create_item( 'ContentsCore::ItemString', 'new-field' ).set( 'A test...' ).save
|
107
107
|
```
|
108
108
|
|
109
109
|
Then add to the block view: `block.get( 'new-field' )`
|
110
110
|
|
111
|
+
To set a field value: `block.set( 'new-field', 'Some value' )`
|
112
|
+
|
113
|
+
#### ActiveAdmin
|
114
|
+
|
115
|
+
If you use ActiveAdmin as admin interface you can find a sample model configuration [here](extra/activeadmin_page.rb)
|
116
|
+
|
111
117
|
### Notes
|
112
118
|
|
113
119
|
- Blocks types: `ContentsCore::Block.block_types`
|
114
120
|
|
115
|
-
- Default blocks [here](
|
121
|
+
- Default blocks [here](config/initializers/contents_core.rb)
|
116
122
|
|
117
123
|
#### Structure
|
118
124
|
|
@@ -152,6 +152,15 @@ module ContentsCore
|
|
152
152
|
OpenStruct.new( pieces )
|
153
153
|
end
|
154
154
|
|
155
|
+
def set( name, value )
|
156
|
+
items.each do |item|
|
157
|
+
if item.name == name
|
158
|
+
item.data = value
|
159
|
+
break
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
155
164
|
def self.block_types
|
156
165
|
@@block_types ||= ContentsCore.config[:cc_blocks].keys
|
157
166
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contents_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
version: '0'
|
86
86
|
requirements: []
|
87
87
|
rubyforge_project:
|
88
|
-
rubygems_version: 2.
|
88
|
+
rubygems_version: 2.4.8
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: Flexible contents structure for Rails
|