Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add four-column support in PDFs #561

Merged
merged 1 commit into from Dec 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/helper/Helper_Field_Container.php
Expand Up @@ -71,11 +71,15 @@ class Helper_Field_Container {
* @since 4.0
*/
private $class_map = [
'gf_left_half' => 50,
'gf_right_half' => 50,
'gf_left_third' => 33.3,
'gf_middle_third' => 33.3,
'gf_right_third' => 33.3,
'gf_left_half' => 50,
'gf_right_half' => 50,
'gf_left_third' => 33.3,
'gf_middle_third' => 33.3,
'gf_right_third' => 33.3,
'gf_first_quarter' => 25,
'gf_second_quarter' => 25,
'gf_third_quarter' => 25,
'gf_fourth_quarter' => 25,
];

/**
Expand Down
14 changes: 12 additions & 2 deletions src/templates/blank-slate.php
Expand Up @@ -43,12 +43,14 @@

.gf_left_half,
.gf_left_third, .gf_middle_third,
.gf_first_quarter, .gf_second_quarter, .gf_third_quarter,
.gf_list_2col li, .gf_list_3col li, .gf_list_4col li, .gf_list_5col li {
float: left;
}

.gf_right_half,
.gf_right_third {
.gf_right_third,
.gf_fourth_quarter {
float: right;
}

Expand All @@ -62,6 +64,10 @@
width: 32.3%;
}

.gf_first_quarter, .gf_second_quarter, .gf_third_quarter, .gf_fourth_quarter {
width: 24%;
}

.gf_list_4col li {
width: 24%;
}
Expand All @@ -78,7 +84,11 @@
padding-right: 1.505%;
}

.gf_right_half, .gf_right_third {
.gf_first_quarter, .gf_second_quarter, .gf_third_quarter, .gf_fourth_quarter {
padding-right: 1.333%;
}

.gf_right_half, .gf_right_third, .gf_fourth_quarter {
padding-right: 0;
}

Expand Down
15 changes: 13 additions & 2 deletions src/templates/focus-gravity.php
Expand Up @@ -50,16 +50,19 @@
/* Handle Gravity Forms CSS Ready Classes */
.row-separator {
clear: both;
padding: 1.25mm 0;
}

.gf_left_half,
.gf_left_third, .gf_middle_third,
.gf_first_quarter, .gf_second_quarter, .gf_third_quarter,
.gf_list_2col li, .gf_list_3col li, .gf_list_4col li, .gf_list_5col li {
float: left;
}

.gf_right_half,
.gf_right_third {
.gf_right_third,
.gf_fourth_quarter {
float: right;
}

Expand All @@ -73,6 +76,10 @@
width: 32.3%;
}

.gf_first_quarter, .gf_second_quarter, .gf_third_quarter, .gf_fourth_quarter {
width: 24%;
}

.gf_list_4col li {
width: 24%;
}
Expand All @@ -89,7 +96,11 @@
padding-right: 1.505%;
}

.gf_right_half, .gf_right_third {
.gf_first_quarter, .gf_second_quarter, .gf_third_quarter, .gf_fourth_quarter {
padding-right: 1.333%;
}

.gf_right_half, .gf_right_third, .gf_fourth_quarter {
padding-right: 0;
}

Expand Down
15 changes: 13 additions & 2 deletions src/templates/rubix.php
Expand Up @@ -47,16 +47,19 @@
/* Handle Gravity Forms CSS Ready Classes */
.row-separator {
clear: both;
padding: 1.25mm 0;
}

.gf_left_half,
.gf_left_third, .gf_middle_third,
.gf_first_quarter, .gf_second_quarter, .gf_third_quarter,
.gf_list_2col li, .gf_list_3col li, .gf_list_4col li, .gf_list_5col li {
float: left;
}

.gf_right_half,
.gf_right_third {
.gf_right_third,
.gf_fourth_quarter {
float: right;
}

Expand All @@ -70,6 +73,10 @@
width: 32.3%;
}

.gf_first_quarter, .gf_second_quarter, .gf_third_quarter, .gf_fourth_quarter {
width: 24%;
}

.gf_list_4col li {
width: 24%;
}
Expand All @@ -86,7 +93,11 @@
padding-right: 1.505%;
}

.gf_right_half, .gf_right_third {
.gf_first_quarter, .gf_second_quarter, .gf_third_quarter, .gf_fourth_quarter {
padding-right: 1.333%;
}

.gf_right_half, .gf_right_third, .gf_fourth_quarter {
padding-right: 0;
}

Expand Down
14 changes: 12 additions & 2 deletions src/templates/zadani.php
Expand Up @@ -48,12 +48,14 @@

.gf_left_half,
.gf_left_third, .gf_middle_third,
.gf_first_quarter, .gf_second_quarter, .gf_third_quarter,
.gf_list_2col li, .gf_list_3col li, .gf_list_4col li, .gf_list_5col li {
float: left;
}

.gf_right_half,
.gf_right_third {
.gf_right_third,
.gf_fourth_quarter {
float: right;
}

Expand All @@ -67,6 +69,10 @@
width: 32.3%;
}

.gf_first_quarter, .gf_second_quarter, .gf_third_quarter, .gf_fourth_quarter {
width: 24%;
}

.gf_list_4col li {
width: 24%;
}
Expand All @@ -83,7 +89,11 @@
padding-right: 1.505%;
}

.gf_right_half, .gf_right_third {
.gf_first_quarter, .gf_second_quarter, .gf_third_quarter, .gf_fourth_quarter {
padding-right: 1.333%;
}

.gf_right_half, .gf_right_third, .gf_fourth_quarter {
padding-right: 0;
}

Expand Down
38 changes: 38 additions & 0 deletions tests/phpunit/unit-tests/test-field-container.php
Expand Up @@ -191,6 +191,44 @@ public function test_three_columns() {
$this->assertEquals( '</div>', $this->close() );
}

/**
* Check that four-columns give the correct output
*
* @since 4.1
*/
public function test_four_columns() {

$field = new GF_Field();
$field->cssClass = 'gf_first_quarter';

/* Check it opens correctly */
$this->assertEquals( '<div class="row-separator odd">', $this->generate( $field ) );

$field = new GF_Field();
$field->cssClass = 'gf_second_quarter';

/* Check it does nothing */
$this->assertEquals( '', $this->generate( $field ) );

$field = new GF_Field();
$field->cssClass = 'gf_third_quarter';

/* Check it does nothing */
$this->assertEquals( '', $this->generate( $field ) );

$field = new GF_Field();
$field->cssClass = 'gf_fourth_quarter';

/* Check it does nothing */
$this->assertEquals( '', $this->generate( $field ) );

/* Check the row closes / opens new row correctly */
$this->assertEquals( '</div><div class="row-separator even">', $this->generate( $field ) );

/* Check it now closes correctly */
$this->assertEquals( '</div>', $this->close() );
}

/**
* Check that two and three column layouts can intermingle
*
Expand Down