r88452 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88451‎ | r88452 | r88453 >
Date:15:19, 20 May 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added add property input
Modified paths:
  • /trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php (modified) (history)
  • /trunk/extensions/SemanticWatchlist/SemanticWatchlist.php (modified) (history)
  • /trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js
@@ -16,14 +16,44 @@
1717
1818 var table = $( '<table />' ).attr( { 'class': 'swltable' } );
1919
20 - var propTd = $( '<td />' ).attr( {
 20+ propTd = $( '<td />' ).attr( {
2121 'rowspan': 2
2222 } );
2323
24 - propTd.html( mediaWiki.msg( 'swl-group-properties' ) );
 24+ this.propsDiv = $( '<div />' );
2525
 26+ var addPropInput = $( '<input />' ).attr( {
 27+ 'type': 'text',
 28+ 'value': '',
 29+ 'size': 30,
 30+ 'class': 'swl-group-add-prop'
 31+ } );
 32+
 33+ var addButton = $( '<input />' ).attr( {
 34+ 'type': 'button',
 35+ 'value': mediaWiki.msg( 'swl-group-add-property' )
 36+ } ).click( function() {
 37+ var propName = addPropInput.val();
 38+
 39+ if ( propName.trim() != '' ) {
 40+ self.addPropertyDiv( propName );
 41+ addPropInput.val( '' );
 42+ addPropInput.focus();
 43+ }
 44+ } );
 45+
 46+ addPropInput.keypress( function( event ) {
 47+ if ( event.which == '13' ) {
 48+ addButton.click();
 49+ }
 50+ } );
 51+
 52+ propTd.html( mediaWiki.msg( 'swl-group-properties' ) )
 53+ .append( this.propsDiv )
 54+ .append( $( '<div />' ).html( addPropInput ).append( '&nbsp;' ).append( addButton ) );
 55+
2656 for ( i in group.properties ) {
27 - propTd.append( this.getPropertyDiv( group.properties[i] ) );
 57+ this.addPropertyDiv( group.properties[i] );
2858 }
2959
3060 this.nameInput = $( '<input />' ).attr( {
@@ -134,7 +164,7 @@
135165 );
136166 }
137167
138 - this.getPropertyDiv = function( property ) {
 168+ this.addPropertyDiv = function( property ) {
139169 var propDiv = $( '<div />' ).attr( 'class', 'propid' );
140170
141171 var propInput = $( '<input />' ).attr( {
@@ -146,14 +176,14 @@
147177
148178 var removeButton = $( '<input />' ).attr( {
149179 'type': 'button',
150 - value: mediaWiki.msg( 'swl-group-remove-property' )
 180+ 'value': mediaWiki.msg( 'swl-group-remove-property' )
151181 } );
152182
153183 removeButton.click( function() {
154184 propDiv.remove();
155185 } );
156186
157 - return propDiv.html( propInput ).append( '&nbsp;' ).append( removeButton );
 187+ this.propsDiv.append( propDiv.html( propInput ).append( '&nbsp;' ).append( removeButton ) );
158188 }
159189
160190 this.getProperties = function() {
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php
@@ -30,6 +30,7 @@
3131 'swl-group-name' => 'Group name:',
3232 'swl-group-properties' => 'Properties covered by this group:',
3333 'swl-group-remove-property' => 'Remove property',
 34+ 'swl-group-add-property' => 'Add property',
3435 'swl-group-page-selection' => 'Pages in',
3536 'swl-group-save' => 'Save',
3637 'swl-group-delete' => 'Delete',
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.php
@@ -115,6 +115,7 @@
116116 'swl-group-name',
117117 'swl-group-properties',
118118 'swl-group-remove-property',
 119+ 'swl-group-add-property',
119120 'swl-group-page-selection',
120121 'swl-group-save',
121122 'swl-group-delete',

Status & tagging log