http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99640
Revision: 99640
Author: jeroendedauw
Date: 2011-10-12 17:46:28 +0000 (Wed, 12 Oct 2011)
Log Message:
-----------
rem table and header when last item gets deleted
Modified Paths:
--------------
trunk/extensions/Contest/resources/contest.special.contests.js
trunk/extensions/Contest/specials/SpecialContests.php
Modified: trunk/extensions/Contest/resources/contest.special.contests.js
===================================================================
--- trunk/extensions/Contest/resources/contest.special.contests.js
2011-10-12 17:30:11 UTC (rev 99639)
+++ trunk/extensions/Contest/resources/contest.special.contests.js
2011-10-12 17:46:28 UTC (rev 99640)
@@ -8,7 +8,7 @@
(function( $, mw ) { $( document ).ready( function() {
- function deleteSurvey( options, successCallback, failCallback ) {
+ function deleteContest( options, successCallback, failCallback ) {
$.post(
wgScriptPath + '/api.php',
{
@@ -31,13 +31,20 @@
$this = $( this );
if ( confirm( mw.msg( 'contest-special-confirm-delete' ) ) ) {
- deleteSurvey(
+ deleteContest(
{
id: $this.attr( 'data-contest-id' ),
token: $this.attr( 'data-contest-token'
)
},
function() {
- $this.closest( 'tr' ).slideUp( 'slow',
function() { $( this ).remove(); } );
+ $this.closest( 'tr' ).slideUp( 'slow',
function() {
+ $( this ).remove();
+
+ if ( $( '.contests-table tr'
).length < 2 ) {
+ $( '.contests-table'
).remove();
+ $( '.contests-title'
).remove();
+ }
+ } );
},
function( error ) {
alert( error );
Modified: trunk/extensions/Contest/specials/SpecialContests.php
===================================================================
--- trunk/extensions/Contest/specials/SpecialContests.php 2011-10-12
17:30:11 UTC (rev 99639)
+++ trunk/extensions/Contest/specials/SpecialContests.php 2011-10-12
17:46:28 UTC (rev 99640)
@@ -113,11 +113,11 @@
$user = $this->getUser();
$out = $this->getOutput();
- $out->addHTML( Html::element( 'h2', array(), wfMsg(
'contest-special-existing' ) ) );
+ $out->addHTML( Html::element( 'h2', array( 'class' =>
'contests-title' ), wfMsg( 'contest-special-existing' ) ) );
$out->addHTML( Xml::openElement(
'table',
- array( 'class' => 'wikitable sortable' )
+ array( 'class' => 'wikitable sortable contests-table' )
) );
$headers = array(
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs