contents_core 0.1.6 → 0.1.7

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: 5d212911271d9e937055d2067095b19e57c51a81
4
- data.tar.gz: 72aa8a36a003e5eb250f75dd6dfebbedd32cbc1e
3
+ metadata.gz: 1f90bf12c228d2c90c68a9de55bbd802d87e7b56
4
+ data.tar.gz: 0fad93688027f8dd697f81489d27f380d3787c8e
5
5
  SHA512:
6
- metadata.gz: 4696315423af0f4ed09f2bb6c87fb32be6c2ed43ae5ff050df66caa092097febdf46f718151dbe0b789af409badecb5d170352c305de2eb6457ae95524f7d4c5
7
- data.tar.gz: bc56126d1b9e97a9a426c4a44dc15d8c0e5e79bc88353c867ea946ab340b3b5fb06906fcea394cf6a0524cd32019ec9e12e3bca09e553a8b8cb66c27add21d6e
6
+ metadata.gz: cc078d12ec01d6461b7b7c61a231c69a3d81a8bb545ec31a2db6598ea113a0cac30a54c4b48f057bcec4e5cafc4fb9a26701cf3aa617e10405084535a74048ef
7
+ data.tar.gz: 7f591fdbebcd9472dfc12b6e24ae47f26f59fee7ed9e0080cd58edde97a11c8772e0b27d7741bb71d99e6eab21cd212c462c26c8151051efdb4a1b2025dcd90f
data/README.md CHANGED
@@ -44,7 +44,7 @@ conf[:cc_blocks][:custom] = {
44
44
  ContentsCore.config( { components: conf[:cc_blocks] } )
45
45
  ```
46
46
 
47
- Create the new view blocks: `app/views/contents_core/_block_custom.html.erb`
47
+ Create the new view blocks: `app/views/contents_core/_block_custom.html.slim`
48
48
 
49
49
  ```slim
50
50
  - if block
@@ -124,9 +124,9 @@ If you use ActiveAdmin as admin interface you can find a sample model configurat
124
124
 
125
125
  - Including the Blocks concern to a model will add `has_many :cc_blocks` relationship (the list of blocks attached to a container) and some utility methods
126
126
 
127
- - Block: UI component, a group of items (ex. a text with a title, a slider, a 3 column text widgets, etc.); built with a list of sub blocks (for nested components) and a list of items
127
+ - Block: UI component, a group of items (ex. a text with a title, a slider, a 3 column text widget, etc.); built with a list of sub blocks (for nested components) and a list of items
128
128
 
129
- - Item: a single piece of information (ex. a string, a text, a boolean, an integer, a file, etc.)
129
+ - Item: a single piece of information (ex. a string, a text, a boolean, an integer, a file, etc.) with a virtual method named *data*
130
130
 
131
131
  ## Contributors
132
132
 
@@ -9,6 +9,21 @@ module ContentsCore
9
9
  self
10
10
  end
11
11
 
12
+ def from_string( value )
13
+ if value.is_a? String
14
+ val = {}
15
+ value.each_line do |line|
16
+ m = line.match( /([^:]*):(.*)/ )
17
+ val[m[1]] = m[2].strip if m && !m[1].blank?
18
+ end
19
+ self.data_hash = val
20
+ end
21
+ end
22
+
23
+ def to_s
24
+ self.data_hash.inject( '' ) { |k, v| k + v[0] + ': ' + v[1] + "\n" }
25
+ end
26
+
12
27
  def self.type_name
13
28
  'hash'
14
29
  end
@@ -1,3 +1,3 @@
1
1
  module ContentsCore
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
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.6
4
+ version: 0.1.7
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 00:00:00.000000000 Z
11
+ date: 2017-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails