Skip to content

Commit

Permalink
feat: configuracao para tempo de remover cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
gihovani committed May 27, 2021
1 parent 58ae637 commit 0426723
Show file tree
Hide file tree
Showing 13 changed files with 171 additions and 118 deletions.
5 changes: 4 additions & 1 deletion Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Data extends AbstractHelper
const TYPE_INFO = 'info';

const XML_PATH_ACTIVE = 'gg2_toast/%s/active';
const XML_PATH_REMOVECOOKIEAFTER = 'gg2_toast/%s/removeCookieAfter';
const XML_PATH_POSITION = 'gg2_toast/%s/position';
const XML_PATH_BGCOLOR = 'gg2_toast/%s/bgColor';
const XML_PATH_ICON = 'gg2_toast/%s/icon';
Expand Down Expand Up @@ -53,7 +54,9 @@ public function getSettings(): array
return [];
}

$options = [];
$options = [
'removeCookieAfter' => $this->getConfig('general', self::XML_PATH_REMOVECOOKIEAFTER),
];
foreach (['success', 'notice', 'warning', 'error', 'info'] as $type) {
$options[$type] = [
'position' => $this->getConfig($type, self::XML_PATH_POSITION),
Expand Down
12 changes: 6 additions & 6 deletions Model/Config/Source/Icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ class Icon extends DataObject implements OptionSourceInterface
{

/**
* Generate list of email templates
* Generate list of email Icons
*
* @return array
*/
public function toOptionArray(): array
{
return [
['value' => '', 'label' => 'No Icon'],
['value' => 'success', 'label' => 'Success'],
['value' => 'error', 'label' => 'Error'],
['value' => 'warning', 'label' => 'Warning'],
['value' => 'info', 'label' => 'Info'],
['value' => '', 'label' => __('No Icon')],
['value' => 'success', 'label' => __('Success')],
['value' => 'error', 'label' => __('Error')],
['value' => 'warning', 'label' => __('Warning')],
['value' => 'info', 'label' => __('Info')],
];
}
}
16 changes: 8 additions & 8 deletions Model/Config/Source/Position.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
class Position extends DataObject implements OptionSourceInterface
{
/**
* Generate list of email templates
* Generate list of Positions
*
* @return array
*/
public function toOptionArray(): array
{
return [
['value' => 'top-left', 'label' => 'Top Left'],
['value' => 'top-center', 'label' => 'Top Center'],
['value' => 'top-right', 'label' => 'Top Right'],
['value' => 'mid-center', 'label' => 'Center'],
['value' => 'bottom-left', 'label' => 'Bottom Left'],
['value' => 'bottom-center', 'label' => 'Bottom Center'],
['value' => 'bottom-right', 'label' => 'Bottom Right']
['value' => 'top-left', 'label' => __('Top Left')],
['value' => 'top-center', 'label' => __('Top Center')],
['value' => 'top-right', 'label' => __('Top Right')],
['value' => 'mid-center', 'label' => __('Center')],
['value' => 'bottom-left', 'label' => __('Bottom Left')],
['value' => 'bottom-center', 'label' => __('Bottom Center')],
['value' => 'bottom-right', 'label' => __('Bottom Right')]
];
}
}
8 changes: 4 additions & 4 deletions Model/Config/Source/TextAlignment.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
class TextAlignment extends DataObject implements OptionSourceInterface
{
/**
* Generate list of email templates
* Generate list of Text Alignment
*
* @return array
*/
public function toOptionArray(): array
{
return [
['value' => 'left', 'label' => 'Left'],
['value' => 'right', 'label' => 'Right'],
['value' => 'center', 'label' => 'Center'],
['value' => 'left', 'label' => __('Left')],
['value' => 'right', 'label' => __('Right')],
['value' => 'center', 'label' => __('Center')],
];
}
}
8 changes: 4 additions & 4 deletions Model/Config/Source/Transition.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
class Transition extends DataObject implements OptionSourceInterface
{
/**
* Generate list of email templates
* Generate list of Transitions
*
* @return array
*/
public function toOptionArray(): array
{
return [
['value' => 'fade', 'label' => 'Fade'],
['value' => 'slide', 'label' => 'Slide'],
['value' => 'plain', 'label' => 'Plain'],
['value' => 'fade', 'label' => __('Fade')],
['value' => 'slide', 'label' => __('Slide')],
['value' => 'plain', 'label' => __('Plain')],
];
}
}
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ Changelog
- Configuração das cores via painel admin

1.1.0
- Adicionado o toast nas mensagens de checkout

- Adicionado o toast nas mensagens de checkout
1.1.1
- Adicionado timer para remover o cookie e eliminar mensagens duplicadas
1.1.2
- Criado configuracao para remover o cookie, ajustes na tradução

Contribuições
-------------
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"php": "~7.3.0|~7.4.0"
},
"type": "magento2-module",
"version": "1.1.1",
"version": "1.1.2",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
Loading

0 comments on commit 0426723

Please sign in to comment.