-
-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
103 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* http://www.magepal.com | [email protected] | ||
*/ | ||
|
||
namespace MagePal\GmailSmtpApp\Controller\Adminhtml\Testemail; | ||
namespace MagePal\GmailSmtpApp\Controller\Adminhtml\Validateconfig; | ||
|
||
use Magento\Backend\App\Action; | ||
use Magento\Framework\Controller\ResultFactory; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...ml/layout/magepalsmtp_testemail_index.xml → ...yout/magepalsmtp_validateconfig_index.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0"?> | ||
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> | ||
<container name="root"> | ||
<block class="MagePal\GmailSmtpApp\Block\Adminhtml\EmailTest" name="magepal.smtp_test" | ||
template="MagePal_GmailSmtpApp::emailtest/email.phtml" /> | ||
<block class="MagePal\GmailSmtpApp\Block\Adminhtml\ValidateConfig" name="magepal.smtp_validate" | ||
template="MagePal_GmailSmtpApp::validateConfig/result.phtml" /> | ||
</container> | ||
</layout> | ||
</layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
var config = { | ||
map: { | ||
'*': { | ||
magePalGmailSmtpAppValidateConfig: 'MagePal_GmailSmtpApp/js/validate-config' | ||
} | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
view/adminhtml/templates/system/config/validateConfigButton.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/** | ||
* Copyright © MagePal LLC. All rights reserved. | ||
* See COPYING.txt for license details. | ||
* http://www.magepal.com | [email protected] | ||
*/ | ||
?> | ||
|
||
<?php /** @var $block MagePal\GmailSmtpApp\Block\Adminhtml\System\Config\ValidateConfigButton **/ ?> | ||
<?= $block->getButtonHtml() ?> | ||
|
||
<script type="text/x-magento-init"> | ||
{ | ||
"#gmailsmtpapp_debug_result_button": { | ||
"magePalGmailSmtpAppValidateConfig": { | ||
"postUrl":"<?= $block->getAdminUrl() ?>" | ||
} | ||
} | ||
} | ||
</script> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* Copyright © MagePal LLC. All rights reserved. | ||
* See COPYING.txt for license details. | ||
* http://www.magepal.com | [email protected] | ||
*/ | ||
|
||
define([ | ||
'jquery', | ||
'Magento_Ui/js/modal/alert' | ||
], function ($, alert) { | ||
|
||
var formSubmit = function (config) { | ||
var postData = { | ||
form_key: FORM_KEY | ||
}; | ||
|
||
/** global var configForm **/ | ||
configForm.find('[id^=system_gmailsmtpapp]').find(':input').serializeArray().map(function (field) { | ||
var name = field.name.match(/groups\[gmailsmtpapp\]?(\[groups\]\[debug\])?\[fields\]\[(.*)\]\[value]/); | ||
|
||
/** | ||
* groups[gmailsmtpapp][groups][debug][fields][email][value] | ||
* groups[gmailsmtpapp][fields][password][value] | ||
*/ | ||
|
||
if (name && name.length === 3) { | ||
postData[name[2]] = field.value; | ||
} | ||
}); | ||
|
||
$.ajax({ | ||
url: config.postUrl, | ||
type: 'post', | ||
dataType: 'html', | ||
data: postData, | ||
showLoader: true | ||
}).done(function (response) { | ||
if (typeof response === 'object') { | ||
if (response.error) { | ||
alert({ title: 'Error', content: response.message }); | ||
} else if (response.ajaxExpired) { | ||
window.location.href = response.ajaxRedirect; | ||
} | ||
} else { | ||
alert({ | ||
title:'', | ||
content:response, | ||
buttons: [] | ||
}); | ||
} | ||
}); | ||
}; | ||
|
||
return function (config) { | ||
$('#gmailsmtpapp_debug_result_button').on('click', function () { | ||
formSubmit(config); | ||
}); | ||
} | ||
}); |