Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamminf committed Jul 8, 2016
2 parents 22c7258 + 03d50c8 commit 77c8d1d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Changelog

#### v1.3.2
- `Fixed` Fixed bug with live preview mode breaking for Neo fields in Craft 2.6.2793
- `Fixed` Fixed bug with entry drafts not updating their Neo block field values after saving
- `Fixed` Fixed bug where Neo blocks would share caches across differing host names

#### v1.3.1
- `Fixed` Fixed incompatibility with PHP 5.5 and below introduced in `1.3.0`
- `Fixed` Fixed bug where leaving editing an element would always show the confirm dialog, regardless if anything changed
Expand Down
2 changes: 1 addition & 1 deletion neo/NeoPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getDescription()

public function getVersion()
{
return '1.3.1';
return '1.3.2';
}

public function getCraftMinimumVersion()
Expand Down
8 changes: 6 additions & 2 deletions neo/fieldtypes/NeoFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -739,12 +739,16 @@ private function _getBlockHtml(Neo_BlockTypeModel $blockType, Neo_BlockModel $bl
$errors = $block ? $block->getAllErrors() : [];
$hasErrors = !empty($errors);
$fullNamespace = craft()->templates->namespaceInputName($namespace, craft()->templates->getNamespace());
$owner = $block ? $block->getOwner() : null;

$cacheKey = implode(':', ['neoblock',
$cacheKey = implode('|', ['neoblock',
$blockType->id,
$block ? $block->id : '',
$owner ? $owner->dateUpdated->getTimestamp() : '',
$fullNamespace,
$static ? 's' : '',
$static ? '1' : '0',
craft()->request->isSecureConnection() ? '1': '0',
craft()->request->getHostName(),
]);

$tabsHtml = $hasErrors ? false : craft()->cache->get($cacheKey);
Expand Down
17 changes: 17 additions & 0 deletions neo/models/Neo_CriteriaModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@ public function copy()
return $copy;
}

/**
* Returns the total number of elements matched by this criteria.
* Fixes live preview mode which broke in Craft 2.6.2793 due to this method. If live preview mode is detected, it
* uses the old method which worked in live preview mode.
*
* @return int
*/
public function count()
{
if(craft()->request->isLivePreview())
{
return count($this->find());
}

return parent::count();
}

/**
* Sets a filter value for the criteria model, then reruns Live Preview filtering.
*
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "craft-neo",
"version": "1.3.1",
"version": "1.3.2",
"description": "A Matrix-like field type that uses existing fields",
"main": "webpack.config.js",
"scripts": {
Expand Down

0 comments on commit 77c8d1d

Please sign in to comment.