Skip to content

Commit

Permalink
Merge pull request #323 from codepress/release/4.3.2
Browse files Browse the repository at this point in the history
Release/4.3.2
  • Loading branch information
DGStefan authored Jun 18, 2021
2 parents 8f79fee + 7850ce7 commit f9ff430
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 13 deletions.
2 changes: 1 addition & 1 deletion assets/js/admin-page-columns.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/table.js

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions classes/Column/Media/Album.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace AC\Column\Media;

/**
* @since 4.3.2
*/
class Album extends Meta {

public function __construct() {
parent::__construct();

$this->set_type( 'column-meta_album' );
$this->set_label( __( 'Album', 'codepress-admin-columns' ) );
}

protected function get_sub_key() {
return 'album';
}

public function get_value( $id ) {
$meta = $this->get_raw_value( $id );

return empty( $meta[ $this->get_sub_key() ] )
? $this->get_empty_char()
: $meta[ $this->get_sub_key() ];
}

}
29 changes: 29 additions & 0 deletions classes/Column/Media/Artist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace AC\Column\Media;

/**
* @since 4.3.2
*/
class Artist extends Meta {

public function __construct() {
parent::__construct();

$this->set_type( 'column-meta_artist' );
$this->set_label( __( 'Artist', 'codepress-admin-columns' ) );
}

protected function get_sub_key() {
return 'artist';
}

public function get_value( $id ) {
$meta = $this->get_raw_value( $id );

return empty( $meta[ $this->get_sub_key() ] )
? $this->get_empty_char()
: $meta[ $this->get_sub_key() ];
}

}
4 changes: 2 additions & 2 deletions classes/Form/Element/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public function render() {
return false;
}

$template = '<div class="%s-labels %s">%s</div>';
$template = '<div class="%s">%s</div>';

return sprintf( $template, $this->get_type(), implode( ' ', $this->get_classes() ), implode( "\n", $elements ) );
return sprintf( $template, implode( ' ', $this->get_classes() ), implode( "\n", $elements ) );
}

private function get_elements() {
Expand Down
2 changes: 2 additions & 0 deletions classes/Table/Screen.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,13 +462,15 @@ public function screen_options( $html ) {

<fieldset class='acp-screen-option-prefs'>
<legend><?= __( 'Admin Columns', 'codepress-admin-columns' ); ?></legend>
<div class="acp-so-container">
<?php

foreach ( $this->screen_options as $option ) {
echo $option->render();
}

?>
</div>
</fieldset>

<?php
Expand Down
4 changes: 2 additions & 2 deletions codepress-admin-columns.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: Admin Columns
Version: 4.3.1
Version: 4.3.2
Description: Customize columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
Author: AdminColumns.com
Author URI: https://www.admincolumns.com
Expand Down Expand Up @@ -36,7 +36,7 @@
}

define( 'AC_FILE', __FILE__ );
define( 'AC_VERSION', '4.3.1' );
define( 'AC_VERSION', '4.3.2' );

require_once __DIR__ . '/classes/Dependencies.php';

Expand Down
Binary file modified languages/codepress-admin-columns-pl_PL.mo
Binary file not shown.
6 changes: 3 additions & 3 deletions languages/codepress-admin-columns-pl_PL.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is distributed under the same license as the Plugins - Admin Columns - Stable (latest release) package.
msgid ""
msgstr ""
"PO-Revision-Date: 2018-11-13 17:50:42+0000\n"
"PO-Revision-Date: 2021-06-14 13:45:04+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -1599,7 +1599,7 @@ msgstr "szerokość"
#: classes/Settings/Column/CustomFieldType.php:173
#: classes/Settings/Column/Image.php:112 classes/ColumnGroups.php:16
msgid "Custom"
msgstr "Własne"
msgstr "Własny"

#: classes/Settings/Column/DateTimeFormat.php:62
msgid "This will determine how the date will be displayed."
Expand Down Expand Up @@ -1633,7 +1633,7 @@ msgstr "Zarejestrowany"
#: classes/Settings/Column/CustomFieldType.php:101
#: classes/ListScreenGroups.php:13
msgid "Post Type"
msgstr "Typ wpisu"
msgstr "Typ treści"

#: classes/Column/User/PostCount.php:15
msgid "Post Count"
Expand Down
8 changes: 8 additions & 0 deletions languages/codepress-admin-columns.pot
Original file line number Diff line number Diff line change
Expand Up @@ -956,10 +956,18 @@ msgstr ""
msgid "Word Count"
msgstr ""

#: classes/Column/Media/Album.php:14
msgid "Album"
msgstr ""

#: classes/Column/Media/AlternateText.php:14
msgid "Alternative Text"
msgstr ""

#: classes/Column/Media/Artist.php:14
msgid "Artist"
msgstr ""

#: classes/Column/Media/AvailableSizes.php:17
msgid "Available Sizes"
msgstr ""
Expand Down
10 changes: 8 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Contributors: codepress, tschutter, davidmosterd, engelen, dungengronovius
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZDZRSYLQ4Z76J
Tags: plugins, wordpress, admin, column, columns, custom columns, custom fields, image, dashboard, sortable, filters, posts, media, users, pages, posttypes, manage columns, wp-admin
Requires at least: 4.7.1
Tested up to: 5.7
Tested up to: 5.7.2
Requires PHP: 5.6.20
Stable tag: 4.3.1
Stable tag: 4.3.2

Customise columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.

Expand Down Expand Up @@ -209,6 +209,12 @@ You can find a list of the available actions and filters (and examples on how to

== Changelog ==

= 4.3.2 =
Release Date: June 18th, 2021

* [Added] Added Media columns: Artist and Album
* [Fixed] Column date setting gave an error when the default date format was empty

= 4.3.1 =
Release Date: June 11th, 2021

Expand Down
4 changes: 3 additions & 1 deletion src/js/admin/columns/settings/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ class DateSetting {
this.column = column;
this.setting = setting;
this.options = this.setting.querySelectorAll('.radio-labels input[type=radio]');
this.defaultFormat = this.setting.querySelector('.radio-labels code').textContent;
this.valueInput = this.setting.querySelector('[data-value-input]');

let defaultElement = this.setting.querySelector('.radio-labels code');
this.defaultFormat = defaultElement ? defaultElement.textContent : 'Y-m-d';

// @ts-ignore
let customInput = [...this.options].filter(radio => typeof radio.dataset.custom !== 'undefined');

Expand Down
5 changes: 5 additions & 0 deletions src/js/helpers/html-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ export default class AcHtmlElement {
return this;
}

Css( property: any, value: any){
this.element.style[property] = value;
return this;
}

}
2 changes: 1 addition & 1 deletion src/js/table/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class Actions {

let reference = document.querySelectorAll<HTMLElement>('.tablenav.top .actions');

if (reference) {
if (reference && reference.length) {
insertAfter(this.container, reference[reference.length - 1])
this.container.classList.add('-init');
this.container.dispatchEvent(new CustomEvent('update'));
Expand Down

0 comments on commit f9ff430

Please sign in to comment.