Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Commit

Permalink
Fixes an issue w/ Commerce active/inactive carts view, and an issue w…
Browse files Browse the repository at this point in the history
…here CpSortCols would leak configuration data on the login screen
  • Loading branch information
mmikkel committed Jun 26, 2017
1 parent a923e0f commit 7f11231
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CP Sortable Custom Columns v. 1.1.1 for Craft CMS ![Craft 2.5](https://img.shields.io/badge/craft-2.5-red.svg?style=flat-square)
# CP Sortable Custom Columns v. 1.1.2 for Craft CMS ![Craft 2.5](https://img.shields.io/badge/craft-2.5-red.svg?style=flat-square)

_Easily sort your element index tables on custom fields_

Expand Down Expand Up @@ -50,6 +50,11 @@ Please report any bugs, feature requests or other issues [here](https://github.c

### Changelog

#### 1.1.2 (06.26.2017)

* [Fixed] Fixes issue where CP Sortable Custom Columns would leak configuration data on login screen
* [Fixed] Fixes issue w/ sorting in Commerce active/inactive carts view (thanks @engram-design)

#### 1.1.1 (06.17.2016)

* [Fixed] Now works like it should for User element indexes.
Expand Down
4 changes: 2 additions & 2 deletions cpsortcols/CpSortColsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class CpSortColsPlugin extends BasePlugin
{

protected $_version = '1.1.1',
protected $_version = '1.1.2',
$_schemaVersion = '1.0',
$_require = '2.5',
$_pluginName = 'CP Sortable Custom Columns',
Expand Down Expand Up @@ -130,7 +130,7 @@ public function init()

$request = craft()->request;

if (!$request->isCpRequest() || $request->isAjaxRequest() || craft()->isConsole() || !$this->isCraftRequiredVersion()) {
if (!$request->isCpRequest() || $request->isAjaxRequest() || !craft()->userSession->getUser() || craft()->isConsole() || !$this->isCraftRequiredVersion()) {
return false;
}

Expand Down
8 changes: 8 additions & 0 deletions cpsortcols/resources/cpsortcols.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,20 @@

attribute = $header.data('attribute');

// Hack to fix bug w/ Commerce active/inactive carts – thanks @engram-design
if ($('body').hasClass('commerceordersindex') && attribute == 'dateUpdated') {
attribute = 'orders.dateUpdated';
$header.attr('data-attribute', attribute).data('attribute', attribute);
}

// Hack to enable sorting by author
if (attribute === 'author') {
attribute = 'authorId';
$header
.attr('data-attribute', attribute)
.data('attribute', attribute);
}

// Hack to enable sorting by entry type
if (attribute === 'type') {
attribute = 'typeId';
Expand All @@ -115,6 +122,7 @@
.data('attribute', attribute)
.on('click', $.proxy(self.onCustomSortableTableHeaderClick, self));
}

attributeData = self.getSortableAttribute(attribute);

if (attributeData || $header.hasClass('ordered') || $header.hasClass('orderable')) {
Expand Down
9 changes: 9 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"version": "1.1.2",
"downloadUrl": "https://github.com/mmikkel/CpSortableCustomColumns-Craft/archive/master.zip",
"date": "2017-06-26T11:00:00-08:00",
"notes": [
"[Fixed] Fixes issue where CP Sortable Custom Columns would leak configuration data on login screen",
"[Fixed] Fixes issue w/ sorting in Commerce active/inactive carts view (thanks @engram-design)"
]
},
{
"version": "1.1.1",
"downloadUrl": "https://github.com/mmikkel/CpSortableCustomColumns-Craft/archive/master.zip",
Expand Down

0 comments on commit 7f11231

Please sign in to comment.