contents_core 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6367cfc8e67b02049fd7d75ed0bdac7e43c9a0cd
4
- data.tar.gz: 3d220698df40f8579fea74a50045b4fc5716a052
3
+ metadata.gz: e7d1b8b264e340a66ef666f3531ba77ab6c30738
4
+ data.tar.gz: 5cc9fd8dc12f6e30fe17ebdbf727e8ba8d861d8c
5
5
  SHA512:
6
- metadata.gz: 3e9914344d032c962943f84e41ea468494d8b3bcd5367e6f7aea9f615eb9614aeb97f04d5268ad5fec21237e2ce54b54a649624ae26ac4f81b68dd72e177073e
7
- data.tar.gz: 4567b1453c5da946b092515b82d1b6ee060800adbf8644eae84390bd0438362f86794b596fc9e4e65a8f72d06bbca2d2df8a3483b9d227554b56127477ac7f16
6
+ metadata.gz: 8345f87ea98574cabc250b958cf80a828553f2f34475ffd060100de9763a897bd20cfaa22d85d32fc35557e4cefd1e5bd3e393c346eb047ff00a9775d51024f7
7
+ data.tar.gz: 8f66cfbfa1cb4faad0976dce1aca8958c536134469e39228701cf2c5c7038406589c7814fcf18935ea274a54b679e06f78808e1c597cd157a3ed6343f71565c2
data/README.md CHANGED
@@ -20,9 +20,11 @@ Goals:
20
20
  - Copy migrations (Rails 5.x syntax, in Rails 4.x use `rake`):
21
21
  `rails contents_core:install:migrations`
22
22
 
23
- - Migrate
23
+ - Execute migrations
24
24
 
25
- - Add the concern *Blocks* to your model: `include ContentsCore::Blocks`
25
+ - Add the concern *Blocks* to your model (ex. *Page*): `include ContentsCore::Blocks`
26
+
27
+ - Add the blocks to a view (ex. *page show*): `= render partial: 'contents_core/blocks', locals: { container: @page }`
26
28
 
27
29
  ### Config
28
30
 
@@ -93,6 +95,8 @@ end
93
95
 
94
96
  To create a "free form" block just use: `Page.first.create_block :intro, name: 'IntroBlock', schema: { intro: :item_string, subtitle: :item_string }`
95
97
 
98
+ Then create a *app/view/contents_core/_block_intro* view.
99
+
96
100
  ### Dev Notes
97
101
 
98
102
  #### Structure
@@ -0,0 +1,6 @@
1
+ <% if local_assigns[:block] %>
2
+ <% block = local_assigns[:block] %>
3
+ <div class="block-<%= block.block_type %>" <%= block.editable %>><%=
4
+ render partial: "contents_core/block_#{block.block_type}", locals: { block: block }
5
+ %></div>
6
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <% block = local_assigns[:block] %>
2
+ <% if block %>
3
+ <% if block.props.file %>
4
+ <%= image_tag block.props.file.data, block.props.file.editable %>
5
+ <% end %>
6
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% if local_assigns[:block] %>
2
+ <% local_assigns[:block].cc_blocks.each do |sb| %>
3
+ <div class="sub-block" <%= sb.editable %>><%=
4
+ render partial: "contents_core/block_#{sb.block_type}", locals: { block: sb }
5
+ %></div>
6
+ <% end %>
7
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <% block = local_assigns[:block] %>
2
+ <% if block %>
3
+ <% if block.props.file %>
4
+ <%= image_tag block.props.file.data, block.props.file.editable %>
5
+ <% end %>
6
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% if local_assigns[:block] %>
2
+ <% local_assigns[:block].ec_blocks.each do |sb| %>
3
+ <div class="sub-block" <%= sb.editable %>><%=
4
+ render partial: "contents_core/block_#{sb.block_type}", locals: { block: sb }
5
+ %></div>
6
+ <% end %>
7
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% block = local_assigns[:block] %>
2
+ <% if block %>
3
+ <div class="title"<%= block.props.string.editable %>><%== block.props.string %></div>
4
+ <div class="content"<%= block.props.text.editable %>><%== block.props.text %></div>
5
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <% block = local_assigns[:block] %>
2
+ <% if block %>
3
+ <div>
4
+ <% if block.props.image %>
5
+ <%= image_tag block.props.image.data, block.props.image.editable %>
6
+ <% end %>
7
+ <% if block.props.string %>
8
+ <div class="title"<%= block.props.string.editable %>><%== block.props.string %></div>
9
+ <div class="content"<%= block.props.text.editable %>><%== block.props.text %></div>
10
+ <% end %>
11
+ </div>
12
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <% if local_assigns[:container] %>
2
+ <div data-cc>
3
+ <% blocks = local_assigns[:container].current_blocks( params[:version] ) %>
4
+ <% if blocks %>
5
+ <div id="cc_blocks" <%= ContentsCore.editing ? "data-cc-blocks=#{blocks.length}" : '' %>><% blocks.each do |block| %><%= render partial: 'contents_core/block', locals: { block: block } %><%# yield blocks %><% end %></div>
6
+ <% if ContentsCore.editing %>
7
+ <div data-cc-new-blocks></div>
8
+ <% end %>
9
+ <% end %>
10
+ </div>
11
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module ContentsCore
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contents_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mat
@@ -46,6 +46,14 @@ files:
46
46
  - app/models/contents_core/item_integer.rb
47
47
  - app/models/contents_core/item_string.rb
48
48
  - app/models/contents_core/item_text.rb
49
+ - app/views/contents_core/_block.html.erb
50
+ - app/views/contents_core/_block_image.html.erb
51
+ - app/views/contents_core/_block_multi_text.html.erb
52
+ - app/views/contents_core/_block_slide.html.erb
53
+ - app/views/contents_core/_block_slider.html.erb
54
+ - app/views/contents_core/_block_text.html.erb
55
+ - app/views/contents_core/_block_text_with_image.html.erb
56
+ - app/views/contents_core/_blocks.html.erb
49
57
  - config/initializers/contents_core.rb
50
58
  - config/locales/active_record.en.yml
51
59
  - config/routes.rb