Skip to content

Commit

Permalink
Merge pull request #15 from clickpress/feature-gapsizes
Browse files Browse the repository at this point in the history
Add feature for gap sizes
  • Loading branch information
stefansl authored Nov 5, 2024
2 parents 83fc567 + cee957a commit efa83ef
Show file tree
Hide file tree
Showing 28 changed files with 503 additions and 195 deletions.
26 changes: 20 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@
"type": "contao-bundle",
"description": "Grid System for Contao based on CSS Grid",
"license": "LGPL-3.0-or-later",
"authors": [
{
"name": "Stefan Schulz-Lauterbach",
"homepage": "https://github.com/stefansl"
}
],
"authors": [
{
"name": "Stefan Schulz-Lauterbach",
"email": "[email protected]",
"homepage": "https://clickpress.de",
"role": "Developer"
},
{
"name": "Martin Auswöger",
"email": "[email protected]",
"homepage": "https://madeyourday.net",
"role": "Developer"
},
{
"name": "Jannik Nölke",
"email": "[email protected]",
"homepage": "https://plakart.net",
"role": "Developer"
}
],
"require": {
"php": "^8.1",
"contao/core-bundle": "^5.3"
Expand Down
4 changes: 3 additions & 1 deletion contao/config/config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of Contao Clickpress Grid.
*
Expand All @@ -9,7 +11,7 @@
* file that was distributed with this source code.
*/

/**
/*
* Taken with friendly permission from RockSolid Columns
*
* @author Martin Auswöger <[email protected]>
Expand Down
109 changes: 91 additions & 18 deletions contao/dca/tl_content.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
<?php

declare(strict_types=1);

/**
* ClickpressGrid DCA
* Partly taken with friendly permission from RockSolid Columns
*
* @author Martin Auswöger <[email protected]>
* @author Stefan Schulz-Lauterbach <[email protected]>
* ClickpressGrid DCA Partly taken with friendly permission from RockSolid Columns.
*/


$GLOBALS['TL_DCA']['tl_content']['palettes']['cp_grid_start'] = '{type_legend},type,headline;{cp_grid_legend},cp_grid_mobile,cp_grid_tablet,cp_grid_desktop,cp_grid_valign,cp_grid_halign;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID;{invisible_legend:hide},invisible,start,stop';
$GLOBALS['TL_DCA']['tl_content']['palettes']['cp_grid_start'] = '{type_legend},type,headline;{cp_grid_legend},cp_grid_mobile,cp_grid_tablet,cp_grid_desktop,cp_gap_mobile,cp_gap_tablet,cp_gap_desktop,cp_grid_valign,cp_grid_halign;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID;{invisible_legend:hide},invisible,start,stop';
$GLOBALS['TL_DCA']['tl_content']['palettes']['cp_grid_stop'] = '{type_legend},type;{protected_legend:hide},protected;{expert_legend:hide},guests;{invisible_legend:hide},invisible,start,stop';
$GLOBALS['TL_DCA']['tl_content']['palettes']['cp_column_start'] = '{type_legend},type,headline;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID;{invisible_legend:hide},invisible,start,stop';
$GLOBALS['TL_DCA']['tl_content']['palettes']['cp_column_stop'] = '{type_legend},type;{protected_legend:hide},protected;{expert_legend:hide},guests;{invisible_legend:hide},invisible,start,stop';
Expand Down Expand Up @@ -47,7 +43,6 @@
'sql' => "varchar(255) NOT NULL default ''",
];


$GLOBALS['TL_DCA']['tl_content']['fields']['cp_grid_tablet'] = [
'label' => &$GLOBALS['TL_LANG']['tl_content']['cp_grid_tablet'],
'inputType' => 'select',
Expand Down Expand Up @@ -77,7 +72,6 @@
'sql' => "varchar(255) NOT NULL default ''",
];


$GLOBALS['TL_DCA']['tl_content']['fields']['cp_grid_mobile'] = [
'label' => &$GLOBALS['TL_LANG']['tl_content']['cp_grid_mobile'],
'inputType' => 'select',
Expand All @@ -104,6 +98,85 @@
'sql' => "varchar(255) NOT NULL default ''",
];

$GLOBALS['TL_DCA']['tl_content']['fields']['cp_gap_mobile'] = [
'inputType' => 'select',
'reference' => &$GLOBALS['TL_LANG']['tl_content']['cp_gap_options'],
'default' => '',
'options' => [
'gap_0',
'gap_1',
'gap_2',
'gap_3',
'gap_4',
'gap_5',
'gap_6',
'gap_7',
'gap_8',
'gap_9',
'gap_10',
'gap_11',
'gap_12',
],
'eval' => [
'includeBlankOption' => true,
'blankOptionLabel' => '-',
'tl_class' => 'w33',
],
'sql' => "varchar(255) NOT NULL default ''",
];
$GLOBALS['TL_DCA']['tl_content']['fields']['cp_gap_tablet'] = [
'inputType' => 'select',
'default' => '',
'options' => [
'gap_0',
'gap_1',
'gap_2',
'gap_3',
'gap_4',
'gap_5',
'gap_6',
'gap_7',
'gap_8',
'gap_9',
'gap_10',
'gap_11',
'gap_12',
],
'reference' => &$GLOBALS['TL_LANG']['tl_content']['cp_gap_options'],
'eval' => [
'includeBlankOption' => true,
'blankOptionLabel' => '-',
'tl_class' => 'w33',
],
'sql' => "varchar(255) NOT NULL default ''",
];
$GLOBALS['TL_DCA']['tl_content']['fields']['cp_gap_desktop'] = [
'inputType' => 'select',
'default' => '',
'options' => [
'gap_0',
'gap_1',
'gap_2',
'gap_3',
'gap_4',
'gap_5',
'gap_6',
'gap_7',
'gap_8',
'gap_9',
'gap_10',
'gap_11',
'gap_12',
],
'reference' => &$GLOBALS['TL_LANG']['tl_content']['cp_gap_options'],
'eval' => [
'includeBlankOption' => true,
'blankOptionLabel' => '-',
'tl_class' => 'w33',
],
'sql' => "varchar(255) NOT NULL default ''",
];

$GLOBALS['TL_DCA']['tl_content']['fields']['cp_grid_valign'] = [
'inputType' => 'select',
'default' => false,
Expand All @@ -112,12 +185,12 @@
'items-center' => 'center',
'items-end' => 'bottom',
'items-stretch' => 'stretch',
'items-baseline' => 'baseline'
'items-baseline' => 'baseline',
],
'reference' => &$GLOBALS['TL_LANG']['tl_content']['cp_grid_valign_options'],
'eval' => [
'tl_class' => 'w50 m12',
'includeBlankOption' => true
'tl_class' => 'w50 m12 clr',
'includeBlankOption' => true,
],
'sql' => "varchar(255) NOT NULL default ''",
];
Expand All @@ -126,15 +199,15 @@
'inputType' => 'select',
'default' => false,
'options' => [
'justify-items-start'=>'left',
'justify-items-center'=>'center',
'justify-items-end'=>'right',
'justify-items-stretch'=>'stretch',
'justify-items-start' => 'left',
'justify-items-center' => 'center',
'justify-items-end' => 'right',
'justify-items-stretch' => 'stretch',
],
'reference' => &$GLOBALS['TL_LANG']['tl_content']['cp_grid_halign_options'],
'eval' => [
'tl_class' => 'w50 m12',
'includeBlankOption' => true
'includeBlankOption' => true,
],
'sql' => "varchar(255) NOT NULL default ''",
];
49 changes: 22 additions & 27 deletions contao/dca/tl_form_field.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
<?php

declare(strict_types=1);

/**
* ClickpressGrid DCA
* Partly taken with friendly permission from RockSolid Columns
*
* @author Martin Auswöger <[email protected]>
* @author Stefan Schulz-Lauterbach <[email protected]>
* @author Jannik Nölke <[email protected]>
* ClickpressGrid DCA Partly taken with friendly permission from RockSolid Columns.
*/

$GLOBALS['TL_DCA']['tl_form_field']['palettes']['cp_grid_start'] = '{type_legend},type;{form_cp_grid_legend},form_cp_grid_mobile,form_cp_grid_tablet,form_cp_grid_desktop;{expert_legend:hide},class;{invisible_legend:hide},invisible';
$GLOBALS['TL_DCA']['tl_form_field']['palettes']['cp_grid_stop'] = '{type_legend},type;{expert_legend:hide},class;{invisible_legend:hide},invisible';
$GLOBALS['TL_DCA']['tl_form_field']['palettes']['cp_column_start'] = '{type_legend},type,headline;{expert_legend:hide},class;{invisible_legend:hide},invisible';
$GLOBALS['TL_DCA']['tl_form_field']['palettes']['cp_column_stop'] = '{type_legend},type;{expert_legend:hide},class;{invisible_legend:hide},invisible';
$GLOBALS['TL_DCA']['tl_form_field']['fields']['form_cp_grid_desktop'] = array(
$GLOBALS['TL_DCA']['tl_form_field']['fields']['form_cp_grid_desktop'] = [
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['form_cp_grid_desktop'],
'inputType' => 'select',
'options' => array(
'options' => [
'grid_100',
'grid_50_50',
'grid_33_33_33',
Expand All @@ -38,19 +35,18 @@
'grid_20_40_20_20',
'grid_20_20_40_20',
'grid_20_20_20_40',
),
],
'reference' => &$GLOBALS['TL_LANG']['tl_form_field']['form_cp_grid_options'],
'eval' => array(
'eval' => [
'tl_class' => 'w33',
),
],
'sql' => "varchar(255) NOT NULL default ''",
);
];


$GLOBALS['TL_DCA']['tl_form_field']['fields']['form_cp_grid_tablet'] = array(
$GLOBALS['TL_DCA']['tl_form_field']['fields']['form_cp_grid_tablet'] = [
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['form_cp_grid_tablet'],
'inputType' => 'select',
'options' => array(
'options' => [
'grid_100',
'grid_50_50',
'grid_33_33_33',
Expand All @@ -68,19 +64,18 @@
'grid_20_40_40',
'grid_40_20_40',
'grid_40_40_20',
),
],
'reference' => &$GLOBALS['TL_LANG']['tl_form_field']['form_cp_grid_options'],
'eval' => array(
'eval' => [
'tl_class' => 'w33',
),
],
'sql' => "varchar(255) NOT NULL default ''",
);

];

$GLOBALS['TL_DCA']['tl_form_field']['fields']['form_cp_grid_mobile'] = array(
$GLOBALS['TL_DCA']['tl_form_field']['fields']['form_cp_grid_mobile'] = [
'label' => &$GLOBALS['TL_LANG']['tl_form_field']['form_cp_grid_mobile'],
'inputType' => 'select',
'options' => array(
'options' => [
'grid_100',
'grid_50_50',
'grid_33_33_33',
Expand All @@ -95,10 +90,10 @@
'grid_40_30_30',
'grid_30_40_30',
'grid_30_30_40',
),
],
'reference' => &$GLOBALS['TL_LANG']['tl_form_field']['form_cp_grid_options'],
'eval' => array(
'eval' => [
'tl_class' => 'w33',
),
],
'sql' => "varchar(255) NOT NULL default ''",
);
];
6 changes: 4 additions & 2 deletions contao/dca/tl_layout.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

declare(strict_types=1);

$GLOBALS['TL_DCA']['tl_layout']['palettes']['default'] .= ';{cp_grid_legend},cp_grid_load_css';

$GLOBALS['TL_DCA']['tl_layout']['fields']['cp_grid_load_css'] = array(
$GLOBALS['TL_DCA']['tl_layout']['fields']['cp_grid_load_css'] = [
'inputType' => 'checkbox',
'label' => &$GLOBALS['TL_LANG']['tl_layout']['cp_grid_load_css'],
'sql' => "char(1) NOT NULL default '1'",
);
];
2 changes: 2 additions & 0 deletions contao/languages/de/default.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

$GLOBALS['TL_LANG']['CTE']['cp_grid'] = 'Grid Spaltenset';
$GLOBALS['TL_LANG']['CTE']['cp_grid_start'][0] = 'Spaltenset Anfang';
$GLOBALS['TL_LANG']['CTE']['cp_grid_start'][1] = '';
Expand Down
26 changes: 24 additions & 2 deletions contao/languages/de/tl_content.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
<?php

declare(strict_types=1);

$GLOBALS['TL_LANG']['tl_content']['cp_grid_valign'] = ['Vertikale Ausrichtung', 'Position der Elemente auf der Y-Achse'];
$GLOBALS['TL_LANG']['tl_content']['cp_grid_halign'] = ['Horizontale Ausrichtung', 'Position der Elemente auf der X-Achse'];

$GLOBALS['TL_LANG']['tl_content']['cp_grid_desktop'] = ['Desktop', 'Spaltenanzahl in der Desktopansicht'];
$GLOBALS['TL_LANG']['tl_content']['cp_grid_tablet'] = ['Tablet', 'Spaltenanzahl in der Tabletansicht'];
$GLOBALS['TL_LANG']['tl_content']['cp_grid_mobile'] = ['Mobile', 'Spaltenanzahl in der Mobilansicht'];
$GLOBALS['TL_LANG']['tl_content']['cp_grid_mobile'] = ['Mobil', 'Spaltenanzahl in der Mobilansicht'];

$GLOBALS['TL_LANG']['tl_content']['cp_gap_desktop'] = ['Spalten-Abstand Desktop', 'Spalten-Abstand in der Desktopansicht in rem (1rem entspricht meistens 16px)'];
$GLOBALS['TL_LANG']['tl_content']['cp_gap_tablet'] = ['Spalten-Abstand Tablet', 'Spalten-Abstand in der Tabletansicht in rem (1rem entspricht meistens 16px)'];
$GLOBALS['TL_LANG']['tl_content']['cp_gap_mobile'] = ['Spalten-Abstand Mobil', 'Spalten-Abstand in der Mobilansicht in rem (1rem entspricht meistens 16px)'];

// References
$GLOBALS['TL_LANG']['tl_content']['cp_grid_valign_options'] = [
'top' => 'oben',
'center' => 'zentriert',
'bottom' => 'unten',
'stretch' => 'strecken',
'baseline' => 'Grundlinie'
'baseline' => 'Grundlinie',
];

$GLOBALS['TL_LANG']['tl_content']['cp_grid_halign_options'] = [
Expand Down Expand Up @@ -48,5 +54,21 @@
'grid_20_20_20_40' => '4 Spalten - aufgeteilt in 20% 20% 20% 40%',
];

$GLOBALS['TL_LANG']['tl_content']['cp_gap_options'] = [
'gap_0' => 'kein Abstand',
'gap_1' => '1',
'gap_2' => '2',
'gap_3' => '3',
'gap_4' => '4',
'gap_5' => '5',
'gap_6' => '6',
'gap_7' => '7',
'gap_8' => '8',
'gap_9' => '9',
'gap_10' => '10',
'gap_11' => '11',
'gap_12' => '12',
];

// Legend
$GLOBALS['TL_LANG']['tl_content']['cp_grid_legend'] = 'Spalten-Konfiguration';
3 changes: 3 additions & 0 deletions contao/languages/de/tl_form_field.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

$GLOBALS['TL_LANG']['tl_form_field']['form_cp_grid_desktop'] = ['Desktop', 'Spaltenanzahl in der Desktopansicht'];
$GLOBALS['TL_LANG']['tl_form_field']['form_cp_grid_tablet'] = ['Tablet', 'Spaltenanzahl in der Tabletansicht'];
$GLOBALS['TL_LANG']['tl_form_field']['form_cp_grid_mobile'] = ['Mobile', 'Spaltenanzahl in der Mobilansicht'];
Expand Down
3 changes: 3 additions & 0 deletions contao/languages/de/tl_layout.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

// Legends
$GLOBALS['TL_LANG']['tl_layout']['cp_grid_legend'] = 'Clickpress Grid CSS';

Expand Down
2 changes: 2 additions & 0 deletions contao/languages/en/default.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

$GLOBALS['TL_LANG']['CTE']['cp_grid'] = 'Grid Columnset';
$GLOBALS['TL_LANG']['CTE']['cp_grid_start'][0] = 'Gridset start';
$GLOBALS['TL_LANG']['CTE']['cp_grid_start'][1] = '';
Expand Down
Loading

0 comments on commit efa83ef

Please sign in to comment.