File tree 7 files changed +134
-24
lines changed
7 files changed +134
-24
lines changed Original file line number Diff line number Diff line change 27
27
></button >
28
28
{% - endcapture -%}
29
29
30
+ {% - 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
+
43
+ <div class =" settings-options" >
44
+ <div class =" settings-checkbox" >
45
+ <label >
46
+ <input
47
+ type =" checkbox"
48
+ class =" js-settings-checkbox"
49
+ data-key =" { { id } } "
50
+ data-setting =" page_height"
51
+ {% if page_height %}
52
+ checked
53
+ {% endif %}
54
+ />
55
+
56
+ { { " page_height" | lce } }
57
+ </label >
58
+ </div >
59
+
60
+ {% if layout_name == " column" -%}
61
+ <div class =" settings-checkbox" >
62
+ <label >
63
+ <input
64
+ type =" checkbox"
65
+ class =" js-settings-checkbox"
66
+ data-key =" { { id } } "
67
+ data-setting =" full_width"
68
+ {% if full_width %}
69
+ checked
70
+ {% endif %}
71
+ />
72
+
73
+ { { " full_width" | lce } }
74
+ </label >
75
+ </div >
76
+ {% endif -%}
77
+ </div >
78
+
79
+ {% assign page_height = null %}
80
+ {% assign full_width = null %}
81
+ {% - endcapture -%}
82
+
30
83
{% - capture change_layout_options -%}
31
84
{% - if allowed_layouts.size > 1 -%}
32
85
<div class =" change-layout-options" data-title =" { { ' change_content_layout' | lce } } " >
74
127
{ { move_buttons } }
75
128
{ { delete_button } }
76
129
{ { change_layout_options } }
130
+ { { settings_options } }
77
131
</div >
78
132
{% - endif %}
79
133
Original file line number Diff line number Diff line change 397
397
} ) ;
398
398
} ;
399
399
400
+ const bindBlockSettingsButton = ( { bodyBlocks, dataKey} ) => {
401
+ $ ( '.js-settings-checkbox' ) . on ( 'change' , e => {
402
+ const targetKey = e . target . dataset . key ;
403
+ const settingKey = e . target . dataset . setting ;
404
+ const currentBlock = bodyBlocks . find ( block => String ( block . key ) === String ( targetKey ) ) ;
405
+
406
+ currentBlock . settings = currentBlock . settings || { } ;
407
+ currentBlock . settings [ settingKey ] = e . target . checked ;
408
+
409
+ pageData . set ( dataKey , bodyBlocks ) ;
410
+ } ) ;
411
+ } ;
412
+
400
413
const bindBlockActions = ( { bodyBlocks, dataKey, deleteConfirmation} ) => {
401
414
$ ( document ) . ready ( ( ) => {
402
415
bindBlockAdd ( { bodyBlocks, dataKey} ) ;
403
416
bindBlockDelete ( { bodyBlocks, dataKey, deleteConfirmation} ) ;
404
417
bindBlockReorder ( { bodyBlocks, dataKey} ) ;
405
418
bindBlockLayoutChange ( { bodyBlocks, dataKey} ) ;
419
+ bindBlockSettingsButton ( { bodyBlocks, dataKey} ) ;
406
420
} ) ;
407
421
} ;
408
422
Original file line number Diff line number Diff line change 393
393
} ) ;
394
394
} ;
395
395
396
+ const bindBlockSettingsButton = ( { bodyBlocks, dataKey} ) => {
397
+ $ ( '.js-settings-checkbox' ) . on ( 'change' , e => {
398
+ const targetKey = e . target . dataset . key ;
399
+ const settingKey = e . target . dataset . setting ;
400
+ const currentBlock = bodyBlocks . find ( block => String ( block . key ) === String ( targetKey ) ) ;
401
+
402
+ currentBlock . settings = currentBlock . settings || { } ;
403
+ currentBlock . settings [ settingKey ] = e . target . checked ;
404
+
405
+ pageData . set ( dataKey , bodyBlocks ) ;
406
+ } ) ;
407
+ } ;
408
+
396
409
const bindBlockActions = ( { bodyBlocks, dataKey, deleteConfirmation} ) => {
397
410
$ ( document ) . ready ( ( ) => {
398
411
bindBlockAdd ( { bodyBlocks, dataKey} ) ;
399
412
bindBlockDelete ( { bodyBlocks, dataKey, deleteConfirmation} ) ;
400
413
bindBlockReorder ( { bodyBlocks, dataKey} ) ;
401
414
bindBlockLayoutChange ( { bodyBlocks, dataKey} ) ;
415
+ bindBlockSettingsButton ( { bodyBlocks, dataKey} ) ;
402
416
} ) ;
403
417
} ;
404
418
Original file line number Diff line number Diff line change 26
26
> * {
27
27
display : block ;
28
28
29
- & :after {
30
- content : attr (data-title );
31
- opacity : 0 ;
32
- transition : opacity .3s ease-in-out ;
33
- padding : 8px ;
34
- width : max-content ;
35
- position : absolute ;
36
- top : -32px ;
37
- background : $black ;
38
- color : $white ;
39
- font-size : 12px ;
40
- font-weight : $normal-weight ;
41
- border-radius : 4px ;
42
- font-family : var (--font-family );
43
- pointer-events : none ;
44
- }
29
+ & [data-title ] {
30
+ & :after {
31
+ content : attr (data-title );
32
+ opacity : 0 ;
33
+ transition : opacity .3s ease-in-out ;
34
+ padding : 8px ;
35
+ width : max-content ;
36
+ position : absolute ;
37
+ top : -32px ;
38
+ background : $black ;
39
+ color : $white ;
40
+ font-size : 12px ;
41
+ font-weight : $normal-weight ;
42
+ border-radius : 4px ;
43
+ font-family : var (--font-family );
44
+ pointer-events : none ;
45
+ }
45
46
46
- & :hover :after {
47
- opacity : 1 ;
47
+ & :hover :after {
48
+ opacity : 1 ;
49
+ }
48
50
}
49
51
}
50
52
327
329
right : 24px ;
328
330
}
329
331
332
+ .settings-button {
333
+ position : absolute ;
334
+ bottom : 24px ;
335
+ right : 24px ;
336
+ }
337
+
330
338
.change-layout-options {
331
339
position : absolute ;
332
340
left : 50% ;
346
354
}
347
355
}
348
356
357
+ .settings-options {
358
+ position : absolute ;
359
+ left : 50% ;
360
+ transform : translateX (-50% );
361
+ top : 64px ;
362
+ }
363
+
349
364
@media (max-width : $desktop-width ) {
350
365
.block {
351
366
& .split_40_60 ,
Original file line number Diff line number Diff line change 29
29
.category-blocks : hover > .block-edit-buttons > * {
30
30
display : block;
31
31
}
32
- .block-wrapper : hover > .block-edit-buttons > * : after ,
33
- .category-blocks : hover > .block-edit-buttons > * : after {
32
+ .block-wrapper : hover > .block-edit-buttons > * [ data-title ] : after ,
33
+ .category-blocks : hover > .block-edit-buttons > * [ data-title ] : after {
34
34
content : attr (data-title);
35
35
opacity : 0 ;
36
36
transition : opacity 0.3s ease-in-out;
47
47
font-family : var (--font-family );
48
48
pointer-events : none;
49
49
}
50
- .block-wrapper : hover > .block-edit-buttons > * : hover : after ,
51
- .category-blocks : hover > .block-edit-buttons > * : hover : after {
50
+ .block-wrapper : hover > .block-edit-buttons > * [ data-title ] : hover : after ,
51
+ .category-blocks : hover > .block-edit-buttons > * [ data-title ] : hover : after {
52
52
opacity : 1 ;
53
53
}
54
54
.block-wrapper : hover > .block-edit-buttons .up-button : after ,
275
275
right : 24px ;
276
276
}
277
277
278
+ .settings-button {
279
+ position : absolute;
280
+ bottom : 24px ;
281
+ right : 24px ;
282
+ }
283
+
278
284
.change-layout-options {
279
285
position : absolute;
280
286
left : 50% ;
292
298
opacity : 0.7 ;
293
299
}
294
300
301
+ .settings-options {
302
+ position : absolute;
303
+ left : 50% ;
304
+ transform : translateX (-50% );
305
+ top : 64px ;
306
+ }
307
+
295
308
@media (max-width : 1440px ) {
296
309
.block .split_40_60 .wrapper , .block .split_staggered .wrapper , .block .split_60_40 .wrapper {
297
310
width : calc (100vw - 128px );
You can’t perform that action at this time.
0 commit comments