contents_core 0.1.5 → 0.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3e790025ed4a3222f501a20371d24c9d0673f89
4
- data.tar.gz: a6d988af5c4e27072651a2f3a05d7dc8bacd15a2
3
+ metadata.gz: 5d212911271d9e937055d2067095b19e57c51a81
4
+ data.tar.gz: 72aa8a36a003e5eb250f75dd6dfebbedd32cbc1e
5
5
  SHA512:
6
- metadata.gz: db8bdfec13a651a08b5c09f89fbf3138745c23b7c531f78e539e1866cfb1fdd6c5f8d8401cc24415444d6bf93a1fc92dfcf01e84345a2cb75ebab175047be305
7
- data.tar.gz: e237083b259321327d439fa1d3c026abab3d19a3ce438b856998d7a0be2095e84b39004bfc41062ea9c4ad00478465a2530c0d2a6d24b566256f05dc704a1b4d
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', 'test-1' ).set( 'A test...' ).save
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](https://github.com/blocknotes/contents_core/blob/master/config/initializers/contents_core.rb)
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
@@ -1,3 +1,3 @@
1
1
  module ContentsCore
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  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.5
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-08 00:00:00.000000000 Z
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.5.2
88
+ rubygems_version: 2.4.8
89
89
  signing_key:
90
90
  specification_version: 4
91
91
  summary: Flexible contents structure for Rails