diff --git a/CHANGELOG.md b/CHANGELOG.md index 102ac8b..fea9dc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Changelog ## Unreleased ### Fixed +- Fixed a bug where cache duration information was not being saved for Volumes. ([#6](https://github.com/craftcms/aws-s3/issues/6)) - Fixed a bug where it was not possible to list buckets when using newer AWS SDK versions. ## 1.0.4 - 2017-07-07 diff --git a/src/Volume.php b/src/Volume.php index 189828b..b24fc49 100644 --- a/src/Volume.php +++ b/src/Volume.php @@ -14,7 +14,6 @@ use Aws\S3\S3Client; use Aws\Sts\StsClient; use Craft; -use craft\errors\VolumeException; use craft\helpers\Assets; use craft\helpers\DateTimeHelper; use craft\helpers\StringHelper; diff --git a/src/resources/js/editVolume.js b/src/resources/js/editVolume.js index 61ae43d..073667b 100644 --- a/src/resources/js/editVolume.js +++ b/src/resources/js/editVolume.js @@ -78,4 +78,18 @@ $s3BucketSelect.change(function() $('.volume-url').val($selectedOption.data('url-prefix')); $s3Region.val($selectedOption.data('region')); -}); \ No newline at end of file +}); + +var s3ChangeExpiryValue = function () +{ + var parent = $(this).parents('.field'), + amount = parent.find('.s3-expires-amount').val(), + period = parent.find('.s3-expires-period select').val(); + + var combinedValue = (parseInt(amount, 10) === 0 || period.length === 0) ? '' : amount + ' ' + period; + + parent.find('[type=hidden]').val(combinedValue); +}; + +$('.s3-expires-amount').keyup(s3ChangeExpiryValue).change(s3ChangeExpiryValue); +$('.s3-expires-period select').change(s3ChangeExpiryValue); \ No newline at end of file diff --git a/src/templates/volumeSettings.html b/src/templates/volumeSettings.html index d5732af..2cb1f94 100644 --- a/src/templates/volumeSettings.html +++ b/src/templates/volumeSettings.html @@ -74,14 +74,14 @@ id: 'expiresAmount', value: expires[0], size: 2, - class: 'expires-amount' + class: 's3-expires-amount' }) }} {{ forms.select({ id: 'expiresPeriod', options: periods, value: expires[1], - class: 'expires-period' + class: 's3-expires-period' }) }} {{ forms.hidden({