Skip to content

Commit

Permalink
Merge branch 'release/4.4.13' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed May 24, 2023
2 parents 7a534f8 + d5f1ffb commit 82629ee
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 13 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release Notes for Craft CMS 4

## 4.4.13 - 2023-05-24

- Fixed a bug where asset sources weren‘t immediately showing a source path on a clear `localStorage` cache.
- Fixed a JavaScript error that could occur when searching within an asset index, when there was no source path. ([#13241](https://github.com/craftcms/cms/issues/13241))
- Fixed a bug where Date fields with “Show Time Zone” enabled were displaying their values in the system’s time zone within element indexes. ([#13233](https://github.com/craftcms/cms/issues/13233))
- Fixed a bug where the “Cancel” buttons within Dashboard widgets’ settings didn’t do anything. ([#13239](https://github.com/craftcms/cms/issues/13239))

## 4.4.12 - 2023-05-23

- Asset indexes now remember their previously-selected source path. ([#13147](https://github.com/craftcms/cms/issues/13147))
Expand Down
2 changes: 1 addition & 1 deletion src/config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return [
'id' => 'CraftCMS',
'name' => 'Craft CMS',
'version' => '4.4.12',
'version' => '4.4.13',
'schemaVersion' => '4.4.0.4',
'minVersionRequired' => '3.7.11',
'basePath' => dirname(__DIR__), // Defines the @app alias
Expand Down
21 changes: 18 additions & 3 deletions src/fields/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,19 +316,34 @@ protected function searchKeywords(mixed $value, ElementInterface $element): stri
*/
public function getTableAttributeHtml(mixed $value, ElementInterface $element): string
{
/** @var DateTime|null $value */
if (!$value) {
return '';
}

$formatter = Craft::$app->getFormatter();

if ($this->showDate && $this->showTime) {
return Craft::$app->getFormatter()->asDatetime($value, Locale::LENGTH_SHORT);
if ($this->showTimeZone) {
$timeZone = $formatter->timeZone;
$formatter->timeZone = $value->getTimezone()->getName();
$html = sprintf(
'%s %s',
$formatter->asDatetime($value, Locale::LENGTH_SHORT),
$value->format('T')
);
$formatter->timeZone = $timeZone;
return $html;
}

return $formatter->asDatetime($value, Locale::LENGTH_SHORT);
}

if ($this->showDate) {
return Craft::$app->getFormatter()->asDate($value, Locale::LENGTH_SHORT);
return $formatter->asDate($value, Locale::LENGTH_SHORT);
}

return Craft::$app->getFormatter()->asTime($value, Locale::LENGTH_SHORT);
return $formatter->asTime($value, Locale::LENGTH_SHORT);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/templates/dashboard/_index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<hr>
<div class="buttons clearafter">
{{ forms.submitButton({label: 'Save'|t('app'), spinner: true}) }}
{{ forms.button({label: 'Cancel'|t('app')}) }}
{{ forms.button({label: 'Cancel'|t('app'), class: 'cancel-btn'}) }}
</div>
</form>
</div>
Expand Down
8 changes: 7 additions & 1 deletion src/web/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use craft\queue\QueueLogBehavior;
use IntlDateFormatter;
use IntlException;
use ReflectionClass;
use Throwable;
use yii\base\Component;
use yii\base\ErrorException;
Expand All @@ -35,6 +36,7 @@
use yii\base\InvalidRouteException;
use yii\base\Response as BaseResponse;
use yii\db\Exception as DbException;
use yii\debug\Module as YiiDebugModule;
use yii\debug\panels\AssetPanel;
use yii\debug\panels\DbPanel;
use yii\debug\panels\LogPanel;
Expand Down Expand Up @@ -433,9 +435,13 @@ protected function debugBootstrap(): void
$svg = rawurlencode(file_get_contents(dirname(__DIR__) . '/icons/c-debug.svg'));
DebugModule::setYiiLogo("data:image/svg+xml;charset=utf-8,$svg");

// Determine the base path using reflection in case it wasn't loaded from @vendor
$ref = new ReflectionClass(YiiDebugModule::class);
$basePath = dirname($ref->getFileName());

$this->setModule('debug', [
'class' => DebugModule::class,
'basePath' => '@vendor/yiisoft/yii2-debug/src',
'basePath' => $basePath,
'allowedIPs' => ['*'],
'panels' => [
'config' => false,
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/web/assets/cp/src/js/AssetIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ Craft.AssetIndex = Craft.BaseElementIndex.extend(
// Does this source have subfolders?
if (
!this.settings.hideSidebar &&
this.sourcePath.length &&
this.sourcePath[this.sourcePath.length - 1].hasChildren
) {
if (this.$includeSubfoldersContainer === null) {
Expand Down
4 changes: 3 additions & 1 deletion src/web/assets/cp/src/js/BaseElementIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ Craft.BaseElementIndex = Garnish.Base.extend(
this.afterSetInitialSource(queryParams);
});
} else {
this.sourcePath = sourcePath;
if (sourcePath) {
this.sourcePath = sourcePath;
}
this.afterSetInitialSource(queryParams);
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/dashboard/dist/Dashboard.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/dashboard/dist/Dashboard.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/web/assets/dashboard/src/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ import './dashboard.scss';
.append(
$('<button/>', {
type: 'button',
class: 'btn',
class: 'btn cancel-btn',
text: Craft.t('app', 'Cancel'),
})
)
Expand Down Expand Up @@ -421,7 +421,7 @@ import './dashboard.scss';
this.$saveBtn = $btnsContainer.children('button[type=submit]');

this.addListener(
$btnsContainer.children('.btn:nth-child(2)'),
$btnsContainer.children('.cancel-btn'),
'click',
'cancelSettings'
);
Expand Down

0 comments on commit 82629ee

Please sign in to comment.