Skip to content

Commit

Permalink
refactor: replace give-addon with ADDON_TEXTDOMAIN
Browse files Browse the repository at this point in the history
  • Loading branch information
glaubersilva committed Apr 12, 2024
1 parent 56ac8f3 commit 534bb7f
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 22 deletions.
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/FormExtension/FormBuilder/ViewModels/GiveAddonViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public function exports(): array
];

$sampleTags = [
['tag' => 'sitename', 'desc' => __('Site Name', 'give-addon-receipts')],
['tag' => 'today', 'desc' => __('Date of Receipt Generation', 'give-addon-receipts')],
['tag' => 'date', 'desc' => __('Receipt Date', 'give-addon-receipts')],
['tag' => 'sitename', 'desc' => __('Site Name', 'ADDON_TEXTDOMAIN-receipts')],
['tag' => 'today', 'desc' => __('Date of Receipt Generation', 'ADDON_TEXTDOMAIN-receipts')],
['tag' => 'date', 'desc' => __('Receipt Date', 'ADDON_TEXTDOMAIN-receipts')],
];

return [
'colors' => $colorsArray,
'colorSettingsUrl' => esc_url_raw(admin_url('edit.php?post_type=give_forms&page=give-addon-color-settings')),
'globalOptionsUrl' => esc_url_raw(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=give-addon-global-settings')),
'colorSettingsUrl' => esc_url_raw(admin_url('edit.php?post_type=give_forms&page=ADDON_TEXTDOMAIN-color-settings')),
'globalOptionsUrl' => esc_url_raw(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=ADDON_TEXTDOMAIN-global-settings')),
'sampleTags' => $sampleTags,
'previewUrl' => esc_url_raw(admin_url('edit.php?post_type=give_forms&page=givewp-form-builder'))
];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.give-addon-settings__logo_upload__wrapper {
.ADDON_TEXTDOMAIN-settings__logo_upload__wrapper {
display: flex;
gap: 0.25rem;

Expand All @@ -16,7 +16,7 @@
}
}

.give-addon-settings-template-tags {
.ADDON_TEXTDOMAIN-settings-template-tags {
max-height: 25rem;
overflow-y: scroll;
border: 1px solid var(--givewp-grey-100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const CopyToClipboardButton = ({textToCopy}: CopyClipboardButtonProps) => {
ref={ref as Ref<HTMLAnchorElement>}
icon={copyIcon}
>
{isCopied ? __('Copied!', 'give-addon-receipts') : __('Copy Tag', 'give-addon-receipts')}
{isCopied ? __('Copied!', 'ADDON_TEXTDOMAIN-receipts') : __('Copy Tag', 'ADDON_TEXTDOMAIN-receipts')}
</Button>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export default ({value, onChange}) => {
}

frame = window.wp.media({
title: __('Add or upload file', 'give-addon-receipts'),
title: __('Add or upload file', 'ADDON_TEXTDOMAIN-receipts'),
button: {
text: __('Use this media', 'give-addon-receipts'),
text: __('Use this media', 'ADDON_TEXTDOMAIN-receipts'),
},
multiple: false, // Set to true to allow multiple files to be selected
});
Expand All @@ -45,14 +45,14 @@ export default ({value, onChange}) => {
};
return (
<BaseControl
id={'give-addon-settings__logo_upload'}
label={__('Image URL', 'give-addon-receipts')}
help={__('Max height of image should be 90px', 'give-addon-receipts')}
id={'ADDON_TEXTDOMAIN-settings__logo_upload'}
label={__('Image URL', 'ADDON_TEXTDOMAIN-receipts')}
help={__('Max height of image should be 90px', 'ADDON_TEXTDOMAIN-receipts')}
>
<div className={'give-addon-settings__logo_upload__wrapper'}>
<div className={'ADDON_TEXTDOMAIN-settings__logo_upload__wrapper'}>
<TextControl type={'url'} value={value} onChange={onChange} />
<Button icon={upload} variant={'secondary'} onClick={openMediaLibrary}>
{__('Add or upload file', 'give-addon-receipts')}
{__('Add or upload file', 'ADDON_TEXTDOMAIN-receipts')}
</Button>
</div>
</BaseControl>
Expand Down
4 changes: 2 additions & 2 deletions src/FormExtension/FormBuilder/resources/js/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ const addGiveAddonSettings = (settings) => {
...settings,
{
name: __('Give Addon Settings Sample', 'ADDON_TEXTDOMAIN'),
path: 'give-addon-settings',
path: 'ADDON_TEXTDOMAIN-settings',
element: GiveAddonSettings,
},
];
};

wp.hooks.addFilter('givewp_form_builder_settings_additional_routes', 'give-addon-settings', addGiveAddonSettings);
wp.hooks.addFilter('givewp_form_builder_settings_additional_routes', 'ADDON_TEXTDOMAIN-settings', addGiveAddonSettings);
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const CustomSettings = ({addonSettings, updateAddonSettings}: customSettingsProp
>
<PanelRow>
<RadioControl
className="radio-control--give-addonoptions"
className="radio-control--ADDON_TEXTDOMAIN-options"
label={__('Radio Option Sample', 'ADDON_TEXTDOMAIN')}
hideLabelFromVision={true}
selected={addonSettings.radioOptionSample ?? 'option_1'}
Expand Down Expand Up @@ -142,7 +142,7 @@ const CustomSettings = ({addonSettings, updateAddonSettings}: customSettingsProp
title={__('Image Selector Option Sample', 'ADDON_TEXTDOMAIN')}
description={__('Description Image Selector Option Sample.', 'ADDON_TEXTDOMAIN')}
>
<PanelRow className={'give-addon-settings__logo_upload'}>
<PanelRow className={'ADDON_TEXTDOMAIN-settings__logo_upload'}>
<ImageUpload
value={addonSettings.imageSelectorOptionSample}
onChange={(value: string) => updateAddonSettings('imageSelectorOptionSample', value)}
Expand All @@ -167,7 +167,7 @@ const CustomSettings = ({addonSettings, updateAddonSettings}: customSettingsProp
description={__('Description Sample Tags.', 'ADDON_TEXTDOMAIN')}
>
<PanelRow>
<ul className={'give-addon-settings-template-tags'} ref={templateTagsRef}>
<ul className={'ADDON_TEXTDOMAIN-settings-template-tags'} ref={templateTagsRef}>
{sampleTags.map((tag) => (
<li key={tag.tag}>
<strong>{'{' + tag.tag + '}'}</strong>
Expand All @@ -180,7 +180,7 @@ const CustomSettings = ({addonSettings, updateAddonSettings}: customSettingsProp
</SettingsSection>

<Button
className={'give-addon-settings__preview-btn'}
className={'ADDON_TEXTDOMAIN-settings__preview-btn'}
variant={'secondary'}
onClick={() =>
window.open(previewUrl + '&donationFormID=' + donationFormID, '_blank', 'noopener,noreferrer')
Expand Down
41 changes: 41 additions & 0 deletions tests/Unit/Colors/TestSamples.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace GiveColors\Tests\Unit\Colors;

use Exception;
use Give\Tests\TestCase;
use Give\Tests\TestTraits\RefreshDatabase;
use WPDieException;

class TestSamples extends TestCase
{
use RefreshDatabase;

/**
* @unreleased
*
* @throws Exception
*/
public function testExpectException()
{
$this->expectException(WPDieException::class);

wp_die();
}

/**
* @unreleased
*/
public function testAssertTrue()
{
$this->assertTrue(true);
}

/**
* @unreleased
*/
public function testAssertEquals()
{
$this->assertEquals(true, true);
}
}

0 comments on commit 534bb7f

Please sign in to comment.