-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨(plugins) added grid columns and gutter option to section plugin
The plugin 'section' now has grid options to apply grid column rules to its children contents. The grid define the column sizes rules and a gutter. Also this bring two new Makefile tasks to help with pending migrations.
- Loading branch information
Showing
15 changed files
with
221 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Basic CSS grid | ||
|
||
// Define CSS grid rules for content | ||
@mixin m-o-grid($grid-sizes, $grid-gutters) { | ||
// CSS grid definition | ||
&__grid { | ||
display: grid; | ||
grid-template-columns: 100%; | ||
|
||
// Neutralize and adapt some rules that for content items that can define some | ||
// rules which conflict with expected section grid behaviors | ||
& > * { | ||
min-width: auto !important; | ||
max-width: none !important; | ||
} | ||
|
||
// Adjust button caesura | ||
& > .button-caesura { | ||
display: block; | ||
} | ||
|
||
// Enable column size only for large screen and up | ||
@include media-breakpoint-up(lg) { | ||
@each $key, $value in $r-section-grid-sizes { | ||
&--#{$key} { | ||
grid-template-columns: $value; | ||
} | ||
} | ||
} | ||
|
||
// Variants with a gutter between content items | ||
&--with-gutter { | ||
@if map-get($r-section-grid-gutters, 'sm') { | ||
column-gap: map-get($r-section-grid-gutters, 'sm'); | ||
row-gap: map-get($r-section-grid-gutters, 'sm'); | ||
} | ||
@each $key, $value in $r-section-grid-gutters { | ||
@include media-breakpoint-up($key) { | ||
column-gap: $value; | ||
row-gap: $value; | ||
} | ||
} | ||
|
||
// Disable contents margin in profit of grid gutter | ||
& > * { | ||
margin: 0 !important; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,4 +31,6 @@ class Meta: | |
"title", | ||
"template", | ||
"attributes", | ||
"grid_columns", | ||
"grid_gutter", | ||
} |
52 changes: 52 additions & 0 deletions
52
src/richie/plugins/section/migrations/0007_add_section_grid_columns_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Generated by Django 4.2.16 on 2024-10-11 21:01 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
from ..defaults import SECTION_GRID_COLUMNS | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("cms", "0022_auto_20180620_1551"), | ||
("section", "0006_add_attributes_field"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="section", | ||
name="grid_columns", | ||
field=models.CharField( | ||
blank=True, | ||
choices=SECTION_GRID_COLUMNS, | ||
default="", | ||
help_text="Define a Grid to use for contents, when no Grid is enable each content can define its own width.", | ||
max_length=50, | ||
verbose_name="Grid", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="section", | ||
name="grid_gutter", | ||
field=models.BooleanField( | ||
blank=True, | ||
default=True, | ||
help_text="Enable a gutter between content items when Grid is enabled.", | ||
verbose_name="Grid gutter", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="section", | ||
name="cmsplugin_ptr", | ||
field=models.OneToOneField( | ||
auto_created=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
parent_link=True, | ||
primary_key=True, | ||
related_name="%(app_label)s_%(class)s", | ||
serialize=False, | ||
to="cms.cmsplugin", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters