Skip to content

Commit cdd8328

Browse files
author
Rafael Grigorian
committed
Fixed #50
1 parent d9c9f5a commit cdd8328

File tree

6 files changed

+26
-20
lines changed

6 files changed

+26
-20
lines changed

src/app/code/JetRails/Cloudflare/Controller/Adminhtml/Api/Speed/ImageResizing/Toggle.php renamed to src/app/code/JetRails/Cloudflare/Controller/Adminhtml/Api/Speed/ImageResizing/Update.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
namespace JetRails\Cloudflare\Controller\Adminhtml\Api\Speed\ImageResizing;
44

5-
use JetRails\Cloudflare\Controller\Adminhtml\Toggle as BaseToggle;
5+
use JetRails\Cloudflare\Controller\Adminhtml\Update as BaseUpdate;
66

77
/**
88
* This controller inherits from a generic controller that implements the
9-
* base functionality for interfacing with a switch section. This section
9+
* base functionality for interfacing with a selection section. This section
1010
* simply loads the initial value through the Cloudflare API as well as
11-
* gives the ability to change the value of said section to be on or off
12-
* though the 'toggle' action.
11+
* gives the ability to change the value of said section to whatever value
12+
* is being passed though the 'update' action.
1313
* @version 1.2.6
1414
* @package JetRails® Cloudflare
1515
* @author Rafael Grigorian <development@jetrails.com>
1616
* @copyright © 2018 JETRAILS, All rights reserved
1717
* @license MIT https://opensource.org/licenses/MIT
1818
*/
19-
class Toggle extends BaseToggle {}
19+
class Update extends BaseUpdate {}

src/app/code/JetRails/Cloudflare/Model/Adminhtml/Api/Speed/ImageResizing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ class ImageResizing extends Setter {
2222
*/
2323
protected $_endpoint = "settings/image_resizing";
2424
protected $_dataKey = "value";
25-
protected $_settingType = self::TYPE_SWITCH;
25+
protected $_settingType = self::TYPE_STRING;
2626

2727
}

src/app/code/JetRails/Cloudflare/view/adminhtml/templates/speed/image_resizing.phtml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
<div class="wrapper_left" >
99
<span class="section_title" >Image Resizing</span>
1010
<p>You can resize, adjust quality, and convert images to WebP format, on demand. We cache every derived image at the edge, so you store only the original image.</p>
11-
<p>This allows you to adapt images to your sites layout and your visitors screen sizes, quickly and easily, without maintaining a server-side image processing pipeline.</p>
11+
<p>This allows you to adapt images to your site's layout and your visitors' screen sizes, quickly and easily, without maintaining a server-side image processing pipeline.</p>
1212
</div>
1313
<div class="wrapper_right" >
1414
<div>
15-
<label class="switch" >
16-
<input class="trigger" type="checkbox" name="mode" data-target="toggle" />
17-
<span class="knob" ></span>
18-
</label>
15+
<select class="trigger-select" data-target="update" name="value" >
16+
<option value="off" >Off</option>
17+
<option value="on" >On</option>
18+
<option value="open">On — Resize From Any Origin</option>
19+
</select>
1920
</div>
2021
<div class="lightbox" style="background-image: url(<?php echo $block->getViewFileUrl ('JetRails_Cloudflare/images/loading.svg') ?>)" ></div>
2122
</div>
@@ -25,10 +26,15 @@
2526
<a data-tab="help" >Help</a>
2627
</div>
2728
<div data-tab-content="help" >
28-
<h3>What does Image Resizing do?</h3>
29+
<h4>What does Image Resizing do?</h4>
2930
<p>Resizing fetches the original image and caches it (following the usual rules of HTTP caching, Cache-Control header, etc.). Requests for multiple different image sizes are likely to reuse the cached original image, without causing extra transfers from the origin server.</p>
3031
<p>Resized images follow the same caching rules as the original image and their Cache-Control header is identical. We do not support purging of resized variants. Purging of the original image URL will also purge all of its resized variants.</p>
31-
<p><a href="https://developers.cloudflare.com/images" >Image Resizing documentation</a></p>
32+
<h4>What does 'Resize images from any origin' do?</h4>
33+
<p> 'Resize images from any origin' will allow Image Resizing to resize images from any URI.<br>I.e. howtospeedupmagento.com will serve resized images originating from any URI, whether howtospeedupmagento.com or elsewhere.</p>
34+
<p>By default, Image Resizing will only resize images which originate from this zone, howtospeedupmagento.com.<br>I.e. howtospeedupmagento.com will serve resized images only if the images originate from howtospeedupmagento.com.</p>
35+
<h4>Using Workers</h4>
36+
<p>'Resize images from any origin' is not valid when using a Worker for Image Resizing. The Worker is expected to apply its own policies dictating which images will be resized.</p>
37+
<p><a href="https://developers.cloudflare.com/images/" >Image Resizing documentation</a></p>
3238
</div>
3339
</div>
3440
</section>

src/app/code/JetRails/Cloudflare/view/adminhtml/web/js/bundle.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14671,10 +14671,10 @@ $(document).on ( "cloudflare.speed.enhanced_http2_prioritization.toggle", switch
1467114671
/***/ (function(module, exports, __webpack_require__) {
1467214672

1467314673
const $ = __webpack_require__ (0)
14674-
const switchElement = __webpack_require__ (1)
14674+
const selectElement = __webpack_require__ (4)
1467514675

14676-
$(document).on ( "cloudflare.speed.image_resizing.initialize", switchElement.initialize )
14677-
$(document).on ( "cloudflare.speed.image_resizing.toggle", switchElement.toggle )
14676+
$(document).on ( "cloudflare.speed.image_resizing.initialize", selectElement.initialize )
14677+
$(document).on ( "cloudflare.speed.image_resizing.update", selectElement.update )
1467814678

1467914679

1468014680
/***/ }),

src/app/code/JetRails/Cloudflare/view/adminhtml/web/js/bundle.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const $ = require ("jquery")
2-
const switchElement = require ("cloudflare/generic/switch")
2+
const selectElement = require ("cloudflare/generic/select")
33

4-
$(document).on ( "cloudflare.speed.image_resizing.initialize", switchElement.initialize )
5-
$(document).on ( "cloudflare.speed.image_resizing.toggle", switchElement.toggle )
4+
$(document).on ( "cloudflare.speed.image_resizing.initialize", selectElement.initialize )
5+
$(document).on ( "cloudflare.speed.image_resizing.update", selectElement.update )

0 commit comments

Comments
 (0)