Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
BenParizek committed Mar 30, 2024
1 parent 9e1be9f commit c1e01ad
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 58 deletions.
2 changes: 1 addition & 1 deletion src/core/translations/en/sprout-module-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@
'Delete selected group' => 'Delete selected group',
'Could not delete the group.' => 'Could not delete the group.',
'Group renamed.' => 'Group renamed.',
'Are you sure you want to delete this group? {name} in this group will not be deleted' => 'Are you sure you want to delete this group? {name} in this group will not be deleted'
'Are you sure you want to delete this group? {name} in this group will not be deleted' => 'Are you sure you want to delete this group? {name} in this group will not be deleted',
];
1 change: 0 additions & 1 deletion src/mailer/MailerModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use BarrelStrength\Sprout\core\Sprout;
use BarrelStrength\Sprout\core\twig\SproutVariable;
use BarrelStrength\Sprout\datastudio\datasources\DataSources;
use BarrelStrength\Sprout\datastudio\DataStudioModule;
use BarrelStrength\Sprout\mailer\audience\Audiences;
use BarrelStrength\Sprout\mailer\components\datasources\SubscriberListDataSource;
use BarrelStrength\Sprout\mailer\components\elements\audience\AudienceElement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public static function tableName(): string

public function getElement(): ActiveQueryInterface
{
return $this->hasOne(Element::class, ['id' => 'id']);
return self::hasOne(Element::class, ['id' => 'id']);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public static function tableName(): string

public function getElement(): ActiveQueryInterface
{
return $this->hasOne(Element::class, ['id' => 'id']);
return self::hasOne(Element::class, ['id' => 'id']);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

namespace BarrelStrength\Sprout\mailer\components\elements\email\actions;

use BarrelStrength\Sprout\forms\FormsModule;
use Craft;
use craft\base\ElementAction;
use craft\elements\db\ElementQueryInterface;

class ChangeEmailType extends ElementAction
{
Expand All @@ -25,8 +23,8 @@ public function getTriggerHtml(): ?string
(() => {
new Craft.ElementActionTrigger({
type: $type,
validateSelection: \$selectedItems => Garnish.hasAttr(\$selectedItems.find('.element'), 'data-savable'),
activate: \$selectedItems => {
validateSelection;: \$selectedItems => Garnish.hasAttr(\$selectedItems.find('.element'), 'data-savable'),
activate;: \$selectedItems => {
const elementIds = \$selectedItems.map((index, element) => {
return $(element).data('id');
}).get();
Expand All @@ -39,7 +37,7 @@ public function getTriggerHtml(): ?string
Craft.elementIndex.updateElements();
});
},
});
})
})();
JS, [static::class]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function options(): array
public function modifyQuery(QueryInterface $query): void
{
/** @var EmailElementQuery $query */
$query->andWhere(Db::parseParam( '[[sprout_emails.emailTypeUid]]', $this->paramValue()));
$query->andWhere(Db::parseParam('[[sprout_emails.emailTypeUid]]', $this->paramValue()));
}

public function matchElement(ElementInterface $element): bool
Expand Down
2 changes: 1 addition & 1 deletion src/mailer/controllers/SubscriberListsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SubscriberListsController extends Controller
{
protected array|bool|int $allowAnonymous = [
'add',
'remove'
'remove',
];

/**
Expand Down
57 changes: 41 additions & 16 deletions src/mailer/translations/en/sprout-module-mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
'Email Variant' => 'Email Variant',
'Could not save mailer.' => 'Could not save mailer.',
'Custom Templates' => 'Custom Templates',
'From Address' => 'From Address',
'Test Email Warning' => 'Test Email Warning',
'Comma-separated list of recipients.' => 'Comma-separated list of recipients.',
'Email Type' => 'Email Type',
Expand All @@ -143,43 +142,69 @@
'Transactional' => 'Transactional',
'This setting is not editable.' => 'This setting is not editable.',
'New Mailer Settings' => 'New Mailer Settings',
'This can use a Twig Shortcut Syntax and reference Notification Event and Recipient variables.' => 'This can use a Twig Shortcut Syntax and reference Notification Event and Recipient variables.',
'Mailer Settings' => 'Mailer Settings',
'Craft Mailer Settings' => 'Craft Mailer Settings',
'This setting is defined by the selected email type and is not editable.' => 'This setting is defined by the selected email type and is not editable.',
'Email types define the templates, fields, and other settings for a given email.' => 'Email types define the templates, fields, and other settings for a given email.',
'This can use a Twig Shortcut Syntax and reference Notification Event variables.' => 'This can use a Twig Shortcut Syntax and reference Notification Event variables.',
'Create custom mailer settings to refine email workflows. The Craft <a href="{url}">Email Settings</a> will be used by default.' => 'Create custom mailer settings to refine email workflows. The Craft <a href="{url}">Email Settings</a> will be used by default.',
'Reply-To' => 'Reply-To',
'Approved Sender List' => 'Approved Sender List',
'Reply-To is set in the Craft Email Settings.' => 'Reply-To is set in the Craft Email Settings.',
'This can be set to environment variable.' => 'This can be set to environment variable.',
'{attribute} in "To Field" cannot be blank.' => '{attribute} in "To Field" cannot be blank.',
'Default Settings' => 'Default Settings',
'Default From Email' => 'Default From Email',
'ID' => 'ID',
'An audience must be selected if no recipient is selected in the "To Field".' => 'An audience must be selected if no recipient is selected in the "To Field".',
'Sender is set in the Craft Email Settings.' => 'Sender is set in the Craft Email Settings.',
'Editable Defaults' => 'Editable Defaults',
'Message must have recipients cannot be blank.' => 'Message must have recipients cannot be blank.',
'Invalid Mailer Instructions Settings.' => 'Invalid Mailer Instructions Settings.',
'An Audience must be selected if no recipient is selected in the "To Field".' => 'An Audience must be selected if no recipient is selected in the "To Field".',
'Create custom mailer settings to refine email workflows. The Craft <a href="{url}">Email Settings</a> will be used if no other mailer settings are selected.' => 'Create custom mailer settings to refine email workflows. The Craft <a href="{url}">Email Settings</a> will be used if no other mailer settings are selected.',
'Sender Edit Behavior' => 'Sender Edit Behavior',
'{attribute} Message must have recipients cannot be blank.' => '{attribute} Message must have recipients cannot be blank.',
'{attribute} cannot be blank.' => '{attribute} cannot be blank.',
'Create custom mailer settings to refine email workflows. If no Mailer Settings are defined, the Craft <a href="{url}">Email Settings</a> will be used.' => 'Create custom mailer settings to refine email workflows. If no Mailer Settings are defined, the Craft <a href="{url}">Email Settings</a> will be used.',
'Default Reply-to Email' => 'Default Reply-to Email',
'UID' => 'UID',
'{attribute} cannot be blank unless a recipient is selected in the "To Field".' => '{attribute} cannot be blank unless a recipient is selected in the "To Field".',
'Create custom mailer settings to refine email workflows. If now mailer is created, the Craft <a href="{url}">Email Settings</a> will be used.' => 'Create custom mailer settings to refine email workflows. If now mailer is created, the Craft <a href="{url}">Email Settings</a> will be used.',
'Recipients or Audience cannot be blank.' => 'Recipients or Audience cannot be blank.',
'These can be set to an environment variable.' => 'These can be set to an environment variable.',
'Create custom mailer settings to refine email workflows. The Craft <a href="{url}">Email Settings</a> will be used if no mailer settings are defined.' => 'Create custom mailer settings to refine email workflows. The Craft <a href="{url}">Email Settings</a> will be used if no mailer settings are defined.',
'How to populate Sender and Reply To fields when editing an email.' => 'How to populate Sender and Reply To fields when editing an email.',
'{attribute} cannot be blank unless an Audience is selected.' => '{attribute} cannot be blank unless an Audience is selected.',
'Create custom mailer settings to refine email workflows. If no mailer settings are defined, the Craft <a href="{url}">Email Settings</a> will be used.' => 'Create custom mailer settings to refine email workflows. If no mailer settings are defined, the Craft <a href="{url}">Email Settings</a> will be used.',
'Default From Name' => 'Default From Name',
'This can use Twig Shortcut Syntax and reference Notification Event variables.' => 'This can use Twig Shortcut Syntax and reference Notification Event variables.',
'This can use Twig Shortcut Syntax and reference Notification Event and Recipient variables.' => 'This can use Twig Shortcut Syntax and reference Notification Event and Recipient variables.'
'This can use Twig Shortcut Syntax and reference Notification Event and Recipient variables.' => 'This can use Twig Shortcut Syntax and reference Notification Event and Recipient variables.',
'Group' => 'Group',
'Notification Email cannot display. The Event setting must be set.' => 'Notification Email cannot display. The Event setting must be set.',
'Unable to delete Subscriber.' => 'Unable to delete Subscriber.',
'User not permitted to create List.' => 'User not permitted to create List.',
'Smart transactional email, easy recipient management, and advanced third party integrations.' => 'Smart transactional email, easy recipient management, and advanced third party integrations.',
'Count' => 'Count',
'Choose the Email Type that will be used for the selected forms.' => 'Choose the Email Type that will be used for the selected forms.',
'New Email Theme' => 'New Email Theme',
'List Handle' => 'List Handle',
'How you will refer to this Email Theme.' => 'How you will refer to this Email Theme.',
'The content fields that can be used in this email theme.' => 'The content fields that can be used in this email theme.',
'Subscriber List (Sprout Lists)' => 'Subscriber List (Sprout Lists)',
'Body' => 'Body',
'From Email will be used if no Reply To Email is provided.' => 'From Email will be used if no Reply To Email is provided.',
'Select Custom Rule to limit when an email is triggered.' => 'Select Custom Rule to limit when an email is triggered.',
'Approved Senders must be added in global settings' => 'Approved Senders must be added in global settings',
'Subscriber deleted.' => 'Subscriber deleted.',
'Email Themes' => 'Email Themes',
'New Mailer' => 'New Mailer',
'Field Layout' => 'Field Layout',
'Custom' => 'Custom',
'Instructions' => 'Instructions',
'Updated {count} Emails to use Email Type {name}' => 'Updated {count} Emails to use Email Type {name}',
'List ID' => 'List ID',
'The senders from which content authors can select when sending emails using the Craft System Email Settings.' => 'The senders from which content authors can select when sending emails using the Craft System Email Settings.',
'Package Type' => 'Package Type',
'Unable to delete subscriber.' => 'Unable to delete subscriber.',
'Create a Subscriber Lists to select it here' => 'Create a Subscriber Lists to select it here',
'Emails already use selected Email Type.' => 'Emails already use selected Email Type.',
'_emails/theme/email.twig' => '_emails/theme/email.twig',
'Updating the Email Type may change your field layout and result in data loss.' => 'Updating the Email Type may change your field layout and result in data loss.',
'List does not exist.' => 'List does not exist.',
'Theme' => 'Theme',
'Couldn\'t reorder Email Themes.' => 'Couldn\'t reorder Email Themes.',
'Theme Type' => 'Theme Type',
'Could not save Email Type.' => 'Could not save Email Type.',
'_emails/theme/email.txt' => '_emails/theme/email.txt',
'None' => 'None',
'Change Email Type' => 'Change Email Type',
'System Mailer' => 'System Mailer'
];
50 changes: 19 additions & 31 deletions src/transactional/translations/en/sprout-module-transactional.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,44 +39,32 @@
'When a user logs in' => 'When a user logs in',
'Delete email types' => 'Delete email types',
'Create email types' => 'Create email types',
'Approved Sender List' => 'Approved Sender List',
'Select Email Type...' => 'Select Email Type...',
'The reply-to email addresses from which content editors will select.' => 'The reply-to email addresses from which content editors will select.',
'Approved Senders' => 'Approved Senders',
'This can be set to environment variable.' => 'This can be set to environment variable.',
'When an entry is created' => 'When an entry is created',
'Reply To Email' => 'Reply To Email',
'Comma-separated list of recipients.' => 'Comma-separated list of recipients.',
'Approved Reply-to Addresses' => 'Approved Reply-to Addresses',
'Craft Email Settings' => 'Craft Email Settings',
'Add Audience' => 'Add Audience',
'Default From Email' => 'Default From Email',
'Select one or more audiences.' => 'Select one or more audiences.',
'New Transactional Email' => 'New Transactional Email',
'To' => 'To',
'Enable Notifications' => 'Enable Notifications',
'Sender is set in the Craft Email Settings.' => 'Sender is set in the Craft Email Settings.',
'Editable Defaults' => 'Editable Defaults',
'When an entry is updated' => 'When an entry is updated',
'Subject Line' => 'Subject Line',
'Triggered when an entry is updated.' => 'Triggered when an entry is updated.',
'From Address' => 'From Address',
'Audience' => 'Audience',
'Triggered when an entry is created.' => 'Triggered when an entry is created.',
'Sender Edit Behavior' => 'Sender Edit Behavior',
'From' => 'From',
'Email Details' => 'Email Details',
'Default Reply-to Email' => 'Default Reply-to Email',
'Sender' => 'Sender',
'New Email Type...' => 'New Email Type...',
'From Email' => 'From Email',
'The senders from which content authors can select.' => 'The senders from which content authors can select.',
'These can be set to an environment variable.' => 'These can be set to an environment variable.',
'Select Transactional Email Type...' => 'Select Transactional Email Type...',
'Send to one or more lists.' => 'Send to one or more lists.',
'From Name' => 'From Name',
'This page lists any transactional email that are known to be related to the events triggered by this form.' => 'This page lists any transactional email that are known to be related to the events triggered by this form.',
'How to populate Sender and Reply To fields when editing an email.' => 'How to populate Sender and Reply To fields when editing an email.',
'Notifications' => 'Notifications',
'Default From Name' => 'Default From Name'
'Add a User Group to limit this event by User Group.' => 'Add a User Group to limit this event by User Group.',
'Triggered when an entry is saved.' => 'Triggered when an entry is saved.',
'Triggered when a user is saved.' => 'Triggered when a user is saved.',
'When a user is logged in.' => 'When a user is logged in.',
'When an entry is saved' => 'When an entry is saved',
'When a user is saved' => 'When a user is saved',
'Send to Admins' => 'Send to Admins',
'Edit Notification Emails' => 'Edit Notification Emails',
'When entry is updated?' => 'When entry is updated?',
'User Groups' => 'User Groups',
'Sections' => 'Sections',
'Select which user groups will trigger the notification.' => 'Select which user groups will trigger the notification.',
'When entry is created?' => 'When entry is created?',
'Triggered when a user is logged in.' => 'Triggered when a user is logged in.',
'Select which sections will trigger the notification.' => 'Select which sections will trigger the notification.',
'View Notification Emails' => 'View Notification Emails',
'When user is updated?' => 'When user is updated?',
'Transactional' => 'Transactional',
'When user is created?' => 'When user is created?'
];

0 comments on commit c1e01ad

Please sign in to comment.