Mglaser has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/324726

Change subject: ExtendedSearch: new ux for facet operators
......................................................................

ExtendedSearch: new ux for facet operators

Facet operator is now always visible so the users know what mode they
are operating in. This also fixes an error with IE < 11.

Change-Id: I7fa0d1a6f072cc6044ac00dec288c6f166a2d516
(cherry picked from commit 19c2f82c6ee7dbb7d8f306404d9d886e2271102c)
---
M ExtendedSearch/resources/bluespice.extendedSearch.specialpage.css
M ExtendedSearch/resources/bluespice.facetsettings.js
M ExtendedSearch/views/view.ExtendedSearchFacetBox.php
3 files changed, 62 insertions(+), 31 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/26/324726/1

diff --git a/ExtendedSearch/resources/bluespice.extendedSearch.specialpage.css 
b/ExtendedSearch/resources/bluespice.extendedSearch.specialpage.css
index ec8f1c1..687fa36 100644
--- a/ExtendedSearch/resources/bluespice.extendedSearch.specialpage.css
+++ b/ExtendedSearch/resources/bluespice.extendedSearch.specialpage.css
@@ -370,4 +370,24 @@
 
 #bs-extendedsearch-filters .bs-extendedsearch-facetbox {
        clear: both;
+}
+
+.bs-extendedsearch-facet-filter {
+       float: right;
+       border: 1px solid;
+       min-width: 25px;
+       text-align: center;
+       color: #666666;
+       background-color: #F1F1F1;
+       border-color: #CCCCCC;
+       font-size: 0.7em !important;
+       padding: 0px 0;
+       height: 21px;
+}
+
+.bs-extendedsearch-facet-filter:hover,
+.bs-extendedsearch-facet-filter-active {
+       background-color: #98a7c4;
+       color: #FFFFFF;
+       border-color: #6481AC;
 }
\ No newline at end of file
diff --git a/ExtendedSearch/resources/bluespice.facetsettings.js 
b/ExtendedSearch/resources/bluespice.facetsettings.js
index 91efe32..91803eb 100644
--- a/ExtendedSearch/resources/bluespice.facetsettings.js
+++ b/ExtendedSearch/resources/bluespice.facetsettings.js
@@ -2,36 +2,25 @@
        e.preventDefault();
        var me = this;
 
-       mw.loader.using( 'ext.bluespice.extjs', function() {
-               me.settingsFlyout = me.settingsFlyout || 
Ext.create('BS.ExtendedSearch.tip.FacetSettings', {
-                       target: me,
-                       listeners: {
-                               'hide' : function() {
-                                       //Disable ExtJS tooltip functionality 
to show up on mouse over
-                                       //We want it only to show on click
-                                       me.settingsFlyout.destroy();
-                                       me.settingsFlyout = null;
-                               },
-                               'settingschange': function() {
-                                       var fsets = {};
-                                       $( '.bs-es-facetsettings' ).each( 
function(index, me){
-                                               var fset = $(me).data( 'fset' );
-                                               var fsetparam = $(me).data( 
'fset-param' );
-                                               fsets[fsetparam] = fset;
-                                       });
+       if ( $( this ).data( 'fset').op == 'OR' ) {
+               $( this ).data( 'fset').op = 'AND';
+       } else {
+               $( this ).data( 'fset').op = 'OR';
+       }
 
-                                       /* Unfortunately neither 
'ExtendedSearchAjaxManager' in
-                                        * general nor 'changeRequestFacets' 
provide a way to
-                                        * _replace_ a url fragment part. 
Therefore we just clean
-                                        * it up manually */
-                                       document.location.hash = 
document.location.hash.replace(/(&?)fset=.*?(&|$)/g, '$2');
-                                       
ExtendedSearchAjaxManager.changeRequestFacets( 'fset=' + JSON.stringify( fsets 
), true );
-                               }
-                       }
-               });
-               me.settingsFlyout.setData( $(me).data( 'fset' ) );
-               me.settingsFlyout.show();
+       var fsets = {};
+       $( '.bs-es-facetsettings' ).each( function(index, me){
+               var fset = $(me).data( 'fset' );
+               var fsetparam = $(me).data( 'fset-param' );
+               fsets[fsetparam] = fset;
        });
 
+       /* Unfortunately neither 'ExtendedSearchAjaxManager' in
+        * general nor 'changeRequestFacets' provide a way to
+        * _replace_ a url fragment part. Therefore we just clean
+        * it up manually */
+       document.location.hash = 
document.location.hash.replace(/(&?)fset=.*?(&|$)/g, '$2');
+       ExtendedSearchAjaxManager.changeRequestFacets( 'fset=' + 
JSON.stringify( fsets ), true );
+
        return false;
 });
diff --git a/ExtendedSearch/views/view.ExtendedSearchFacetBox.php 
b/ExtendedSearch/views/view.ExtendedSearchFacetBox.php
index 3708fbd..ca56e86 100644
--- a/ExtendedSearch/views/view.ExtendedSearchFacetBox.php
+++ b/ExtendedSearch/views/view.ExtendedSearchFacetBox.php
@@ -136,15 +136,37 @@
                $sFacetHead .= Xml::check( '', $bChecked, array( 'id' => $sId, 
'urldiff' => $this->getOption( 'uri-facet-all-diff' ) ) );
                $sFacetHead .= '<label for="'.$sId.'">' . wfMessage( 
$this->getOption( 'title' ) )->plain(). '</label>';
                if( isset( $this->aConfig['settings'] ) ) {
-                       $sFacetHead .= Html::element(
+                       $sFacetOperator = $this->getOption( 'fset' );
+                       $sFacetOperatorBox = '';
+                       $sFacetOperatorBox .= Html::element(
+                               'span',
+                               array(
+                                       'class' => 
'bs-extendedsearch-facet-filter ' .
+                                               ( $sFacetOperator['op'] == 'AND'
+                                               ? 
'bs-extendedsearch-facet-filter-active'
+                                               : '' ),
+                               ),
+                               wfMessage( 
'bs-extendedsearch-facetsetting-op-and' )->plain()
+                       );
+                       $sFacetOperatorBox .= Html::element(
+                               'span',
+                               array(
+                                       'class' => 
'bs-extendedsearch-facet-filter ' .
+                                               ( $sFacetOperator['op'] == 'OR'
+                                               ? 
'bs-extendedsearch-facet-filter-active'
+                                               : '' ),
+                               ),
+                               wfMessage( 
'bs-extendedsearch-facetsetting-op-or' )->plain()
+                       );
+                       $sFacetHead .= Html::rawElement(
                                'a',
                                array(
                                        'href' => '#',
-                                       'class' => 'bs-es-facetsettings 
icon-wrench',
+                                       'class' => 'bs-es-facetsettings',
                                        'data-fset-param' => 
$this->aConfig['param'],
                                        'data-fset' => FormatJson::encode( 
$this->getOption( 'fset' ) )
                                ),
-                               ''
+                               $sFacetOperatorBox
                        );
                }
                $sFacetHead .= '</div>';

-- 
To view, visit https://gerrit.wikimedia.org/r/324726
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7fa0d1a6f072cc6044ac00dec288c6f166a2d516
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: REL1_23
Gerrit-Owner: Mglaser <gla...@hallowelt.biz>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to