Skip to content

Commit

Permalink
v3.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
kjmartens committed Apr 28, 2020
1 parent 6ebd89c commit aed8c31
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Solspace Calendar Changelog

## 3.0.3 - 2020-04-28
### Fixed
- Fixed a bug where pagination and element results count was not displaying on CP Events index page.
- Fixed a bug where adding multi-day events to FullCal JS demo template were not displaying correctly when first added.
- Fixed a bug where creating new events that started late at night and needed to end after midnight were not correctly being accounted for.
- Fixed a bug where the main asset bundle wasn't loaded for action requests anymore.

## 3.0.2 - 2020-02-21
### Added
- Added `dateLocalized` property as a more reliable replacement for `date` when needing to use `|date` filter on `month`/`week`/`day` objects to display translatable date headings or highlight 'today' in calendar views.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "solspace/craft3-calendar",
"description": "The most reliable and powerful event management plugin for Craft.",
"version": "3.0.2",
"version": "3.0.3",
"type": "craft-plugin",
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function init()
\Craft::$app->view->registerTwigExtension($extension);
}

if (\Craft::$app->request->isCpRequest) {
if (\Craft::$app->request->isCpRequest && !\Craft::$app->request->isActionRequest) {
\Craft::$app->view->registerAssetBundle(MainAssetBundle::class);
}
}
Expand Down
23 changes: 17 additions & 6 deletions src/Elements/Db/EventQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Solspace\Calendar\Elements\Db;

use Carbon\Carbon;
use craft\db\Table;
use craft\elements\db\ElementQuery;
use craft\helpers\Db;
use RRule\RRule;
Expand All @@ -20,6 +21,7 @@
use Solspace\Calendar\Services\SelectDatesService;
use Solspace\Commons\Helpers\PermissionHelper;
use yii\db\Connection;
use yii\db\Expression;

class EventQuery extends ElementQuery implements \Countable
{
Expand Down Expand Up @@ -583,7 +585,7 @@ public function ids($db = null): array
public function getGroupedByMonth(): array
{
Carbon::setWeekStartsAt($this->firstDay ?? 1);
$initialGrouping = $this->noMultiDayGroup;
$initialGrouping = $this->noMultiDayGroup;
$this->noMultiDayGroup = true;
$this->all();
$this->noMultiDayGroup = $initialGrouping;
Expand Down Expand Up @@ -616,7 +618,7 @@ public function getEventsByMonth(Carbon $date): array
public function getGroupedByWeek(): array
{
Carbon::setWeekStartsAt($this->firstDay ?? 1);
$initialGrouping = $this->noMultiDayGroup;
$initialGrouping = $this->noMultiDayGroup;
$this->noMultiDayGroup = true;
$this->all();
$this->noMultiDayGroup = $initialGrouping;
Expand Down Expand Up @@ -649,7 +651,7 @@ public function getEventsByWeek(Carbon $date): array
public function getGroupedByDay(): array
{
Carbon::setWeekStartsAt($this->firstDay ?? 1);
$initialGrouping = $this->noMultiDayGroup;
$initialGrouping = $this->noMultiDayGroup;
$this->noMultiDayGroup = true;
$this->all();
$this->noMultiDayGroup = $initialGrouping;
Expand Down Expand Up @@ -763,9 +765,12 @@ protected function beforePrepare(): bool
$this->query->select($select);

if ($this->calendarId) {
$isWildcard = $this->calendarId === '*' || (is_array($this->calendarId) && count(
$this->calendarId
) === 1 && $this->calendarId[0] === '*');
if (is_array($this->calendarId)) {
$firstCalendar = reset($this->calendarId);
$isWildcard = $firstCalendar === '*';
} else {
$isWildcard = $this->calendarId === '*';
}

if (!$isWildcard) {
$this->subQuery->andWhere(Db::parseParam($table . '.[[calendarId]]', $this->calendarId));
Expand Down Expand Up @@ -1244,6 +1249,12 @@ function ($data) {
$this->limit = null;
$this->offset = null;

// Introducing a hotfix for when Craft tries to get the count of rows
$firstColumn = reset($this->select);
if ($firstColumn && $firstColumn instanceof Expression && $firstColumn->expression === '1') {
$this->select(Table::ELEMENTS . '.[[id]]');
}

$events = parent::all();

$this->limit = $limit;
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/js/event-builder/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Resources/js/event-builder/app.js.map

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion src/codepack/templates/fullcalendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,12 @@ <h1>Full Calendar</h1>
.empty()
.append($('<li />', {text: response.error}));
} else if (response.event) {
$calendar.fullCalendar('renderEvent', response.event);
const event = response.event;
if (event.allDay) {
event.end = moment(event.end).add(2, 's').utc().format();
}

$calendar.fullCalendar('renderEvent', event);
$calendar.fullCalendar('unselect');

api.hide(e);
Expand Down

0 comments on commit aed8c31

Please sign in to comment.