http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88452
Revision: 88452
Author: jeroendedauw
Date: 2011-05-20 15:19:57 +0000 (Fri, 20 May 2011)
Log Message:
-----------
added add property input
Modified Paths:
--------------
trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php
trunk/extensions/SemanticWatchlist/SemanticWatchlist.php
trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js
Modified: trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php
===================================================================
--- trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php
2011-05-20 15:18:07 UTC (rev 88451)
+++ trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php
2011-05-20 15:19:57 UTC (rev 88452)
@@ -30,6 +30,7 @@
'swl-group-name' => 'Group name:',
'swl-group-properties' => 'Properties covered by this group:',
'swl-group-remove-property' => 'Remove property',
+ 'swl-group-add-property' => 'Add property',
'swl-group-page-selection' => 'Pages in',
'swl-group-save' => 'Save',
'swl-group-delete' => 'Delete',
Modified: trunk/extensions/SemanticWatchlist/SemanticWatchlist.php
===================================================================
--- trunk/extensions/SemanticWatchlist/SemanticWatchlist.php 2011-05-20
15:18:07 UTC (rev 88451)
+++ trunk/extensions/SemanticWatchlist/SemanticWatchlist.php 2011-05-20
15:19:57 UTC (rev 88452)
@@ -115,6 +115,7 @@
'swl-group-name',
'swl-group-properties',
'swl-group-remove-property',
+ 'swl-group-add-property',
'swl-group-page-selection',
'swl-group-save',
'swl-group-delete',
Modified:
trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js
===================================================================
--- trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js
2011-05-20 15:18:07 UTC (rev 88451)
+++ trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js
2011-05-20 15:19:57 UTC (rev 88452)
@@ -16,14 +16,44 @@
var table = $( '<table />' ).attr( { 'class': 'swltable' } );
- var propTd = $( '<td />' ).attr( {
+ propTd = $( '<td />' ).attr( {
'rowspan': 2
} );
- propTd.html( mediaWiki.msg( 'swl-group-properties' ) );
+ this.propsDiv = $( '<div />' );
+ var addPropInput = $( '<input />' ).attr( {
+ 'type': 'text',
+ 'value': '',
+ 'size': 30,
+ 'class': 'swl-group-add-prop'
+ } );
+
+ var addButton = $( '<input />' ).attr( {
+ 'type': 'button',
+ 'value': mediaWiki.msg( 'swl-group-add-property' )
+ } ).click( function() {
+ var propName = addPropInput.val();
+
+ if ( propName.trim() != '' ) {
+ self.addPropertyDiv( propName );
+ addPropInput.val( '' );
+ addPropInput.focus();
+ }
+ } );
+
+ addPropInput.keypress( function( event ) {
+ if ( event.which == '13' ) {
+ addButton.click();
+ }
+ } );
+
+ propTd.html( mediaWiki.msg( 'swl-group-properties' ) )
+ .append( this.propsDiv )
+ .append( $( '<div />' ).html( addPropInput ).append(
' ' ).append( addButton ) );
+
for ( i in group.properties ) {
- propTd.append( this.getPropertyDiv( group.properties[i]
) );
+ this.addPropertyDiv( group.properties[i] );
}
this.nameInput = $( '<input />' ).attr( {
@@ -134,7 +164,7 @@
);
}
- this.getPropertyDiv = function( property ) {
+ this.addPropertyDiv = function( property ) {
var propDiv = $( '<div />' ).attr( 'class', 'propid' );
var propInput = $( '<input />' ).attr( {
@@ -146,14 +176,14 @@
var removeButton = $( '<input />' ).attr( {
'type': 'button',
- value: mediaWiki.msg( 'swl-group-remove-property' )
+ 'value': mediaWiki.msg( 'swl-group-remove-property' )
} );
removeButton.click( function() {
propDiv.remove();
} );
- return propDiv.html( propInput ).append( ' ' ).append(
removeButton );
+ this.propsDiv.append( propDiv.html( propInput ).append(
' ' ).append( removeButton ) );
}
this.getProperties = function() {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs