jenkins-bot has submitted this change and it was merged.
Change subject: BSApiExtJSStoreBase/BS.GRUDGridPanel: Filter
......................................................................
BSApiExtJSStoreBase/BS.GRUDGridPanel: Filter
* Implemented filter for fields of type bool
* Added FilterFeature to BS.GRUDGridPanel
PatchSet 4:
* Moved I18N for BooleanFiler into separate change
Change-Id: If89b063b3b511cef28494c1c98ebb005ade8f909
---
M includes/api/BSApiExtJSStoreBase.php
M resources/bluespice.extjs/BS/CRUDGridPanel.js
M resources/bluespice.extjs/Ext.ux/grid/filter/BooleanFilter.js
3 files changed, 31 insertions(+), 4 deletions(-)
Approvals:
Mglaser: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/api/BSApiExtJSStoreBase.php
b/includes/api/BSApiExtJSStoreBase.php
index 23ed175..deb6460 100644
--- a/includes/api/BSApiExtJSStoreBase.php
+++ b/includes/api/BSApiExtJSStoreBase.php
@@ -290,7 +290,13 @@
return false;
}
}
- //TODO: Implement for type 'date', 'datetime' and
'boolean'
+ if( $oFilter->type == 'boolean' ) {
+ $bFilterApplies = $this->filterBoolean(
$oFilter, $aDataSet );
+ if( !$bFilterApplies ) {
+ return false;
+ }
+ }
+ //TODO: Implement for type 'date' and 'datetime'
}
return true;
@@ -379,6 +385,16 @@
}
/**
+ * Performs filtering based on given filter of type bool on a dataset
+ * @param object $oFilter
+ * @param object $aDataSet
+ * @return boolean true if filter applies, false if not
+ */
+ public function filterBoolean( $oFilter, $aDataSet ) {
+ return $oFilter->value == $aDataSet->{ $oFilter->field };
+ }
+
+ /**
* Applies pagination on the result
* @param array $aProcessedData The filtered result
* @return array a trimmed version of the result
diff --git a/resources/bluespice.extjs/BS/CRUDGridPanel.js
b/resources/bluespice.extjs/BS/CRUDGridPanel.js
index 77fada8..db75a5b 100644
--- a/resources/bluespice.extjs/BS/CRUDGridPanel.js
+++ b/resources/bluespice.extjs/BS/CRUDGridPanel.js
@@ -15,7 +15,9 @@
Ext.define( 'BS.CRUDGridPanel', {
extend: 'BS.CRUDPanel',
requires: [ 'Ext.PagingToolbar', 'Ext.selection.RowModel',
- 'Ext.grid.GridPanel', 'Ext.grid.column.Action' ],
+ 'Ext.grid.GridPanel', 'Ext.grid.column.Action',
+ 'Ext.ux.grid.FiltersFeature'
+ ],
//Custom
pageSize: 20,
@@ -84,6 +86,7 @@
store: this.makeMainStore(),
columns: this.makeGridColumns(),
selModel: this.makeSelModel(),
+ features: this.makeFeatures(),
bbar: this.makeBBar()
};
@@ -150,6 +153,14 @@
return this.smMain;
},
+ makeFeatures: function() {
+ return [
+ new Ext.ux.grid.FiltersFeature({
+ encode: true
+ })
+ ];
+ },
+
getSingleSelection: function() {
var selectedRecords =
this.grdMain.getSelectionModel().getSelection();
if( selectedRecords.length > 0) {
diff --git a/resources/bluespice.extjs/Ext.ux/grid/filter/BooleanFilter.js
b/resources/bluespice.extjs/Ext.ux/grid/filter/BooleanFilter.js
index bd0794c..d0f4aca 100644
--- a/resources/bluespice.extjs/Ext.ux/grid/filter/BooleanFilter.js
+++ b/resources/bluespice.extjs/Ext.ux/grid/filter/BooleanFilter.js
@@ -30,12 +30,12 @@
* @cfg {String} yesText
* Defaults to 'Yes'.
*/
- yesText : 'Yes',
+ yesText : mw.message( 'bs-extjs-filter-bool-yes' ).plain(),
/**
* @cfg {String} noText
* Defaults to 'No'.
*/
- noText : 'No',
+ noText : mw.message( 'bs-extjs-filter-bool-no' ).plain(),
/**
* @private
--
To view, visit https://gerrit.wikimedia.org/r/264286
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If89b063b3b511cef28494c1c98ebb005ade8f909
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Robert Vogel <[email protected]>
Gerrit-Reviewer: Dvogel hallowelt <[email protected]>
Gerrit-Reviewer: Ljonka <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Pwirth <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits