r114033 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114032‎ | r114033 | r114034 >
Date:21:51, 16 March 2012
Author:foxtrott
Status:deferred
Tags:
Comment:
value filter height; some refactoring
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Filtered/filters/SRF_FF_Value.php (modified) (history)
  • /trunk/extensions/SemanticResultFormats/Filtered/libs/ext.srf.filtered.value-filter.js (modified) (history)
  • /trunk/extensions/SemanticResultFormats/Filtered/skins/ext.srf.filtered.value-filter.css (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/Filtered/skins/ext.srf.filtered.value-filter.css
@@ -50,4 +50,8 @@
5151 right: 0pt;
5252 text-align: center;
5353 cursor: pointer;
54 -}
\ No newline at end of file
 54+}
 55+
 56+.filtered-filters .filtered-value .filtered-value-scrollable {
 57+ overflow: auto;
 58+}
Index: trunk/extensions/SemanticResultFormats/Filtered/filters/SRF_FF_Value.php
@@ -60,6 +60,10 @@
6161 $ret['collapsible'] = trim($params['value filter collapsible']);
6262 }
6363
 64+ if ( array_key_exists( 'value filter height', $params ) ) {
 65+ $ret['height'] = trim($params['value filter height']);
 66+ }
 67+
6468 return $ret;
6569 }
6670
Index: trunk/extensions/SemanticResultFormats/Filtered/libs/ext.srf.filtered.value-filter.js
@@ -83,6 +83,7 @@
8484 var target = args.printout;
8585 var switches = filtered.filtered( 'getFilterData', {filter: 'value', printout: target, configvar: 'switches'} );
8686 var collapsible = filtered.filtered( 'getFilterData', {filter: 'value', printout: target, configvar: 'collapsible'} );
 87+ var height = filtered.filtered( 'getFilterData', {filter: 'value', printout: target, configvar: 'height'} );
8788
8889 // find distinct values and set visibility for all items that have
8990 // some value for this printout
@@ -110,6 +111,39 @@
111112 // insert the label of the printout this filter filters on
112113 filtercontrols.append('<div class="filtered-value-label"><span>' + values[i]['printouts'][target]['label'] + '</span></div>');
113114
 115+ if ( collapsible != null && ( collapsible == 'collapsed' || collapsible == 'uncollapsed') ) {
 116+ var showControl = $('<span class="filtered-value-show">[+]</span>');
 117+ var hideControl = $('<span class="filtered-value-hide">[-]</span>');
 118+
 119+
 120+ filtercontrols
 121+ .prepend(showControl)
 122+ .prepend(hideControl);
 123+
 124+ filtercontrols = $('<div class="filtered-value-collapsible">')
 125+ .appendTo(filtercontrols);
 126+
 127+ showControl.click(function(){
 128+ filtercontrols.slideDown();
 129+ showControl.hide();
 130+ hideControl.show();
 131+ });
 132+
 133+ hideControl.click(function(){
 134+ filtercontrols.slideUp();
 135+ showControl.show();
 136+ hideControl.hide();
 137+ });
 138+
 139+ if ( collapsible == 'collapsed' ) {
 140+ hideControl.hide();
 141+ filtercontrols.slideUp(0);
 142+ } else {
 143+ showControl.hide();
 144+ }
 145+
 146+ }
 147+
114148 // set default config values
115149 filtered.filtered( 'setFilterData', {filter: 'value', printout: target, configvar: 'use or', configvalue: true} );
116150
@@ -146,6 +180,15 @@
147181
148182 filtercontrols.append( switchControls );
149183 }
 184+
 185+ if ( height != null ) {
 186+ filtercontrols = $( '<div class="filtered-value-scrollable">' )
 187+ .appendTo( filtercontrols );
 188+
 189+ filtercontrols.height( height );
 190+ }
 191+
 192+
150193 var sortedDistinctValues = [];
151194
152195 for ( var i in distinctValues ) {
@@ -174,39 +217,6 @@
175218
176219 }
177220
178 - if ( collapsible != null && ( collapsible == 'collapsed' || collapsible == 'uncollapsed') ) {
179 - var showControl = $('<span class="filtered-value-show">[+]</span>');
180 - var hideControl = $('<span class="filtered-value-hide">[-]</span>');
181 -
182 - showControl.click(function(){
183 - filtercontrols.children('.filtered-value-collapsible').slideDown();
184 - showControl.hide();
185 - hideControl.show();
186 - });
187 -
188 - hideControl.click(function(){
189 - filtercontrols.children('.filtered-value-collapsible').slideUp();
190 - showControl.show();
191 - hideControl.hide();
192 - });
193 -
194 - filtercontrols
195 - .prepend(showControl)
196 - .prepend(hideControl)
197 -
198 - .children('.filtered-value-switches,.filtered-value-option')
199 - .wrapAll( '<div class="filtered-value-collapsible">' );
200 -
201 - if ( collapsible == 'collapsed' ) {
202 - hideControl.hide();
203 - filtercontrols.children('.filtered-value-collapsible').slideUp(0);
204 - } else {
205 - showControl.hide();
206 - }
207 -
208 -
209 - }
210 -
211221 return this;
212222 },
213223

Sign-offs

UserFlagDate
Nikerabbitinspected07:21, 19 March 2012

Status & tagging log