r113507 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113506‎ | r113507 | r113508 >
Date:19:42, 9 March 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added autocompletion to article adittion control
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/actions/EPDeleteAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPArticleTable.php (modified) (history)
  • /trunk/extensions/EducationProgram/resources/ep.articletable.js (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEPPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -466,6 +466,7 @@
467467 'dependencies' => array(
468468 'jquery.ui.button',
469469 'jquery.ui.dialog',
 470+ 'jquery.ui.autocomplete',
470471 ),
471472 'messages' => array(
472473 'ep-articletable-addreviwer-title',
Index: trunk/extensions/EducationProgram/actions/EPDeleteAction.php
@@ -59,14 +59,17 @@
6060
6161 if ( $success ) {
6262 $title = SpecialPage::getTitleFor( $this->page->getListPage() );
63 - $query = array( 'deleted' => $this->getTitle()->getText() ); // TODO: handle
 63+ $this->getRequest()->setSessionData(
 64+ 'epdeleted',
 65+ $this->msg( $this->prefixMsg( 'deleted' ) )
 66+ );
6467 }
6568 else {
6669 $title = $this->getTitle();
67 - $query = array( 'delfailed' => '1' ); // TODO: handle
 70+ $this->getRequest()->setSessionData( 'epdelfailed', true );
6871 }
6972
70 - $this->getOutput()->redirect( $title->getLocalURL( $query ) );
 73+ $this->getOutput()->redirect( $title->getLocalURL() );
7174 }
7275 else {
7376 $this->displayForm( $object );
Index: trunk/extensions/EducationProgram/specials/SpecialEPPage.php
@@ -66,6 +66,11 @@
6767 return false;
6868 }
6969
 70+ if ( $this->getRequest()->getSessionData( 'epdeleted' ) ) {
 71+ $this->showSuccess( $this->getRequest()->getSessionData( 'epdeleted' ) );
 72+ $this->getRequest()->setSessionData( 'epdeleted', false );
 73+ }
 74+
7075 return true;
7176 }
7277
Index: trunk/extensions/EducationProgram/includes/EPArticleTable.php
@@ -121,7 +121,7 @@
122122 $user = $this->getUser();
123123
124124 $rowCount = array_reduce( $articles, function( /* integer */ $sum, EPArticle $article ) use ( $user ) {
125 - return $sum += max( count( $article->getField( 'reviewers' ) ), 1 );
 125+ return $sum + max( count( $article->getField( 'reviewers' ) ), 1 );
126126 }, 0 );
127127
128128 $html = Html::openElement( 'tr', $this->getRowAttrs( $row ) );
Index: trunk/extensions/EducationProgram/resources/ep.articletable.js
@@ -257,6 +257,36 @@
258258 $( '.ep-rem-student' ).click( removeStudent );
259259
260260 $( '.ep-rem-article' ).click( removeArticle );
 261+
 262+ $( '#addarticlename' ).autocomplete( { // TODO
 263+ source: function( request, response ) {
 264+ $.getJSON(
 265+ wgScriptPath + '/api.php',
 266+ {
 267+ 'action': 'opensearch',
 268+ 'format': 'json',
 269+ 'search': request.term,
 270+ 'limit': 8
 271+ },
 272+ function( data ) {
 273+ response( $.map( data[1], function( item ) {
 274+ return {
 275+ 'label': item,
 276+ 'value': item
 277+ };
 278+ } ) );
 279+ }
 280+ );
 281+ },
 282+ minLength: 2,
 283+ open: function() {
 284+ $( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
 285+ },
 286+ close: function() {
 287+ $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
 288+ }
 289+ } );
 290+
261291 } );
262292
263293 })( window.jQuery, mw.educationProgram );
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r113520Follow up to r113507; finish up code I accidentally comited earlier onjeroendedauw20:38, 9 March 2012

Status & tagging log