Skip to content

Commit 0196fc0

Browse files
committed
Merge branch 'release/1.5.6' into v1
2 parents 6a90a61 + 7da0cdf commit 0196fc0

File tree

8 files changed

+75
-12
lines changed

8 files changed

+75
-12
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# ImageOptimize Changelog
22

3+
## 1.5.6 - 2019.05.21
4+
### Changed
5+
* Fixed an issue where newly added Image Variant blocks had incorrect ids on the Retina checkboxes
6+
* Updated build system
7+
38
## 1.5.5 - 2019.04.22
49
### Changed
510
* Updated Twig namespacing to be compliant with deprecated class aliases in 2.7.x

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nystudio107/craft-imageoptimize",
33
"description": "Automatically create & optimize responsive image transforms, using either native Craft transforms or a service like Imgix, with zero template changes.",
44
"type": "craft-plugin",
5-
"version": "1.5.5",
5+
"version": "1.5.6",
66
"keywords": [
77
"craft",
88
"cms",
@@ -15,8 +15,8 @@
1515
"imgix"
1616
],
1717
"support": {
18-
"docs": "https://github.com/nystudio107/craft-imageoptimize/blob/v1/README.md",
19-
"issues": "https://github.com/nystudio107/craft-imageoptimize/issues"
18+
"docs": "https://nystudio107.com/plugins/imageoptimize/documentation",
19+
"issues": "https://nystudio107.com/plugins/imageoptimize/support"
2020
},
2121
"license": "proprietary",
2222
"authors": [

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"version": "1.0.0",
44
"description": "Automatically create & optimize responsive image transforms, using either native Craft transforms or a service like Imgix, with zero template changes.",
55
"keywords": [],
6-
"homepage": "https://github.com/nystudio107/craft-imageoptimize",
6+
"homepage": "https://nystudio107.com/plugins/imageoptimize",
77
"bugs": {
88
"email": "info@nystudio107.com",
9-
"url": "https://github.com/nystudio107/craft-imageoptimize/issues"
9+
"url": "https://nystudio107.com/plugins/imageoptimize/support"
1010
},
1111
"license": "SEE LICENSE IN LICENSE.md",
1212
"author": {

src/templates/_components/fields/OptimizedImages_settings.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#}
1515

1616
{% import "_includes/forms" as forms %}
17+
{% from 'image-optimize/_includes/macros' import checkboxGroupField %}
1718

1819
{% do view.registerAssetBundle("nystudio107\\imageoptimize\\assetbundles\\imageoptimize\\ImageOptimizeAsset") %}
1920
{% do view.registerAssetBundle("nystudio107\\imageoptimize\\assetbundles\\optimizedimagesfield\\OptimizedImagesFieldAsset") %}
@@ -210,7 +211,7 @@
210211
{% if field.variants[loop.index0]['retinaSizes'] is defined and field.variants[loop.index0]['retinaSizes'] |length %}
211212
{% set retinaValues = field.variants[loop.index0]['retinaSizes'] %}
212213
{% endif %}
213-
{{ forms.checkboxGroupField({
214+
{{ checkboxGroupField({
214215
label: "Retina Sizes"|t('image-optimize'),
215216
instructions: "The additional retina sizes that should be created for this variant."|t('image-optimize'),
216217
id: 'variants-' ~ loop.index0 ~ '-retinaSizes',
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{# @var craft \craft\web\twig\variables\CraftVariable #}
2+
{#
3+
/**
4+
* Image Optimize plugin for Craft CMS 3.x
5+
*
6+
* Custom `checkboxGroup` input. Checkbox group doesn't allow access to checkbox, therefore we can't control the ID.
7+
* For this reason we use create the a custom `checkboxGroup` that will use Craft native checkboxes.
8+
*
9+
* @author nystudio107
10+
* @copyright Copyright (c) 2017 nystudio107
11+
* @link https://nystudio107.com
12+
* @package ImageOptimize
13+
* @since 1.5.6
14+
*/
15+
#}
16+
17+
{% import "_includes/forms" as forms %}
18+
19+
{% if name is defined and name %}
20+
<input type="hidden" name="{{ name }}" value="">
21+
{% endif -%}
22+
23+
{%- set options = (options is defined ? options : []) %}
24+
{%- set values = (values is defined ? values : []) %}
25+
{%- set name = (name is defined and name ? name~'[]' : null) %}
26+
27+
<div class="checkbox-group"
28+
{%- if block('attr') is defined %} {{ block('attr') }}{% endif %}>
29+
{%- for key, option in options %}
30+
{%- if option is not iterable %}
31+
{%- set option = {label: option, value: key} %}
32+
{%- endif %}
33+
<div>
34+
{{ forms.checkbox({
35+
id: (id is defined ? id ~ '-' ~ key : null),
36+
name: name,
37+
checked: (option.value is defined and option.value in values),
38+
autofocus: (autofocus is defined and autofocus and loop.first and not craft.app.request.isMobileBrowser(true))
39+
}|merge(option)) }}
40+
</div>
41+
{%- endfor %}
42+
</div>

src/templates/_includes/macros.twig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,13 @@
66
{{ false }}
77
{%- endif -%}
88
{%- endmacro %}
9+
10+
{% macro checkboxGroupField(config) %}
11+
{% import "_includes/forms" as forms %}
12+
{% import _self as macros %}
13+
{{ forms.field(config, macros.checkboxGroup(config)) }}
14+
{% endmacro %}
15+
16+
{% macro checkboxGroup(config) %}
17+
{% include "image-optimize/_includes/checkboxGroup" with config only %}
18+
{% endmacro %}

webpack.common.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ const settings = require('./webpack.settings.js');
1616
const configureBabelLoader = (browserList) => {
1717
return {
1818
test: /\.js$/,
19-
exclude: /node_modules/,
19+
exclude: settings.babelLoaderConfig.exclude,
2020
use: {
2121
loader: 'babel-loader',
2222
options: {
2323
presets: [
2424
[
2525
'@babel/preset-env', {
26-
useBuiltIns: 'usage',
27-
targets: {
28-
browsers: browserList,
29-
},
30-
}
26+
useBuiltIns: 'usage',
27+
targets: {
28+
browsers: browserList,
29+
},
30+
}
3131
],
3232
],
3333
plugins: [],

webpack.settings.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ module.exports = {
3434
"imageoptimize": "ImageOptimize.js",
3535
"welcome": "Welcome.js",
3636
},
37+
babelLoaderConfig: {
38+
exclude: [
39+
/(node_modules|bower_components)/
40+
],
41+
},
3742
copyWebpackConfig: [
3843
],
3944
devServerConfig: {

0 commit comments

Comments
 (0)