Skip to content

Commit

Permalink
Merge pull request #126 from alleyinteractive/feature/LEDE-2615/wp-cl…
Browse files Browse the repository at this point in the history
…eanup

LEDE-2612 Additional WordPress clean up
  • Loading branch information
cahdeemer authored May 24, 2024
2 parents 95ecd04 + f9e7c03 commit 31f55d4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 65 deletions.
8 changes: 1 addition & 7 deletions blocks/post/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
*/
import { useBlockProps, InspectorControls, InnerBlocks } from '@wordpress/block-editor';

import PostPickerResult from '@/components/postPickerResult';
/**
* Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
* Those files can contain any CSS code that gets applied to the editor.
Expand Down Expand Up @@ -78,9 +77,6 @@ export default function Edit({
[],
);

const cutoff = new Date();
cutoff.setMonth(cutoff.getMonth() - 3);

// TODO: Pass template and allowed blocks from PHP so they can be filtered.
const MY_TEMPLATE = [
['wp-newsletter-builder/post-featured-image', {}],
Expand Down Expand Up @@ -121,11 +117,9 @@ export default function Edit({
onUpdate={handleSelect}
allowedTypes={allowedPostTypes}
onReset={() => handleSelect(0)}
params={{ after: cutoff.toISOString(), per_page: 20 }}
params={{ per_page: 20 }}
title={__('Please select a post', 'wp-newsletter-builder')}
value={postId}
// @ts-ignore
searchRender={PostPickerResult}
/>
</div>
) : null}
Expand Down
4 changes: 4 additions & 0 deletions blocks/post/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,8 @@
table {
width: 100%;
}

li {
font-size: 16px;
}
}
1 change: 0 additions & 1 deletion components/postPickerResult/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.alley-scripts-post-picker__post-list .alley-scripts-post-picker__post {
height: auto;
padding: 0 5px 0 0;
width: 99%;
}

.nb-post-picker-result {
Expand Down
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Newsletter Builder
* Plugin URI: https://github.com/alleyinteractive/wp-newsletter-builder
* Description: Interface to manage email newsletters
* Version: 0.3.12
* Version: 0.3.13
* Author: Alley Interactive
* Author URI: https://github.com/alleyinteractive/wp-newsletter-builder
* Requires at least: 6.2
Expand Down
3 changes: 2 additions & 1 deletion scss/core-blocks/list.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
li {
font-family: Geogria, serif;
font-family: Georgia, serif;
font-size: 16px;
}
60 changes: 5 additions & 55 deletions src/class-email-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function register_fields(): void {
[
'name' => static::SETTINGS_KEY,
'children' => [
'uuid4' => new class() extends \Fieldmanager_Hidden {
'uuid4' => new class() extends \Fieldmanager_Hidden {
/**
* Ensure that each group has a unique ID.
*
Expand All @@ -64,14 +64,14 @@ public function presave( $value, $current_value = [] ) {
return $current_value ?: wp_generate_uuid4();

Check failure on line 64 in src/class-email-types.php

View workflow job for this annotation

GitHub Actions / phpstan / phpstan PHP 8.2

Method class@anonymous/src/class-email-types.php:55::presave() should return array<string> but returns array<string>|string.
}
},
'label' => new \Fieldmanager_TextField( __( 'Label', 'wp-newsletter-builder' ) ),
'image' => new \Fieldmanager_Media(
'label' => new \Fieldmanager_TextField( __( 'Label', 'wp-newsletter-builder' ) ),
'image' => new \Fieldmanager_Media(
[
'label' => __( 'Image', 'wp-newsletter-builder' ),
'preview_size' => 'full',
]
),
'templates' => new \Fieldmanager_Checkboxes(
'templates' => new \Fieldmanager_Checkboxes(
'Checkboxes',
[
'datasource' => new \Fieldmanager_Datasource_Post(
Expand All @@ -86,62 +86,12 @@ public function presave( $value, $current_value = [] ) {
),
]
),
'from_name' => new \Fieldmanager_Select(
'from_name' => new \Fieldmanager_Select(
__( 'From Name', 'wp-newsletter-builder' ),
[
'options' => $from_names,
]
),
'safe_rtb' => new \Fieldmanager_TextArea(
[
'label' => __( 'SafeRTB Ad Tag', 'wp-newsletter-builder' ),
'sanitize' => function ( $value ) {
return $value;
},
],
),
'ad_tags' => new \Fieldmanager_Group(
[
'label' => __( 'Tags', 'wp-newsletter-builder' ),
'children' => [
'tag_code' => new \Fieldmanager_TextArea(
[
'label' => __( 'Ad Tag', 'wp-newsletter-builder' ),
'sanitize' => function ( $value ) {
return $value;
},
],
),
],
'limit' => 0,
'add_more_label' => __( 'Add another tag', 'wp-newsletter-builder' ),
]
),
'roadblock' => new \Fieldmanager_Checkbox(
[
'label' => __( 'Enable Ad Roadblock', 'wp-newsletter-builder' ),
]
),
'key_values' => new \Fieldmanager_Group(
[
'label' => __( 'Key/Value Pairs', 'wp-newsletter-builder' ),
'children' => [
'key' => new \Fieldmanager_TextField(
[
'label' => __( 'Key', 'wp-newsletter-builder' ),
]
),
'value' => new \Fieldmanager_TextField(
[
'label' => __( 'Value', 'wp-newsletter-builder' ),
]
),
],
'limit' => 0,
'add_more_label' => __( 'Add another key/value pair', 'wp-newsletter-builder' ),
'one_label_per_item' => false,
]
),
],
'limit' => 0,
'add_more_label' => __( 'Add Another Email Type', 'wp-newsletter-builder' ),
Expand Down

0 comments on commit 31f55d4

Please sign in to comment.