Skip to content

Commit

Permalink
fix: code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdichaouch committed Apr 1, 2022
1 parent 8dd9eda commit 79029d2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Model/Config/OpenWeather.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
final class OpenWeather
{
private const CONFIG_PATH_SNOWFLAKE_OPENWEATHERMAP_ENABLED = 'snowflake/api/enable_api';
private const CONFIG_PATH_SNOWFLAKE_OPENWEATHERMAP_ENABLED = 'snowflake/api/enable';
private const CONFIG_PATH_SNOWFLAKE_OPENWEATHERMAP_API_KEY = 'snowflake/api/api_key';
private const CONFIG_PATH_SNOWFLAKE_IP_LOCATOR_API_URL = 'snowflake/api/ip_info_api_url';

Expand Down
8 changes: 4 additions & 4 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
</field>
<field id="icon" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Icon</label>
<comment>Icon to display as a snowflake `❄`️.</comment>
<comment><![CDATA[Icon to display as a snowflake ❄️, get <a href="https://emojipedia.org/" target="_blank">more emoji</a>.]]></comment>
<backend_model>Opengento\Snowflake\Model\Config\Backend\EmojiConverter</backend_model>
<depends>
<field id="snowflake/general/enable">1</field>
</depends>
</field>
<field id="force" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="force" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Force Display</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>⚠️ Display snow whatever is the weather (this makes OpenWeatherMap API useless).</comment>
<comment><![CDATA[⚠️ Display snow whatever is the weather (this makes OpenWeatherMap API useless).]]></comment>
<depends>
<field id="snowflake/general/enable">1</field>
</depends>
Expand Down Expand Up @@ -84,7 +84,7 @@
<group id="api" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[OpenWeatherMap API]]></label>
<comment><![CDATA[This setting is bypassed if you enable <b>Force Display</b>.]]></comment>
<field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Status</label>
<source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model>
<depends>
Expand Down
4 changes: 2 additions & 2 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<snowflake>
<general>
<enable>0</enable>
<icon backend_model="Opengento\Snowflake\Model\Config\Backend\EmojiConverter">"\u2744"</icon>
<icon backend_model="Opengento\Snowflake\Model\Config\Backend\EmojiConverter">"\u2744\ufe0f"</icon>
<force>0</force>
<vspeed>0.75</vspeed>
<hspeed>0.75</hspeed>
<qty>70</qty>
Expand All @@ -20,7 +21,6 @@
<rotspeed>6</rotspeed>
</general>
<api>
<force>0</force>
<api_key backend_model="Magento\Config\Model\Config\Backend\Encrypted"/>
<ip_info_api_url>https://ipinfo.io/json</ip_info_api_url>
</api>
Expand Down
2 changes: 1 addition & 1 deletion view/frontend/templates/snowflake.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $viewModel = $block->getData('viewModel');
[lat, lon] = response.loc.split(',');
$.ajax({
url: '<?= $block->getData('meteoUrl') ?>lat/' + lat + '/lon/' + lon,
type: "POST",
type: "GET",
}).done(function (data) {
if (data.is_snowing) {
letSnow();
Expand Down

0 comments on commit 79029d2

Please sign in to comment.