Skip to content

Commit

Permalink
Context selector and CSS improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Jako committed Aug 30, 2018
1 parent 7ab4e58 commit bf3bc0a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
4 changes: 3 additions & 1 deletion _build/templates/default/sass/_trash.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
}

.x-btn-purge-all {
color: $red;
color: $red;
&:hover {
background: $red;
box-shadow: 0 0 0 1px $red;
color: white;
}
}
Expand All @@ -14,6 +15,7 @@ color: $red;
color: $green;
&:hover {
background: $green;
box-shadow: 0 0 0 1px $green;
color: white;
}
}
6 changes: 5 additions & 1 deletion core/model/modx/processors/resource/trash/getlist.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class modResourceTrashGetListProcessor extends modObjectGetListProcessor
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$query = $this->getProperty('query');
$context = $this->getProperty('context');

$c->select(array(
$this->modx->getSelectColumns('modResource', 'modResource'),
Expand All @@ -55,6 +56,9 @@ public function prepareQueryBeforeCount(xPDOQuery $c)
$c->where(array('modResource.pagetitle:LIKE' => '%' . $query . '%'));
$c->orCondition(array('modResource.longtitle:LIKE' => '%' . $query . '%'));
}
if (!empty($context)) {
$c->where(array('modResource.context_key' => $context));
}
$c->where(array(
'modResource.deleted' => true
));
Expand All @@ -63,7 +67,7 @@ public function prepareQueryBeforeCount(xPDOQuery $c)
}

/**
* @param xPDOObject $object
* @param modResource $object
* @return array
*/
public function prepareRow(xPDOObject $object)
Expand Down
21 changes: 18 additions & 3 deletions manager/assets/modext/widgets/resource/modx.grid.trash.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,15 @@ MODx.grid.Trash = function (config) {
'click': {fn: this.restoreAll, scope: this}
}
}, '->', {
xtype: 'modx-combo-context',
id: 'modx-trash-context',
emptyText: _('context'),
listeners: {
'select': {fn: this.searchContext, scope: this}
}
},{
xtype: 'textfield',
name: 'search',
id: 'modx-source-search',
id: 'modx-trash-search',
cls: 'x-form-filter',
emptyText: _('search_ellipsis'),
listeners: {
Expand Down Expand Up @@ -170,9 +176,18 @@ Ext.extend(MODx.grid.Trash, MODx.grid.Grid, {
return true;
},

searchContext: function (tf) {
this.getStore().baseParams.context = !Ext.isEmpty(tf) ? tf.value : '';
this.getBottomToolbar().changePage(1);
this.refresh();
return true;
},

clearFilter: function () {
this.getStore().baseParams.query = '';
Ext.getCmp('modx-source-search').reset();
this.getStore().baseParams.context = '';
Ext.getCmp('modx-trash-search').reset();
Ext.getCmp('modx-trash-context').reset();
this.getBottomToolbar().changePage(1);
this.refresh();
},
Expand Down

0 comments on commit bf3bc0a

Please sign in to comment.