Skip to content

Commit 40776dd

Browse files
authored
Add new support page with tabs (#845)
1 parent f2e9d8c commit 40776dd

File tree

7 files changed

+491
-312
lines changed

7 files changed

+491
-312
lines changed

ViewModel/Adminhtml/Support/Contact.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Algolia\AlgoliaSearch\Helper\SupportHelper;
66
use Algolia\AlgoliaSearch\ViewModel\Adminhtml\BackendView;
7-
use Magento\Backend\Block\Template;
87
use Magento\Backend\Model\Auth\Session;
98
use Magento\Framework\Module\ModuleListInterface;
109
use Magento\User\Model\User;
@@ -79,20 +78,6 @@ public function getTooltipHtml($message)
7978
return $this->backendView->getTooltipHtml($message);
8079
}
8180

82-
/**
83-
* @return string
84-
*/
85-
public function getLegacyVersionHtml()
86-
{
87-
/** @var Template $block */
88-
$block = $this->backendView->getLayout()->createBlock(Template::class);
89-
90-
$block->setTemplate('Algolia_AlgoliaSearch::support/components/legacy-version.phtml');
91-
$block->setData('extension_version', $this->getExtensionVersion());
92-
93-
return $block->toHtml();
94-
}
95-
9681
/** @return User|null */
9782
private function getCurrenctAdmin()
9883
{

ViewModel/Adminhtml/Support/Overview.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Algolia\AlgoliaSearch\ViewModel\Adminhtml\Support;
44

5+
use Algolia\AlgoliaSearch\Block\Adminhtml\BaseAdminTemplate;
56
use Algolia\AlgoliaSearch\Helper\SupportHelper;
67
use Algolia\AlgoliaSearch\ViewModel\Adminhtml\BackendView;
78
use Magento\Backend\Block\Template;
@@ -49,4 +50,13 @@ public function getLegacyVersionHtml()
4950

5051
return $block->toHtml();
5152
}
53+
54+
public function getContactHtml()
55+
{
56+
/** @var BaseAdminTemplate $block */
57+
$block = $this->backendView->getLayout()->createBlock(BaseAdminTemplate::class);
58+
$block->setTemplate('Algolia_AlgoliaSearch::support/contact.phtml');
59+
60+
return $block->toHtml();
61+
}
5262
}

view/adminhtml/templates/support/contact.phtml

Lines changed: 130 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -7,130 +7,152 @@ $view = $this->getViewModel();
77

88
?>
99

10-
<?php echo $view->getLegacyVersionHtml(); ?>
10+
<h3><?php echo __('Contact Algolia') ?></h3>
1111

12-
<form method="post" action="" class="algolia_contact_form" data-mage-init='{"validation":{}}'>
13-
<input type="hidden" name="form_key" value="<?php echo $this->getFormKey() ?>" />
12+
<?php if ($view->isExtensionSupportEnabled()) : ?>
13+
<form method="post" action="<?php echo $this->getUrl('*/*/contact') ?>" class="algolia_contact_form" data-mage-init='{"validation":{}}'>
14+
<input type="hidden" name="form_key" value="<?php echo $this->getFormKey() ?>" />
1415

15-
<div class="row">
16-
<fieldset class="admin__fieldset col-l-7">
17-
<div class="admin__field _required">
18-
<label for="name" class="admin__field-label">
19-
<span>Your name</span>
20-
</label>
16+
<div class="row">
17+
<fieldset class="admin__fieldset col-l-7">
18+
<div class="admin__field _required">
19+
<label for="name" class="admin__field-label">
20+
<span><?php echo __('Your name') ?></span>
21+
</label>
2122

22-
<div class="admin__field-control">
23-
<input
24-
type="text"
25-
name="name"
26-
id="name"
27-
value="<?php echo $view->getDefaultName(); ?>"
28-
class="admin__control-text"
29-
data-validate="{required: true}" />
23+
<div class="admin__field-control">
24+
<input
25+
type="text"
26+
name="name"
27+
id="name"
28+
value="<?php echo $view->getDefaultName(); ?>"
29+
class="admin__control-text"
30+
data-validate="{required: true}" />
31+
</div>
3032
</div>
31-
</div>
3233

33-
<div class="admin__field _required">
34-
<label for="email" class="admin__field-label">
35-
<span>E-mail</span>
36-
</label>
37-
<div class="admin__field-control">
38-
<input
39-
type="text"
40-
name="email"
41-
id="email"
42-
value="<?php echo $view->getDefaultEmail(); ?>"
43-
class="admin__control-text"
44-
data-validate="{required: true, 'validate-email': true}" />
34+
<div class="admin__field _required">
35+
<label for="email" class="admin__field-label">
36+
<span><?php echo __('E-mail') ?></span>
37+
</label>
38+
<div class="admin__field-control">
39+
<input
40+
type="text"
41+
name="email"
42+
id="email"
43+
value="<?php echo $view->getDefaultEmail(); ?>"
44+
class="admin__control-text"
45+
data-validate="{required: true, 'validate-email': true}" />
46+
</div>
4547
</div>
46-
</div>
4748

48-
<div class="admin__field _required">
49-
<label for="subject" class="admin__field-label">
50-
<span>Subject</span>
51-
</label>
52-
<div class="admin__field-control">
53-
<input
54-
type="text"
55-
name="subject"
56-
id="subject"
57-
value="<?php echo $this->getRequest()->getParam('subject'); ?>"
58-
class="admin__control-text"
59-
data-validate="{required: true}" />
49+
<div class="admin__field _required">
50+
<label for="subject" class="admin__field-label">
51+
<span><?php echo __('Subject') ?></span>
52+
</label>
53+
<div class="admin__field-control">
54+
<input
55+
type="text"
56+
name="subject"
57+
id="subject"
58+
value="<?php echo $this->getRequest()->getParam('subject'); ?>"
59+
class="admin__control-text"
60+
data-validate="{required: true}" />
61+
</div>
6062
</div>
61-
</div>
6263

63-
<div class="admin__field _required">
64-
<label for="message" class="admin__field-label">
65-
<span>Your message</span>
66-
</label>
67-
<div class="admin__field-control">
68-
<textarea
69-
name="message"
70-
id="message"
71-
class="admin__control-textarea"
72-
placeholder="Please provide us context of your problem or question: what you were trying to achieve, what went wrong, etc."
73-
data-validate="{required: true}"><?php echo $this->getRequest()->getParam('message'); ?></textarea>
64+
<div class="admin__field _required">
65+
<label for="message" class="admin__field-label">
66+
<span><?php echo __('Your message') ?></span>
67+
</label>
68+
<div class="admin__field-control">
69+
<textarea
70+
name="message"
71+
id="message"
72+
class="admin__control-textarea"
73+
placeholder="Please provide us context of your problem or question: what you were trying to achieve, what went wrong, etc."
74+
data-validate="{required: true}"><?php echo $this->getRequest()->getParam('message'); ?></textarea>
7475

75-
<div class="admin__field-note">
76-
<div class="note_icon">i</div>
77-
<span>
78-
To provide a better support, this information will be attached to your request:
79-
<ul>
80-
<li>Magento and Algolia extension version numbers</li>
81-
<li>Algolia extension configuration</li>
82-
<li>
83-
Indexing queue information
76+
<div class="admin__field-note">
77+
<div class="note_icon">i</div>
78+
<span>
79+
To provide a better support, this information will be attached to your request:
80+
<ul>
81+
<li>Magento and Algolia extension version numbers</li>
82+
<li>Algolia extension configuration</li>
83+
<li>
84+
Indexing queue information
85+
<?php echo $view->getTooltipHtml(__('
86+
- Number of jobs in indexing queue<br>
87+
- Information about last 20 failed indexing jobs<br>
88+
- Creation time of the oldest job in indexing queue
89+
'));
90+
?>
91+
</li>
92+
</ul>
93+
<b>No personal information will be sent to Algolia.</b>
94+
</span>
95+
</div>
96+
<br>
97+
<div class="admin__actions-switch" data-role="switcher">
98+
<input
99+
type="checkbox"
100+
class="admin__actions-switch-checkbox"
101+
id="send_additional_info"
102+
name="send_additional_info"
103+
value="1"
104+
checked />
105+
<label class="admin__actions-switch-label" for="send_additional_info">
106+
<span class="admin__actions-switch-text">
107+
Attach list of installed 3rd party modules and catalog size
84108
<?php echo $view->getTooltipHtml(__('
85-
- Number of jobs in indexing queue<br>
86-
- Information about last 20 failed indexing jobs<br>
87-
- Creation time of the oldest job in indexing queue
109+
The additional data can speed up the support process
110+
by providing Algolia team more context on your implementation.
88111
'));
89112
?>
90-
</li>
91-
</ul>
92-
<b>No personal information will be sent to Algolia.</b>
93-
</span>
94-
</div>
95-
<br>
96-
<div class="admin__actions-switch" data-role="switcher">
97-
<input
98-
type="checkbox"
99-
class="admin__actions-switch-checkbox"
100-
id="send_additional_info"
101-
name="send_additional_info"
102-
value="1"
103-
checked />
104-
<label class="admin__actions-switch-label" for="send_additional_info">
105-
<span class="admin__actions-switch-text">
106-
Attach list of installed 3rd party modules and catalog size
107-
<?php echo $view->getTooltipHtml(__('
108-
The additional data can speed up the support process
109-
by providing Algolia team more context on your implementation.
110-
'));
111-
?>
112-
</span>
113-
</label>
114-
</div>
113+
</span>
114+
</label>
115+
</div>
115116

116-
<div class="button">
117-
<button
118-
type="submit"
119-
name="sent"
120-
value="sent"
121-
class="action submit primary algolia-daterange-submit">
122-
<?php echo __('Send') ?>
123-
</button>
117+
<div class="button">
118+
<button
119+
type="submit"
120+
name="sent"
121+
value="sent"
122+
class="action submit primary algolia-daterange-submit">
123+
<?php echo __('Send') ?>
124+
</button>
125+
</div>
124126
</div>
125127
</div>
128+
</fieldset>
129+
<div class="col-l-1"></div>
130+
<div class="col-l-3">
131+
<div class="heading">
132+
Related to your subject ...
133+
</div>
134+
<div class="contact_results links"></div>
126135
</div>
127-
</fieldset>
128-
<div class="col-l-1"></div>
129-
<div class="col-l-3">
130-
<div class="heading">
131-
Related to your subject ...
132-
</div>
133-
<div class="contact_results links"></div>
136+
</div>
137+
</form>
138+
139+
<?php else: ?>
140+
141+
<?php
142+
$helpIllustration = $this->getViewFileUrl('Algolia_AlgoliaSearch::images/illu-help.svg');
143+
$bookIllustration = $this->getViewFileUrl('Algolia_AlgoliaSearch::images/icon-book.svg');
144+
$starsIllustration = $this->getViewFileUrl('Algolia_AlgoliaSearch::images/icon-stars.svg');
145+
?>
146+
<div class="access-denied-page algolia-denied-page">
147+
<span><img src="<?php echo $helpIllustration ?>" /></span>
148+
<div class="algolia-suggestions-header">
149+
<img src="<?php echo $bookIllustration ?>" class="book" />
150+
<p>There's <a href="https://www.algolia.com/doc/integration/magento-2/getting-started/quick-start/?utm_source=magento&utm_medium=extension&utm_campaign=magento_2&utm_term=shop-owner&utm_content=doc-link" target="_blank">Documentation, Tutorials and Videos</a> - But we also offer expert advice and solutions through direct email support by Algolia engineers and product specialists.</p>
151+
</div>
152+
<div class="algolia-suggestions-header algolia-suggestions-header-wbg">
153+
<img src="<?php echo $starsIllustration ?>" class="stars" />
154+
<p>To get access to this Algolia feature, please consider <a href="https://www.algolia.com/pricing" target="_blank" >upgrading to a higher plan</a>.</p>
134155
</div>
135156
</div>
136-
</form>
157+
158+
<?php endif; ?>

0 commit comments

Comments
 (0)