r106608 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106607‎ | r106608 | r106609 >
Date:22:15, 18 December 2011
Author:jeroendedauw
Status:deferred
Tags:educationprogram 
Comment:
added clear filters button
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/EducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrgPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/resources/ep.pager.js (added) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/includes/EPOrgPager.php
@@ -60,9 +60,16 @@
6161 */
6262 public function formatValue( $name, $value ) {
6363 switch ( $name ) {
64 - case '': // TODO
65 - $value = $value;
 64+ case 'org_name':
 65+ $value = Linker::linkKnown(
 66+ SpecialPage::getTitleFor( 'Institution', $value ),
 67+ $value
 68+ );
6669 break;
 70+ case 'org_country':
 71+ $countries = array_flip( efEpGetCountryOptions() );
 72+ $value = $countries[$value];
 73+ break;
6774 }
6875
6976 return $value;
Index: trunk/extensions/EducationProgram/includes/EPPager.php
@@ -60,6 +60,8 @@
6161 else {
6262 parent::__construct();
6363 }
 64+
 65+ $this->context->getOutput()->addModules( 'ep.pager' );
6466 }
6567
6668 /**
@@ -242,11 +244,12 @@
243245
244246 return
245247 '<fieldset>' .
246 - '<legend>' . wfMsgHtml( 'educationprogram-pager-showonly' ) . '</legend>' .
 248+ '<legend>' . wfMsgHtml( 'ep-pager-showonly' ) . '</legend>' .
247249 '<form method="post" action="' . htmlspecialchars( $GLOBALS['wgScript'] . '?title=' . $title ) . '">' .
248250 Html::hidden( 'title', $title ) .
249251 implode( '', $controls ) .
250 - '&#160;<input type="submit" value="' . wfMsgHtml( 'reviews-reviews-go' ) . '">' .
 252+ '&#160;<input type="submit" class="ep-pager-go" value="' . wfMsgHtml( 'ep-pager-go' ) . '">' .
 253+ '&#160;<button class="ep-pager-clear">' . wfMsgHtml( 'ep-pager-clear' ) . '</button>' .
251254 '</form>' .
252255 '</fieldset>';
253256 }
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -65,7 +65,9 @@
6666 'ep-institutions-add' => 'Add institution',
6767
6868 // Pager
69 - 'educationprogram-pager-showonly' => 'Show only these items',
 69+ 'ep-pager-showonly' => 'Show only items with',
 70+ 'ep-pager-clear' => 'Clear filters',
 71+ 'ep-pager-go' => 'Go',
7072
7173 // Org pager
7274 'eporgpager-header-name' => 'Name',
Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -141,6 +141,12 @@
142142 'remoteExtPath' => 'EducationProgram/resources'
143143 );
144144
 145+$wgResourceModules['ep.pager'] = $moduleTemplate + array(
 146+ 'scripts' => array(
 147+ 'ep.pager.js',
 148+ ),
 149+);
 150+
145151 unset( $moduleTemplate );
146152
147153 $egEPSettings = array();
Index: trunk/extensions/EducationProgram/resources/ep.pager.js
@@ -0,0 +1,22 @@
 2+/**
 3+ * JavasSript for the Education Program MediaWiki extension.
 4+ * @see https://www.mediawiki.org/wiki/Extension:Education_Program
 5+ *
 6+ * @licence GNU GPL v3 or later
 7+ * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
 8+ */
 9+
 10+(function( $, mw ) {
 11+
 12+ $( document ).ready( function() {
 13+
 14+ $( '.ep-pager-clear' ).click( function() {
 15+ var $form = $( this ).closest( 'form' );
 16+ $form.find( 'select' ).val( '' );
 17+ $form.submit();
 18+ return false;
 19+ } );
 20+
 21+ } );
 22+
 23+})( window.jQuery, window.mediaWiki );
\ No newline at end of file
Property changes on: trunk/extensions/EducationProgram/resources/ep.pager.js
___________________________________________________________________
Added: svn:eol-style
124 + native

Status & tagging log