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

LEDE-2676 Add Second Address Line to Footer and Some Clean up #159

Merged
merged 4 commits into from
Jun 26, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contributors: alleyinteractive

Tags: alleyinteractive, wp-newsletter-builder

Stable tag: 0.3.30
Stable tag: 0.3.31

Requires at least: 6.2

Expand Down
7 changes: 6 additions & 1 deletion blocks/footer/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface FooterSettings {
youtube_url: string,
image: number,
address: string,
address_2: string,
}

/**
Expand All @@ -45,6 +46,7 @@ export default function Edit() {
const youtubeUrl = footerSettings?.youtube_url ?? '';
const imageId = footerSettings?.image ?? 0;
const address = footerSettings?.address ?? '';
const address2 = footerSettings?.address_2 ?? '';

useEffect(() => {
setIsLoading(true);
Expand Down Expand Up @@ -121,7 +123,10 @@ export default function Edit() {
? (
<div className="wp-block-wp-newsletter-builder-footer__address">
<span>{__('Our mailing address is:', 'wp-newsletter-builder')}</span>
{address}
<address>
<span>{address}</span>
{address2 ? (<span>{address2}</span>) : null}
</address>
</div>
)
: null}
Expand Down
8 changes: 7 additions & 1 deletion blocks/footer/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
$nb_youtube_url = $nb_footer_settings['youtube_url'] ?? '';
$nb_image_id = $nb_footer_settings['image'] ?? 0;
$nb_address = $nb_footer_settings['address'] ?? '';
$nb_address_2 = $nb_footer_settings['address_2'] ?? '';
$nb_has_social_links = ! empty( $nb_facebook_url ) || ! empty( $nb_twitter_url ) || ! empty( $nb_instagram_url ) || ! empty( $nb_youtube_url );

$plugin_url = plugins_url( 'wp-newsletter-builder' );
Expand Down Expand Up @@ -84,7 +85,12 @@
<?php if ( ! empty( $nb_address ) ) : ?>
<div class="wp-block-wp-newsletter-builder-footer__address">
<span><?php esc_html_e( 'Our mailing address is:', 'wp-newsletter-builder' ); ?></span>
<?php echo esc_html( $nb_address ); ?>
<address>
<span><?php echo esc_html( $nb_address ); ?></span>
<?php if ( ! empty( $nb_address_2 ) ) : ?>
<span><?php echo esc_html( $nb_address_2 ); ?></span>
<?php endif; ?>
</address>
</div>
<?php endif; ?>

Expand Down
12 changes: 11 additions & 1 deletion blocks/footer/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,21 @@
.wp-block-wp-newsletter-builder-footer__address {
margin-top: 20px;

span {
> span {
display: block;
font-weight: 700;
text-align: center;
}

address {
display: block;
font-style: normal;
text-align: center;

> span {
display: block;
};
}
}

.wp-block-wp-newsletter-builder-footer__links {
Expand Down
4 changes: 4 additions & 0 deletions blocks/header/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@
display: flex;
justify-content: center;
}

img {
margin: 0 auto;
}
}
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.30
* Version: 0.3.31
* Author: Alley Interactive
* Author URI: https://github.com/alleyinteractive/wp-newsletter-builder
* Requires at least: 6.2
Expand Down
10 changes: 9 additions & 1 deletion scss/core-blocks/latest-posts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
padding: 0;
width: 100%;

a {
color: currentColor;
display: block;
font-weight: bold;
margin-bottom: 8px;
text-decoration: none;
}

li {
border-bottom: 1px solid #ccc;
box-sizing: border-box;
Expand Down Expand Up @@ -82,7 +90,7 @@
}

img {
max-width: none;
max-width: 100%;
width: 100%;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/class-rest-api-endpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public function get_email_types(): WP_Error|array {
* youtube_url?: string,
* image?: int,
* address?: string,
* address_2?: string,
* }
*/
public function get_footer_settings(): WP_Error|false|array {
Expand Down
8 changes: 7 additions & 1 deletion src/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ public function register_fields(): void {
),
'address' => new \Fieldmanager_TextField(
[
'label' => __( 'Company Address', 'wp-newsletter-builder' ),
'label' => __( 'Company Address Line 1', 'wp-newsletter-builder' ),
]
),
'address_2' => new \Fieldmanager_TextField(
[
'label' => __( 'Company Address Line 2', 'wp-newsletter-builder' ),
]
),
],
Expand Down Expand Up @@ -160,6 +165,7 @@ public function get_lists(): mixed {
* youtube_url?: string,
* image?: int,
* address?: string,
* address_2?: string,
* }|false The footer settings.
*/
public function get_footer_settings(): array|false {
Expand Down