spina-blocks 0.3.0 → 0.4.0
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 +4 -4
- data/README.md +126 -8
- data/app/assets/javascripts/spina/controllers/block_collection_controller.js +155 -42
- data/app/assets/javascripts/spina/controllers/content_blocks_controller.js +118 -0
- data/app/assets/javascripts/spina/controllers/nested_content_blocks_controller.js +4 -0
- data/app/assets/javascripts/spina/utils/dropdown_position.js +30 -0
- data/app/controllers/spina/blocks/admin/blocks_controller.rb +61 -9
- data/app/controllers/spina/blocks/admin/page_blocks_controller.rb +7 -0
- data/app/helpers/spina/blocks/blocks_helper.rb +20 -4
- data/app/models/concerns/spina/parts/block_filterable.rb +18 -0
- data/app/models/spina/blocks/account_extension.rb +32 -0
- data/app/models/spina/blocks/block.rb +27 -1
- data/app/models/spina/parts/block_collection.rb +2 -0
- data/app/models/spina/parts/block_reference.rb +21 -1
- data/app/models/spina/parts/content_block.rb +18 -0
- data/app/models/spina/parts/content_blocks.rb +25 -0
- data/app/models/spina/parts/nested_content_blocks.rb +15 -0
- data/app/views/spina/admin/parts/block_collections/_form.html.erb +33 -21
- data/app/views/spina/admin/parts/block_references/_form.html.erb +16 -5
- data/app/views/spina/admin/parts/content_blocks/_fields.html.erb +57 -0
- data/app/views/spina/admin/parts/content_blocks/_form.html.erb +73 -0
- data/app/views/spina/admin/parts/nested_content_blocks/_form.html.erb +75 -0
- data/app/views/spina/blocks/admin/blocks/_form.html.erb +9 -5
- data/app/views/spina/blocks/admin/blocks/_form_block_settings.html.erb +12 -0
- data/app/views/spina/blocks/admin/blocks/_new_block_modal_form.html.erb +42 -0
- data/app/views/spina/blocks/admin/blocks/index.html.erb +30 -5
- data/app/views/spina/blocks/admin/blocks/new.html.erb +5 -1
- data/app/views/spina/blocks/admin/page_blocks/index.html.erb +14 -8
- data/config/locales/en.yml +22 -0
- data/config/routes.rb +1 -0
- data/db/migrate/6_add_custom_block_fields_to_spina_blocks_blocks.rb +14 -0
- data/lib/spina/blocks/engine.rb +15 -2
- data/lib/spina/blocks/version.rb +1 -1
- metadata +13 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Admin form for Spina::Parts::NestedContentBlocks.
|
|
3
|
+
Same as ContentBlocks but uses "nested-content-blocks" Stimulus controller
|
|
4
|
+
to avoid scope conflicts when rendered inside Repeaters or other ContentBlocks.
|
|
5
|
+
Reuses content_blocks/_fields.html.erb for individual block rendering.
|
|
6
|
+
%>
|
|
7
|
+
<% available_templates = f.object.available_templates(current_theme) %>
|
|
8
|
+
|
|
9
|
+
<div class="mt-4" data-controller="nested-content-blocks">
|
|
10
|
+
<label class="block text-sm leading-5 font-medium text-gray-700"><%= f.object.title %></label>
|
|
11
|
+
<% if f.object.hint.present? %>
|
|
12
|
+
<div class="text-gray-400 text-sm mb-2"><%= f.object.hint %></div>
|
|
13
|
+
<% end %>
|
|
14
|
+
|
|
15
|
+
<%# List of existing content blocks %>
|
|
16
|
+
<div data-nested-content-blocks-target="list" class="space-y-3 mb-4">
|
|
17
|
+
<% (f.object.content || []).each do |content_block| %>
|
|
18
|
+
<%= f.fields_for :content, [content_block], child_index: content_block.object_id do |ff| %>
|
|
19
|
+
<%= render "spina/admin/parts/content_blocks/fields", f: ff, stimulus_controller: "nested-content-blocks" %>
|
|
20
|
+
<% end %>
|
|
21
|
+
<% end %>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<%# Empty state %>
|
|
25
|
+
<div data-nested-content-blocks-target="emptyMessage"
|
|
26
|
+
class="text-sm text-gray-400 italic py-3 text-center"
|
|
27
|
+
style="<%= (f.object.content || []).any? ? 'display:none' : '' %>">
|
|
28
|
+
<%= t('spina.content_blocks.empty') %>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<%# Add block button with type picker dropdown %>
|
|
32
|
+
<% if available_templates.any? %>
|
|
33
|
+
<div class="relative">
|
|
34
|
+
<button type="button"
|
|
35
|
+
class="btn btn-default text-sm"
|
|
36
|
+
data-action="nested-content-blocks#toggleTypeMenu">
|
|
37
|
+
<svg class="w-4 h-4 mr-1.5 inline-block" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
38
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"/>
|
|
39
|
+
</svg>
|
|
40
|
+
<%= t('spina.content_blocks.add_block') %>
|
|
41
|
+
</button>
|
|
42
|
+
|
|
43
|
+
<div data-nested-content-blocks-target="typeMenu"
|
|
44
|
+
class="absolute z-10 mt-1 w-56 bg-white border border-gray-200 rounded-md shadow-lg py-1"
|
|
45
|
+
style="display:none">
|
|
46
|
+
<% available_templates.each do |template| %>
|
|
47
|
+
<button type="button"
|
|
48
|
+
class="w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"
|
|
49
|
+
data-action="nested-content-blocks#addBlock"
|
|
50
|
+
data-block-type="<%= template[:name] %>">
|
|
51
|
+
<%= template[:title] || template[:name].titleize %>
|
|
52
|
+
</button>
|
|
53
|
+
<% end %>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
<% end %>
|
|
57
|
+
|
|
58
|
+
<%# Pre-rendered templates for each block type (used by Stimulus to clone) %>
|
|
59
|
+
<% available_templates.each do |template| %>
|
|
60
|
+
<%
|
|
61
|
+
content_block = Spina::Parts::ContentBlock.new(
|
|
62
|
+
name: f.object.name,
|
|
63
|
+
block_type: template[:name].to_s
|
|
64
|
+
)
|
|
65
|
+
child_index_placeholder = content_block.object_id.to_s
|
|
66
|
+
%>
|
|
67
|
+
<template data-nested-content-blocks-target="blockTemplate"
|
|
68
|
+
data-block-type="<%= template[:name] %>"
|
|
69
|
+
data-child-index="<%= child_index_placeholder %>">
|
|
70
|
+
<%= f.fields_for(:content, [content_block], child_index: child_index_placeholder) do |ff| %>
|
|
71
|
+
<%= render "spina/admin/parts/content_blocks/fields", f: ff, stimulus_controller: "nested-content-blocks" %>
|
|
72
|
+
<% end %>
|
|
73
|
+
</template>
|
|
74
|
+
<% end %>
|
|
75
|
+
</div>
|
|
@@ -12,11 +12,15 @@
|
|
|
12
12
|
|
|
13
13
|
<div hidden data-reveal data-transition class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg border border-gray-200 z-30">
|
|
14
14
|
<div class="rounded-md bg-white shadow-xs py-1">
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
<% if @block.deletable? %>
|
|
16
|
+
<%= button_to t('spina.blocks.delete'),
|
|
17
|
+
spina.blocks_admin_block_path(@block),
|
|
18
|
+
method: :delete,
|
|
19
|
+
class: "block w-full text-left px-4 py-2 text-sm leading-5 font-medium text-red-500 cursor-pointer bg-white hover:bg-red-100/50 hover:text-red-500",
|
|
20
|
+
form: {data: {controller: "confirm", confirm_message: t('spina.blocks.delete_confirmation')}} %>
|
|
21
|
+
<% else %>
|
|
22
|
+
<span class="block px-4 py-2 text-sm leading-5 text-gray-400"><%= t('spina.blocks.cannot_be_deleted') %></span>
|
|
23
|
+
<% end %>
|
|
20
24
|
</div>
|
|
21
25
|
</div>
|
|
22
26
|
</div>
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
<div class="max-w-5xl grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-6">
|
|
2
|
+
<% if @block.key.present? %>
|
|
3
|
+
<div class="col-span-1 mt-6 md:mt-0">
|
|
4
|
+
<label class="block text-sm font-medium leading-5 text-gray-700">
|
|
5
|
+
<%= Spina::Blocks::Block.human_attribute_name(:key) %>
|
|
6
|
+
</label>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div class="col-span-2 mt-1">
|
|
10
|
+
<span class="text-sm text-gray-500 font-mono"><%= @block.key %></span>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
2
14
|
<div class="col-span-1 mt-6 md:mt-0">
|
|
3
15
|
<label class="block text-sm font-medium leading-5 text-gray-700">
|
|
4
16
|
<%= Spina::Blocks::Block.human_attribute_name(:block_template) %>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<%# Modal variant of the new block form. Used when creating a block from BlockCollection.
|
|
2
|
+
After successful creation, the modal transitions to the block edit form.
|
|
3
|
+
Expects: @block, @block_templates %>
|
|
4
|
+
<%= turbo_frame_tag dom_id(@block, :new_block_modal_form) do %>
|
|
5
|
+
<%= form_with model: @block, url: spina.blocks_admin_blocks_path, data: { turbo_frame: "modal" } do |f| %>
|
|
6
|
+
<%= hidden_field_tag :modal, 1 %>
|
|
7
|
+
|
|
8
|
+
<div class="px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
|
9
|
+
<div class="sm:flex sm:items-start">
|
|
10
|
+
<div class="w-full">
|
|
11
|
+
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-headline">
|
|
12
|
+
<%= t('spina.blocks.new') %>
|
|
13
|
+
</h3>
|
|
14
|
+
|
|
15
|
+
<div class="mt-4">
|
|
16
|
+
<label for="block_block_template" class="block text-sm font-medium text-gray-700 mb-1">
|
|
17
|
+
<%= t('spina.blocks.block_type') %>
|
|
18
|
+
</label>
|
|
19
|
+
<%= f.select :block_template,
|
|
20
|
+
@block_templates.map { |bt| [bt[:title], bt[:name]] },
|
|
21
|
+
{ include_blank: t('spina.blocks.select_block_type') },
|
|
22
|
+
class: "block w-full rounded-md border-gray-300 shadow-xs focus:border-blue-500 focus:ring-blue-500 text-sm",
|
|
23
|
+
required: true %>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div class="mt-3">
|
|
27
|
+
<%= render Spina::Forms::TextFieldComponent.new(f, :name, size: 'lg', autofocus: true) %>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="px-4 pb-5 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
|
33
|
+
<button type="submit" class="btn btn-primary w-full sm:w-auto sm:ml-3">
|
|
34
|
+
<%= t('spina.blocks.create') %>
|
|
35
|
+
</button>
|
|
36
|
+
|
|
37
|
+
<button type="button" class="btn btn-default w-full sm:w-auto mt-2 sm:mt-0" data-action="modal#close">
|
|
38
|
+
<%= t('spina.ui.cancel') %>
|
|
39
|
+
</button>
|
|
40
|
+
</div>
|
|
41
|
+
<% end %>
|
|
42
|
+
<% end %>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<%= render Spina::UserInterface::HeaderComponent.new do |header| %>
|
|
2
2
|
<% header.with_actions do %>
|
|
3
|
-
<%
|
|
4
|
-
|
|
3
|
+
<% creatable_templates = (current_theme.try(:block_templates) || []).reject { |bt|
|
|
4
|
+
((current_theme.try(:custom_blocks) || []).map { |cb| cb[:block_template].to_s }.uniq).include?(bt[:name].to_s)
|
|
5
|
+
} %>
|
|
6
|
+
<% if creatable_templates.any? %>
|
|
5
7
|
<%= link_to spina.new_blocks_admin_block_path,
|
|
6
8
|
class: "btn btn-primary",
|
|
7
9
|
data: {turbo_frame: "modal"} do %>
|
|
@@ -18,7 +20,10 @@
|
|
|
18
20
|
<button type="button"
|
|
19
21
|
class="inline-flex items-center px-3 py-1.5 rounded-md text-sm font-medium bg-white border border-gray-300 text-gray-700 shadow-xs hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
|
20
22
|
data-action="reveal#toggle">
|
|
21
|
-
<% if @
|
|
23
|
+
<% if @current_filter == "layout" %>
|
|
24
|
+
<%= heroicon('lock-closed', style: :mini, class: 'h-4 w-4 mr-1.5 -ml-0.5 opacity-75') %>
|
|
25
|
+
<%= t('spina.blocks.layout_blocks') %>
|
|
26
|
+
<% elsif @current_block_template.present? %>
|
|
22
27
|
<% current_bt = @block_templates.find { |bt| bt[:name].to_s == @current_block_template } %>
|
|
23
28
|
<%= current_bt ? current_bt[:title] : @current_block_template %>
|
|
24
29
|
<% else %>
|
|
@@ -30,18 +35,33 @@
|
|
|
30
35
|
|
|
31
36
|
<div hidden data-reveal data-transition class="origin-top-left absolute left-0 mt-2 w-56 rounded-md shadow-lg border border-gray-200 z-30">
|
|
32
37
|
<div class="rounded-md bg-white shadow-xs py-1">
|
|
38
|
+
<%# "All" filter %>
|
|
39
|
+
<% all_active = @current_block_template.nil? && @current_filter.nil? %>
|
|
33
40
|
<%= link_to spina.blocks_admin_blocks_path,
|
|
34
|
-
class: "flex items-center px-4 py-2 text-sm font-medium leading-5 #{
|
|
41
|
+
class: "flex items-center px-4 py-2 text-sm font-medium leading-5 #{all_active ? 'text-blue-600 bg-blue-50' : 'text-gray-700 hover:bg-gray-100 hover:text-gray-900'}",
|
|
35
42
|
data: {action: "reveal#hide"} do %>
|
|
36
43
|
<%= heroicon('squares-2x2', class: 'h-4 w-4 mr-2 opacity-75') %>
|
|
37
44
|
<%= t('spina.blocks.all') %>
|
|
38
|
-
<% if
|
|
45
|
+
<% if all_active %>
|
|
46
|
+
<%= heroicon('check', style: :mini, class: 'w-4 h-4 ml-auto opacity-75') %>
|
|
47
|
+
<% end %>
|
|
48
|
+
<% end %>
|
|
49
|
+
|
|
50
|
+
<%# "Layout" filter %>
|
|
51
|
+
<% layout_active = @current_filter == "layout" %>
|
|
52
|
+
<%= link_to spina.blocks_admin_blocks_path(filter: "layout"),
|
|
53
|
+
class: "flex items-center px-4 py-2 text-sm font-medium leading-5 #{layout_active ? 'text-blue-600 bg-blue-50' : 'text-gray-700 hover:bg-gray-100 hover:text-gray-900'}",
|
|
54
|
+
data: {action: "reveal#hide"} do %>
|
|
55
|
+
<%= heroicon('lock-closed', style: :mini, class: 'h-4 w-4 mr-2 opacity-75') %>
|
|
56
|
+
<%= t('spina.blocks.layout_blocks') %>
|
|
57
|
+
<% if layout_active %>
|
|
39
58
|
<%= heroicon('check', style: :mini, class: 'w-4 h-4 ml-auto opacity-75') %>
|
|
40
59
|
<% end %>
|
|
41
60
|
<% end %>
|
|
42
61
|
|
|
43
62
|
<div class="border-t border-gray-100 my-1"></div>
|
|
44
63
|
|
|
64
|
+
<%# Template filters %>
|
|
45
65
|
<% @block_templates.each do |bt| %>
|
|
46
66
|
<% active = @current_block_template == bt[:name].to_s %>
|
|
47
67
|
<%= link_to spina.blocks_admin_blocks_path(block_template: bt[:name]),
|
|
@@ -84,6 +104,11 @@
|
|
|
84
104
|
</div>
|
|
85
105
|
<% end %>
|
|
86
106
|
</div>
|
|
107
|
+
<% unless block.deletable? %>
|
|
108
|
+
<div class="pr-4 shrink-0">
|
|
109
|
+
<span class="text-sm font-medium text-blue-500"><%= t('spina.blocks.layout_block') %></span>
|
|
110
|
+
</div>
|
|
111
|
+
<% end %>
|
|
87
112
|
</li>
|
|
88
113
|
<% end %>
|
|
89
114
|
</ul>
|
|
@@ -70,14 +70,20 @@
|
|
|
70
70
|
</div>
|
|
71
71
|
<% end %>
|
|
72
72
|
</div>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
<% if page_block.block.deletable? %>
|
|
74
|
+
<div class="pr-4">
|
|
75
|
+
<%= button_to spina.blocks_admin_page_page_block_path(page_id: @page.id, id: page_block.id),
|
|
76
|
+
method: :delete,
|
|
77
|
+
class: "text-gray-300 hover:text-red-500 transition-colors",
|
|
78
|
+
form: {data: {controller: "confirm", confirm_message: t('spina.page_blocks.remove_confirmation')}} do %>
|
|
79
|
+
<%= heroicon('x-mark', style: :mini, class: 'w-5 h-5') %>
|
|
80
|
+
<% end %>
|
|
81
|
+
</div>
|
|
82
|
+
<% else %>
|
|
83
|
+
<div class="pr-4">
|
|
84
|
+
<span class="text-sm font-medium text-blue-500"><%= t('spina.blocks.layout_block') %></span>
|
|
85
|
+
</div>
|
|
86
|
+
<% end %>
|
|
81
87
|
</li>
|
|
82
88
|
<% end %>
|
|
83
89
|
</ul>
|
data/config/locales/en.yml
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
en:
|
|
2
|
+
activerecord:
|
|
3
|
+
attributes:
|
|
4
|
+
spina/blocks/block:
|
|
5
|
+
key: "Key"
|
|
6
|
+
errors:
|
|
7
|
+
models:
|
|
8
|
+
spina/blocks/block:
|
|
9
|
+
attributes:
|
|
10
|
+
base:
|
|
11
|
+
undeletable: "This block is a layout block and cannot be deleted."
|
|
12
|
+
key:
|
|
13
|
+
immutable: "cannot be changed after creation"
|
|
2
14
|
spina:
|
|
3
15
|
blocks:
|
|
4
16
|
title: "Blocks"
|
|
@@ -10,6 +22,7 @@ en:
|
|
|
10
22
|
deleted: "Block deleted"
|
|
11
23
|
delete: "Delete block"
|
|
12
24
|
delete_confirmation: "Are you sure you want to delete this block?"
|
|
25
|
+
cannot_be_deleted: "Block can't be deleted"
|
|
13
26
|
couldnt_be_saved: "Block couldn't be saved"
|
|
14
27
|
sorting_saved: "Sorting saved"
|
|
15
28
|
content: "Content"
|
|
@@ -24,9 +37,17 @@ en:
|
|
|
24
37
|
inactive: "Inactive"
|
|
25
38
|
uncategorized: "Uncategorized"
|
|
26
39
|
active_description: "Inactive blocks are hidden from pages."
|
|
40
|
+
layout_block: "Layout"
|
|
41
|
+
layout_blocks: "Layout blocks"
|
|
42
|
+
custom_block_not_found: "Custom block not found. Run rake spina:bootstrap to create it."
|
|
27
43
|
block_categories:
|
|
28
44
|
saved: "Category saved"
|
|
29
45
|
couldnt_be_saved: "Category couldn't be saved"
|
|
46
|
+
content_blocks:
|
|
47
|
+
add_block: "Add block"
|
|
48
|
+
remove: "Remove"
|
|
49
|
+
empty: 'No content blocks yet. Click "Add block" to get started.'
|
|
50
|
+
no_template_found: "Unknown block type: %{type}"
|
|
30
51
|
page_blocks:
|
|
31
52
|
title: "Page Blocks"
|
|
32
53
|
add_block: "Add block"
|
|
@@ -34,6 +55,7 @@ en:
|
|
|
34
55
|
added: "Block added to page"
|
|
35
56
|
couldnt_be_added: "Block couldn't be added"
|
|
36
57
|
removed: "Block removed from page"
|
|
58
|
+
cannot_remove_layout_block: "This layout block cannot be removed from the page."
|
|
37
59
|
sorting_saved: "Sorting saved"
|
|
38
60
|
remove_confirmation: "Remove this block from the page?"
|
|
39
61
|
no_blocks_yet: "No blocks on this page yet. Add blocks from the library to build your page."
|
data/config/routes.rb
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class AddCustomBlockFieldsToSpinaBlocksBlocks < ActiveRecord::Migration[7.0]
|
|
4
|
+
def change
|
|
5
|
+
unless connection.column_exists?(:spina_blocks_blocks, :deletable)
|
|
6
|
+
add_column(:spina_blocks_blocks, :deletable, :boolean, default: true, null: false)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
unless connection.column_exists?(:spina_blocks_blocks, :key)
|
|
10
|
+
add_column(:spina_blocks_blocks, :key, :string)
|
|
11
|
+
add_index(:spina_blocks_blocks, :key, unique: true, where: "key IS NOT NULL")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
data/lib/spina/blocks/engine.rb
CHANGED
|
@@ -12,7 +12,7 @@ module Spina
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
::Spina::Theme.class_eval do
|
|
15
|
-
attr_accessor :block_templates, :block_categories
|
|
15
|
+
attr_accessor :block_templates, :block_categories, :custom_blocks, :content_block_templates
|
|
16
16
|
|
|
17
17
|
unless method_defined?(:initialize_without_blocks)
|
|
18
18
|
alias_method :initialize_without_blocks, :initialize
|
|
@@ -21,6 +21,8 @@ module Spina
|
|
|
21
21
|
initialize_without_blocks
|
|
22
22
|
@block_templates = []
|
|
23
23
|
@block_categories = []
|
|
24
|
+
@custom_blocks = []
|
|
25
|
+
@content_block_templates = []
|
|
24
26
|
end
|
|
25
27
|
end
|
|
26
28
|
end
|
|
@@ -31,11 +33,19 @@ module Spina
|
|
|
31
33
|
pin_all_from Spina::Blocks::Engine.root.join("app/assets/javascripts/spina/controllers"),
|
|
32
34
|
under: "controllers",
|
|
33
35
|
to: "spina/controllers"
|
|
36
|
+
pin_all_from Spina::Blocks::Engine.root.join("app/assets/javascripts/spina/utils"),
|
|
37
|
+
under: "spina/utils",
|
|
38
|
+
to: "spina/utils"
|
|
34
39
|
end
|
|
35
40
|
end
|
|
36
41
|
|
|
37
42
|
initializer "spina.blocks.assets.precompile" do |app|
|
|
38
|
-
app.config.assets.precompile += [
|
|
43
|
+
app.config.assets.precompile += %w[
|
|
44
|
+
spina/controllers/block_collection_controller.js
|
|
45
|
+
spina/controllers/content_blocks_controller.js
|
|
46
|
+
spina/controllers/nested_content_blocks_controller.js
|
|
47
|
+
spina/utils/dropdown_position.js
|
|
48
|
+
] if defined?(Sprockets)
|
|
39
49
|
end
|
|
40
50
|
|
|
41
51
|
initializer "spina.blocks.register_parts" do
|
|
@@ -43,6 +53,9 @@ module Spina
|
|
|
43
53
|
::Spina::Part.register(
|
|
44
54
|
Spina::Parts::BlockReference,
|
|
45
55
|
Spina::Parts::BlockCollection,
|
|
56
|
+
Spina::Parts::ContentBlocks,
|
|
57
|
+
Spina::Parts::ContentBlock,
|
|
58
|
+
Spina::Parts::NestedContentBlocks,
|
|
46
59
|
)
|
|
47
60
|
end
|
|
48
61
|
end
|
data/lib/spina/blocks/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spina-blocks
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Konstantin Kanashchuk
|
|
@@ -90,10 +90,14 @@ files:
|
|
|
90
90
|
- README.md
|
|
91
91
|
- Rakefile
|
|
92
92
|
- app/assets/javascripts/spina/controllers/block_collection_controller.js
|
|
93
|
+
- app/assets/javascripts/spina/controllers/content_blocks_controller.js
|
|
94
|
+
- app/assets/javascripts/spina/controllers/nested_content_blocks_controller.js
|
|
95
|
+
- app/assets/javascripts/spina/utils/dropdown_position.js
|
|
93
96
|
- app/controllers/spina/blocks/admin/blocks_controller.rb
|
|
94
97
|
- app/controllers/spina/blocks/admin/categories_controller.rb
|
|
95
98
|
- app/controllers/spina/blocks/admin/page_blocks_controller.rb
|
|
96
99
|
- app/helpers/spina/blocks/blocks_helper.rb
|
|
100
|
+
- app/models/concerns/spina/parts/block_filterable.rb
|
|
97
101
|
- app/models/spina/blocks/account_extension.rb
|
|
98
102
|
- app/models/spina/blocks/application_record.rb
|
|
99
103
|
- app/models/spina/blocks/block.rb
|
|
@@ -103,9 +107,15 @@ files:
|
|
|
103
107
|
- app/models/spina/blocks/search_extension.rb
|
|
104
108
|
- app/models/spina/parts/block_collection.rb
|
|
105
109
|
- app/models/spina/parts/block_reference.rb
|
|
110
|
+
- app/models/spina/parts/content_block.rb
|
|
111
|
+
- app/models/spina/parts/content_blocks.rb
|
|
112
|
+
- app/models/spina/parts/nested_content_blocks.rb
|
|
106
113
|
- app/views/spina/admin/hooks/blocks/_website_secondary_navigation.html.erb
|
|
107
114
|
- app/views/spina/admin/parts/block_collections/_form.html.erb
|
|
108
115
|
- app/views/spina/admin/parts/block_references/_form.html.erb
|
|
116
|
+
- app/views/spina/admin/parts/content_blocks/_fields.html.erb
|
|
117
|
+
- app/views/spina/admin/parts/content_blocks/_form.html.erb
|
|
118
|
+
- app/views/spina/admin/parts/nested_content_blocks/_form.html.erb
|
|
109
119
|
- app/views/spina/admin/pro/search/results/_block.html.erb
|
|
110
120
|
- app/views/spina/blocks/admin/blocks/_button_block_content.html.erb
|
|
111
121
|
- app/views/spina/blocks/admin/blocks/_button_block_settings.html.erb
|
|
@@ -114,6 +124,7 @@ files:
|
|
|
114
124
|
- app/views/spina/blocks/admin/blocks/_form_block_settings.html.erb
|
|
115
125
|
- app/views/spina/blocks/admin/blocks/_modal_form.html.erb
|
|
116
126
|
- app/views/spina/blocks/admin/blocks/_new_block_form.html.erb
|
|
127
|
+
- app/views/spina/blocks/admin/blocks/_new_block_modal_form.html.erb
|
|
117
128
|
- app/views/spina/blocks/admin/blocks/edit.html.erb
|
|
118
129
|
- app/views/spina/blocks/admin/blocks/edit_content.html.erb
|
|
119
130
|
- app/views/spina/blocks/admin/blocks/edit_modal.html.erb
|
|
@@ -126,6 +137,7 @@ files:
|
|
|
126
137
|
- db/migrate/2_create_spina_blocks_blocks.rb
|
|
127
138
|
- db/migrate/3_create_spina_blocks_page_blocks.rb
|
|
128
139
|
- db/migrate/5_rename_title_to_name_in_spina_blocks_blocks.rb
|
|
140
|
+
- db/migrate/6_add_custom_block_fields_to_spina_blocks_blocks.rb
|
|
129
141
|
- lib/generators/spina/blocks/install_generator.rb
|
|
130
142
|
- lib/spina-blocks.rb
|
|
131
143
|
- lib/spina/blocks/engine.rb
|