Skip to content

Commit

Permalink
Merge pull request #43 from mrwweb/develop
Browse files Browse the repository at this point in the history
Develop merged 1.5.0
  • Loading branch information
AaronRutley committed May 15, 2017
2 parents 0cb26f3 + 592d7b9 commit 92d9476
Show file tree
Hide file tree
Showing 9 changed files with 303 additions and 316 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
/.DS_Store
24 changes: 7 additions & 17 deletions acf_repeater_collapser.php
@@ -1,15 +1,15 @@
<?php
/**
* Plugin Name: Advanced Custom Fields Repeater Collapser
* Plugin Name: Advanced Custom Fields: Repeater Collapser
* Plugin URI: https://github.com/mrwweb/ACF-Repeater-Collapser
* Description: Provides a way to collapse and expand repeater field instances in order to enable better sorting.
* Version: 1.4.3
* Author: Mark Root-Wiley
* Author URI: http://mrwweb.com
* Version: 1.5.0
* Author: Aaron Rutley
* Author URI: https://hookturn.io
* Text Domain: advanced-custom-field-repeater-collapser
*/

define( 'ACF_REPEATER_COLLAPSER_VERSION', '1.4.3' );
define( 'ACF_REPEATER_COLLAPSER_VERSION', '1.5.0' );

/**
* load text domain
Expand Down Expand Up @@ -47,6 +47,8 @@ function acf_repeater_collapser_assets() {
'collapseRow' => esc_html__( 'Collapse Row', 'advanced-custom-field-repeater-collapser' ),
'expandRows' => esc_html__( 'Expand All Rows', 'advanced-custom-field-repeater-collapser' ),
'expandRow' => esc_html__( 'Expand Row', 'advanced-custom-field-repeater-collapser' ),
'expandAll' => esc_html__( 'Expand All', 'advanced-custom-field-repeater-collapser' ),
'collapseAll' => esc_html__( 'Collapse All', 'advanced-custom-field-repeater-collapser' ),
) );

wp_enqueue_style(
Expand All @@ -56,15 +58,3 @@ function acf_repeater_collapser_assets() {
$version
);
}

add_action( 'plugins_loaded', 'acf_repeater_collapser_acf5_compat' );
function acf_repeater_collapser_acf5_compat() {
if( ! class_exists( 'acf' ) ) {
return;
}

$acf_version = acf()->settings['version'];
if( version_compare( $acf_version, '5.0', '>=' ) ) {
add_filter( 'acf/compatibility/field_wrapper_class', '__return_true' );
}
}
96 changes: 91 additions & 5 deletions css/acf4_repeater_collapser_admin.css
Expand Up @@ -36,23 +36,54 @@
background: #fff;
}

.field-repeater-toggle::before {
content: "\f506";
.button.field-repeater-toggle-single {
display: inline;
-webkit-font-smoothing: antialiased;
font: normal 20px/1 'dashicons';
vertical-align: text-bottom;
color: #777;
background: url(../images/icon--collapse.svg);
background-size: 10px;
width: 20px;
height: 20px;
background-repeat: no-repeat;
background-position: center center;
box-shadow: none;
border:1px solid #d1d1d1;
}

.button.field-repeater-toggle-single:focus {
background: url(../images/icon--collapse.svg) center center no-repeat #FFF;
background-size: 10px;
box-shadow: none;
border:1px solid #d1d1d1;
}
.field-repeater-toggle-all::before {
margin: 3px 5px 0 0;
}
.button.field-repeater-toggle-single:hover {
border:1px solid #d1d1d1;
background: url(../images/icon--collapse.svg) center center no-repeat #FFF;
background-size: 10px;
}

.layout.collapsed-row .button.field-repeater-toggle-single,
.row.collapsed-row .button.field-repeater-toggle-single {
background: url(../images/icon--expand.svg) center center no-repeat;
background-size: 10px;
}

.collapsed-repeater .field-repeater-toggle-all::before,
.collapsed-row .field-repeater-toggle-single::before {
content: "\f211";
.layout.collapsed-row .button.field-repeater-toggle-single:hover,
.row.collapsed-row .button.field-repeater-toggle-single:hover {
border:1px solid #d1d1d1;
background: url(../images/icon--expand.svg) center center no-repeat #FFF;
background-size: 10px;
}





.acf_flexible_content,
.repeater {
clear: both;
Expand Down Expand Up @@ -82,3 +113,58 @@
background: -webkit-linear-gradient( rgba( 244, 244, 244, .2 ), rgba( 244, 244, 244, 1 ) );
background: linear-gradient( rgba( 244, 244, 244, .2 ), rgba( 244, 244, 244, 1 ) );
}

/* 2017 button styles */
.button.field-repeater-toggle-all {
box-sizing: border-box;
position: relative;
border:1px solid #d1d1d1;
background:#FFF;
color:#e5e5e5;
float:right;
font-weight:normal;
color:#6a6f74;
padding:1px 10px 1px 30px;
text-align: right;
min-width: 114px;
transition: all 100ms ease-in-out;
background-color: rgba(249, 249, 249, 0.50);
user-select: none;
box-shadow: none;
}

.button.field-repeater-toggle-all:before {
position: absolute;
top:0;
left:3px;
content: "";
background: url(../images/icon--collapse.svg);
background-size: 10px;
width: 20px;
height: 20px;
background-repeat: no-repeat;
background-position: center center;
}

.button.field-repeater-toggle-all.collapse:hover {
border:1px solid #d1d1d1;
background-color: #FFF;
color:#b0a9a8;
}

.button.field-repeater-toggle-all:focus {
outline: none;
box-shadow: none;
border:1px solid #d1d1d1;
color:#6a6f74;
}

div.field_type-flexible_content.collapsed-repeater .button.field-repeater-toggle-all:before,
div.field_type-repeater.collapsed-repeater .button.field-repeater-toggle-all:before {
background: url(../images/icon--expand.svg);
background-size: 10px;
width: 20px;
height: 20px;
background-repeat: no-repeat;
background-position: center center;
}
139 changes: 63 additions & 76 deletions css/acf5_repeater_collapser_admin.css
@@ -1,92 +1,79 @@
/* Expand / Collapse Buttons */
.field-repeater-toggle-all {
float:right;
margin: -5px 0 15px !important;
}

.button.field-repeater-toggle-single {
padding: 1px 1px 0 1px;
}
.layout .field-repeater-toggle-single {
margin: 0 5px 0 -5px;
}
.repeater-button-cell {
background: #f9f9f9 !important;
padding: 0 !important;
vertical-align: middle !important;
text-align: center !important;
border-right-color: #e1e1e1 !important;
width: 30px !important;
/* Sorry 'bout the !importants. They are gross. Sadly, so are the ACF selectors I have to battle. */
}
/* Grossness: http://css-tricks.com/absolutely-position-element-within-a-table-cell/ */
.repeater-button-cell-div {
position: relative;
.collapse {
box-sizing: border-box;
position: absolute;
top:15px;
right:12px;
border:1px solid #d1d1d1;
background:#FFF;
font-weight:normal;
color:#6a6f74;
padding:1px 10px 1px 30px;
text-align: right;
min-width: 114px;
transition: all 100ms ease-in-out;
background-color: rgba(249, 249, 249, 0.50);
user-select: none;
}
.collapse:hover {
border:1px solid #6a6f74;
background-color: #FFF;
cursor: pointer;
}
.collapse:focus {
background-color: #FFF;
box-shadow: none;
outline:none;
}
.collapse:before {
position: absolute;
top:0;
left:3px;
content: "";
background: url(../images/icon--collapse.svg);
background-size: 10px;
width: 20px;
height: 20px;
background-repeat: no-repeat;
background-position: center center;
}

.field_type-flexible_content .layout.row-layout {
padding-left: 30px;
background: transparent;
}
.collapse--active {

.field_type-flexible_content .field-repeater-toggle-single {
position: absolute;
top: 50%;
margin-top: -15px;
left: 5px;
}
/* Weird positioning exception */
.field_type-flexible_content .field_type-repeater .field-repeater-toggle-single {
left: 8px;
.collapse--active:before {
background: url(../images/icon--expand.svg);
background-size: 10px;
width: 20px;
height: 20px;
background-repeat: no-repeat;
background-position: center center;
}

.field_type-flexible_content .acf-fc-layout-handle {
background: #fff;
.flexi-label {
font-style: italic;
padding-left: 5px;
font-size: 12px;
color:#999;
}

.field-repeater-toggle::before {
content: "\f506";
display: inline;
-webkit-font-smoothing: antialiased;
font: normal 20px/1 'dashicons';
vertical-align: text-bottom;
color: #777;
}
.field-repeater-toggle-all::before {
margin: 3px 5px 0 0;
}

.collapsed-repeater .field-repeater-toggle-all::before,
.collapsed-row .field-repeater-toggle-single::before {
content: "\f211";
}

.acf_flexible_content,
.repeater {
clear: both;
}
/*.acf-flexible-content .layout .acf-fc-layout-handle:hover {
background: #f9f9f9;
}*/

.acf-table {
position: relative;
.acf-flexible-content .layout .acf-fc-layout-handle {
background: rgba(249, 249, 249, 0.50);
}
/*.acf-flexible-content .layout .acf-fc-layout-handle:hover .acf-fc-layout-order,
.acf-flexible-content .layout.-collapsed .acf-fc-layout-order {
background: #FFF;
}*/

.collapsed-row .acf-table tr {
display: none;
}

.collapsed-row .acf-table tr:first-child {
display: table-row;
}

/* "Masks" the first field in order to prevent clicking on it */
.collapsed-row .acf-table tr::after {
position: absolute;
top: 0; bottom: 0; left: 0px; right: 0;
display: block;
content: ' ';
background: -webkit-gradient(linear, left top, left bottom, from(rgba( 244, 244, 244, .2 )), to(rgba( 244, 244, 244, 1 )));
background: -o-linear-gradient( rgba( 244, 244, 244, .2 ), rgba( 244, 244, 244, 1 ) );
background: -moz-linear-gradient( rgba( 244, 244, 244, .2 ), rgba( 244, 244, 244, 1 ) );
background: -webkit-linear-gradient( rgba( 244, 244, 244, .2 ), rgba( 244, 244, 244, 1 ) );
background: linear-gradient( rgba( 244, 244, 244, .2 ), rgba( 244, 244, 244, 1 ) );
.acf-fields.-left .collapse{
position: relative;
left:0;
top:0;
}
Binary file added images/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions images/icon--collapse.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/icon--expand.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 92d9476

Please sign in to comment.