Skip to content

Commit

Permalink
Improve Tables buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
kagg-design committed Jul 29, 2023
1 parent 72fe350 commit 1323656
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 86 deletions.
8 changes: 8 additions & 0 deletions assets/css/tables.css
Expand Up @@ -10,6 +10,12 @@
border-radius: 4px;
}

#ctl-options.ctl-tables h2.nav-tab {
padding: 5px;
white-space: pre-line;
overflow-wrap: break-word;
}

#ctl-options .form-table th {
display: none;
}
Expand Down Expand Up @@ -118,6 +124,8 @@ td fieldset .ctl-table-cell label {
border: 1px solid transparent;
vertical-align: middle;
box-sizing: border-box;
overflow: hidden;
word-break: break-all;
}

.ctl-table-cell input {
Expand Down
52 changes: 14 additions & 38 deletions src/php/Settings/Tables.php
Expand Up @@ -84,42 +84,18 @@ protected function init_locales() {
}

$this->locales = [
'iso9' => [
'label' => __( 'ISO9 Table', 'cyr2lat' ),
],
'bel' => [
'label' => __( 'bel Table', 'cyr2lat' ),
],
'uk' => [
'label' => __( 'uk Table', 'cyr2lat' ),
],
'bg_BG' => [
'label' => __( 'bg_BG Table', 'cyr2lat' ),
],
'mk_MK' => [
'label' => __( 'mk_MK Table', 'cyr2lat' ),
],
'sr_RS' => [
'label' => __( 'sr_RS Table', 'cyr2lat' ),
],
'el' => [
'label' => __( 'el Table', 'cyr2lat' ),
],
'hy' => [
'label' => __( 'hy Table', 'cyr2lat' ),
],
'ka_GE' => [
'label' => __( 'ka_GE Table', 'cyr2lat' ),
],
'kk' => [
'label' => __( 'kk Table', 'cyr2lat' ),
],
'he_IL' => [
'label' => __( 'he_IL Table', 'cyr2lat' ),
],
'zh_CN' => [
'label' => __( 'zh_CN Table', 'cyr2lat' ),
],
'iso9' => __( 'Default', 'cyr2lat' ) . '<br>ISO9',
'bel' => __( 'Belarusian', 'cyr2lat' ) . '<br>bel',
'uk' => __( 'Ukrainian', 'cyr2lat' ) . '<br>uk',
'bg_BG' => __( 'Bulgarian', 'cyr2lat' ) . '<br>bg_BG',
'mk_MK' => __( 'Macedonian', 'cyr2lat' ) . '<br>mk_MK',
'sr_RS' => __( 'Serbian', 'cyr2lat' ) . '<br>sr_RS',
'el' => __( 'Greek', 'cyr2lat' ) . '<br>el',
'hy' => __( 'Armenian', 'cyr2lat' ) . '<br>hy',
'ka_GE' => __( 'Georgian', 'cyr2lat' ) . '<br>ka_GE',
'kk' => __( 'Kazakh', 'cyr2lat' ) . '<br>kk',
'he_IL' => __( 'Hebrew', 'cyr2lat' ) . '<br>he_IL',
'zh_CN' => __( 'Chinese (China)', 'cyr2lat' ) . '<br>zh_CN',
];
}

Expand All @@ -143,10 +119,10 @@ public function init_form_fields() {
$current_locale = $this->get_current_locale();

foreach ( $this->locales as $locale => $info ) {
$current = ( $locale === $current_locale ) ? '<br>' . __( '(current)', 'cyr2lat' ) : '';
$info = ( $locale === $current_locale ) ? $info . '<br>' . __( '(current)', 'cyr2lat' ) : $info;

$this->form_fields[ $locale ] = [
'title' => $info['label'] . $current,
'title' => $info,
'section' => $locale . '_section',
'type' => 'table',
'placeholder' => '',
Expand Down
72 changes: 24 additions & 48 deletions tests/unit/Settings/TablesTest.php
Expand Up @@ -161,42 +161,18 @@ public function test_init_locales() {
$method->invoke( $subject );

$expected = [
'iso9' => [
'label' => __( 'ISO9 Table', 'cyr2lat' ),
],
'bel' => [
'label' => __( 'bel Table', 'cyr2lat' ),
],
'uk' => [
'label' => __( 'uk Table', 'cyr2lat' ),
],
'bg_BG' => [
'label' => __( 'bg_BG Table', 'cyr2lat' ),
],
'mk_MK' => [
'label' => __( 'mk_MK Table', 'cyr2lat' ),
],
'sr_RS' => [
'label' => __( 'sr_RS Table', 'cyr2lat' ),
],
'el' => [
'label' => __( 'el Table', 'cyr2lat' ),
],
'hy' => [
'label' => __( 'hy Table', 'cyr2lat' ),
],
'ka_GE' => [
'label' => __( 'ka_GE Table', 'cyr2lat' ),
],
'kk' => [
'label' => __( 'kk Table', 'cyr2lat' ),
],
'he_IL' => [
'label' => __( 'he_IL Table', 'cyr2lat' ),
],
'zh_CN' => [
'label' => __( 'zh_CN Table', 'cyr2lat' ),
],
'iso9' => 'Default<br>ISO9',
'bel' => 'Belarusian<br>bel',
'uk' => 'Ukrainian<br>uk',
'bg_BG' => 'Bulgarian<br>bg_BG',
'mk_MK' => 'Macedonian<br>mk_MK',
'sr_RS' => 'Serbian<br>sr_RS',
'el' => 'Greek<br>el',
'hy' => 'Armenian<br>hy',
'ka_GE' => 'Georgian<br>ka_GE',
'kk' => 'Kazakh<br>kk',
'he_IL' => 'Hebrew<br>he_IL',
'zh_CN' => 'Chinese (China)<br>zh_CN',
];

self::assertSame( $expected, $this->get_protected_property( $subject, 'locales' ) );
Expand Down Expand Up @@ -252,7 +228,7 @@ static function ( $locale = '' ) {
$expected = [
'iso9' =>
[
'title' => 'ISO9 Table<br>(current)',
'title' => 'Default<br>ISO9<br>(current)',
'section' => 'iso9_section',
'type' => 'table',
'placeholder' => '',
Expand All @@ -265,7 +241,7 @@ static function ( $locale = '' ) {
],
'bel' =>
[
'title' => 'bel Table',
'title' => 'Belarusian<br>bel',
'section' => 'bel_section',
'type' => 'table',
'placeholder' => '',
Expand All @@ -278,7 +254,7 @@ static function ( $locale = '' ) {
],
'uk' =>
[
'title' => 'uk Table',
'title' => 'Ukrainian<br>uk',
'section' => 'uk_section',
'type' => 'table',
'placeholder' => '',
Expand All @@ -291,7 +267,7 @@ static function ( $locale = '' ) {
],
'bg_BG' =>
[
'title' => 'bg_BG Table',
'title' => 'Bulgarian<br>bg_BG',
'section' => 'bg_BG_section',
'type' => 'table',
'placeholder' => '',
Expand All @@ -304,7 +280,7 @@ static function ( $locale = '' ) {
],
'mk_MK' =>
[
'title' => 'mk_MK Table',
'title' => 'Macedonian<br>mk_MK',
'section' => 'mk_MK_section',
'type' => 'table',
'placeholder' => '',
Expand All @@ -317,7 +293,7 @@ static function ( $locale = '' ) {
],
'sr_RS' =>
[
'title' => 'sr_RS Table',
'title' => 'Serbian<br>sr_RS',
'section' => 'sr_RS_section',
'type' => 'table',
'placeholder' => '',
Expand All @@ -330,7 +306,7 @@ static function ( $locale = '' ) {
],
'el' =>
[
'title' => 'el Table',
'title' => 'Greek<br>el',
'section' => 'el_section',
'type' => 'table',
'placeholder' => '',
Expand All @@ -343,7 +319,7 @@ static function ( $locale = '' ) {
],
'hy' =>
[
'title' => 'hy Table',
'title' => 'Armenian<br>hy',
'section' => 'hy_section',
'type' => 'table',
'placeholder' => '',
Expand All @@ -356,7 +332,7 @@ static function ( $locale = '' ) {
],
'ka_GE' =>
[
'title' => 'ka_GE Table',
'title' => 'Georgian<br>ka_GE',
'section' => 'ka_GE_section',
'type' => 'table',
'placeholder' => '',
Expand All @@ -369,7 +345,7 @@ static function ( $locale = '' ) {
],
'kk' =>
[
'title' => 'kk Table',
'title' => 'Kazakh<br>kk',
'section' => 'kk_section',
'type' => 'table',
'placeholder' => '',
Expand All @@ -382,7 +358,7 @@ static function ( $locale = '' ) {
],
'he_IL' =>
[
'title' => 'he_IL Table',
'title' => 'Hebrew<br>he_IL',
'section' => 'he_IL_section',
'type' => 'table',
'placeholder' => '',
Expand All @@ -395,7 +371,7 @@ static function ( $locale = '' ) {
],
'zh_CN' =>
[
'title' => 'zh_CN Table',
'title' => 'Chinese (China)<br>zh_CN',
'section' => 'zh_CN_section',
'type' => 'table',
'placeholder' => '',
Expand Down

0 comments on commit 1323656

Please sign in to comment.