Skip to content

Commit bda3561

Browse files
committed
Make new block settings buttons functional
1 parent 5c71f8c commit bda3561

File tree

8 files changed

+75
-29
lines changed

8 files changed

+75
-29
lines changed

components/block-structure.tpl

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@
5858
{{ background_key }}-picker-area
5959
js-background-type
6060
{{ bg_type }}
61-
{% if content_class -%}{{ content_class }}{%- endif -%}
62-
{% if animated -%}animated js-animated-block{%- endif -%}
61+
{% if page_height %}page-height{% endif %}
62+
{% if full_width %}full-width{% endif %}
63+
{% if content_class -%}{{ content_class }}{%- endif %}
64+
{% if animated -%}animated js-animated-block{%- endif %}
6365
"
6466
data-block-key="{{ id }}"
6567
>

components/block.tpl

+20-19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
{%- assign id = block_data.key -%}
22
{%- assign content_area_count = layout_data.content_areas | default: 1 -%}
33

4+
{% assign page_height = block_data.settings.page_height %}
5+
6+
{% if page_height == null %}
7+
{% assign page_height = true %}
8+
{% endif %}
9+
10+
{% assign full_width = block_data.settings.full_width %}
11+
12+
{% if full_width == null %}
13+
{% assign full_width = false %}
14+
{% endif %}
15+
416
{%- capture move_buttons -%}
517
<button
618
class="move-button up-button js-move-button"
@@ -28,18 +40,6 @@
2840
{%- endcapture -%}
2941

3042
{%- capture settings_options -%}
31-
{% assign page_height = block_data.settings.page_height %}
32-
33-
{% if page_height == blank %}
34-
{% assign page_height = true %}
35-
{% endif %}
36-
37-
{% assign full_width = block_data.settings.full_width %}
38-
39-
{% if full_width == blank %}
40-
{% assign full_width = false %}
41-
{% endif %}
42-
4343
<div class="settings-options">
4444
<div class="settings-checkbox">
4545
<label>
@@ -53,7 +53,7 @@
5353
{% endif %}
5454
/>
5555

56-
{{ "page_height" | lce }}
56+
{{ "full_height" | lce }}
5757
</label>
5858
</div>
5959

@@ -70,14 +70,11 @@
7070
{% endif %}
7171
/>
7272

73-
{{ "full_width" | lce }}
73+
{{ "max_width" | lce }}
7474
</label>
7575
</div>
7676
{% endif -%}
7777
</div>
78-
79-
{% assign page_height = null %}
80-
{% assign full_width = null %}
8178
{%- endcapture -%}
8279

8380
{%- capture change_layout_options -%}
@@ -151,7 +148,9 @@
151148
content_class: content_class,
152149
id: id,
153150
layout_name: layout_name,
154-
separate_bg_pickers: layout_data.separate_bg_pickers
151+
separate_bg_pickers: layout_data.separate_bg_pickers,
152+
full_width: full_width,
153+
page_height: page_height
155154
-%}
156155
{% endfor %}
157156
{%- else -%}
@@ -171,7 +170,9 @@
171170
content_class: content_class,
172171
id: id,
173172
layout_name: layout_name,
174-
separate_bg_pickers: layout_data.separate_bg_pickers
173+
separate_bg_pickers: layout_data.separate_bg_pickers,
174+
full_width: full_width,
175+
page_height: page_height
175176
%}
176177
{% endif %}
177178
</div>

javascripts/editmode.js

+6
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,16 @@
403403
const settingKey = e.target.dataset.setting;
404404
const currentBlock = bodyBlocks.find(block => String(block.key) === String(targetKey));
405405

406+
const $currentBlockElement = $(`[data-block-key="${targetKey}"]`);
407+
406408
currentBlock.settings = currentBlock.settings || {};
407409
currentBlock.settings[settingKey] = e.target.checked;
408410

409411
pageData.set(dataKey, bodyBlocks);
412+
413+
$currentBlockElement.find('.block').each((_, block) => {
414+
$(block).toggleClass(settingKey.replace(/_/g, '-'), e.target.checked);
415+
});
410416
});
411417
};
412418

javascripts/editmode.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sources/javascripts/editmode.js

+6
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,16 @@
399399
const settingKey = e.target.dataset.setting;
400400
const currentBlock = bodyBlocks.find(block => String(block.key) === String(targetKey));
401401

402+
const $currentBlockElement = $(`[data-block-key="${targetKey}"]`);
403+
402404
currentBlock.settings = currentBlock.settings || {};
403405
currentBlock.settings[settingKey] = e.target.checked;
404406

405407
pageData.set(dataKey, bodyBlocks);
408+
409+
$currentBlockElement.find('.block').each((_, block) => {
410+
$(block).toggleClass(settingKey.replace(/_/g, '-'), e.target.checked);
411+
})
406412
});
407413
};
408414

sources/stylesheets/components/_block.scss

+23-4
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,13 @@
8585
}
8686

8787
.block {
88-
min-height: calc(100vh - 128px);
8988
padding: 64px;
9089
position: relative;
9190

91+
&.page-height {
92+
min-height: calc(100vh - 128px);
93+
}
94+
9295
.voog-bg-picker-btn {
9396
top: 64px;
9497
left: 64px;
@@ -157,6 +160,12 @@
157160
width: 100%;
158161
}
159162

163+
&.full-width {
164+
.wrapper {
165+
max-width: 100%;
166+
}
167+
}
168+
160169
.publicmode & {
161170
&.animated {
162171
overflow: hidden;
@@ -247,7 +256,10 @@
247256

248257
&.split_50_50_full {
249258
padding: 0;
250-
min-height: calc(100vh - var(--header-height));
259+
260+
&.page-height {
261+
min-height: calc(100vh - var(--header-height));
262+
}
251263

252264
.wrapper {
253265
display: flex;
@@ -358,7 +370,11 @@
358370
position: absolute;
359371
left: 50%;
360372
transform: translateX(-50%);
361-
top: 64px;
373+
bottom: 24px;
374+
375+
.settings-checkbox {
376+
display: inline-block;
377+
}
362378
}
363379

364380
@media (max-width: $desktop-width) {
@@ -376,7 +392,10 @@
376392
@media screen and (max-width: $mobile-width) {
377393
.block {
378394
padding: 24px;
379-
min-height: calc(100vh - 48px);
395+
396+
&.page-height {
397+
min-height: calc(100vh - 48px);
398+
}
380399

381400
&.split_40_60,
382401
&.split_staggered,

stylesheets/main.css

+14-2
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,12 @@
7878
}
7979

8080
.block {
81-
min-height: calc(100vh - 128px);
8281
padding: 64px;
8382
position: relative;
8483
}
84+
.block.page-height {
85+
min-height: calc(100vh - 128px);
86+
}
8587
.block .voog-bg-picker-btn {
8688
top: 64px;
8789
left: 64px;
@@ -134,6 +136,9 @@
134136
z-index: 3;
135137
width: 100%;
136138
}
139+
.block.column.full-width .wrapper {
140+
max-width: 100%;
141+
}
137142
.publicmode .block.column.animated {
138143
overflow: hidden;
139144
}
@@ -196,6 +201,8 @@
196201
}
197202
.block.split_50_50_full {
198203
padding: 0;
204+
}
205+
.block.split_50_50_full.page-height {
199206
min-height: calc(100vh - var(--header-height));
200207
}
201208
.block.split_50_50_full .wrapper {
@@ -302,7 +309,10 @@
302309
position: absolute;
303310
left: 50%;
304311
transform: translateX(-50%);
305-
top: 64px;
312+
bottom: 24px;
313+
}
314+
.settings-options .settings-checkbox {
315+
display: inline-block;
306316
}
307317

308318
@media (max-width: 1440px) {
@@ -313,6 +323,8 @@
313323
@media screen and (max-width: 640px) {
314324
.block {
315325
padding: 24px;
326+
}
327+
.block.page-height {
316328
min-height: calc(100vh - 48px);
317329
}
318330
.block.split_40_60 .wrapper, .block.split_staggered .wrapper, .block.split_60_40 .wrapper {

stylesheets/main.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)