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 +4 -4
- data/README.md +6 -2
- data/app/views/contents_core/_block.html.erb +6 -0
- data/app/views/contents_core/_block_image.html.erb +6 -0
- data/app/views/contents_core/_block_multi_text.html.erb +7 -0
- data/app/views/contents_core/_block_slide.html.erb +6 -0
- data/app/views/contents_core/_block_slider.html.erb +7 -0
- data/app/views/contents_core/_block_text.html.erb +5 -0
- data/app/views/contents_core/_block_text_with_image.html.erb +12 -0
- data/app/views/contents_core/_blocks.html.erb +11 -0
- data/lib/contents_core/version.rb +1 -1
- metadata +9 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7d1b8b264e340a66ef666f3531ba77ab6c30738
|
4
|
+
data.tar.gz: 5cc9fd8dc12f6e30fe17ebdbf727e8ba8d861d8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
-
|
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,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 %>
|
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.
|
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
|