Index: trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js |
— | — | @@ -16,14 +16,44 @@ |
17 | 17 | |
18 | 18 | var table = $( '<table />' ).attr( { 'class': 'swltable' } ); |
19 | 19 | |
20 | | - var propTd = $( '<td />' ).attr( { |
| 20 | + propTd = $( '<td />' ).attr( { |
21 | 21 | 'rowspan': 2 |
22 | 22 | } ); |
23 | 23 | |
24 | | - propTd.html( mediaWiki.msg( 'swl-group-properties' ) ); |
| 24 | + this.propsDiv = $( '<div />' ); |
25 | 25 | |
| 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( ' ' ).append( addButton ) ); |
| 55 | + |
26 | 56 | for ( i in group.properties ) { |
27 | | - propTd.append( this.getPropertyDiv( group.properties[i] ) ); |
| 57 | + this.addPropertyDiv( group.properties[i] ); |
28 | 58 | } |
29 | 59 | |
30 | 60 | this.nameInput = $( '<input />' ).attr( { |
— | — | @@ -134,7 +164,7 @@ |
135 | 165 | ); |
136 | 166 | } |
137 | 167 | |
138 | | - this.getPropertyDiv = function( property ) { |
| 168 | + this.addPropertyDiv = function( property ) { |
139 | 169 | var propDiv = $( '<div />' ).attr( 'class', 'propid' ); |
140 | 170 | |
141 | 171 | var propInput = $( '<input />' ).attr( { |
— | — | @@ -146,14 +176,14 @@ |
147 | 177 | |
148 | 178 | var removeButton = $( '<input />' ).attr( { |
149 | 179 | 'type': 'button', |
150 | | - value: mediaWiki.msg( 'swl-group-remove-property' ) |
| 180 | + 'value': mediaWiki.msg( 'swl-group-remove-property' ) |
151 | 181 | } ); |
152 | 182 | |
153 | 183 | removeButton.click( function() { |
154 | 184 | propDiv.remove(); |
155 | 185 | } ); |
156 | 186 | |
157 | | - return propDiv.html( propInput ).append( ' ' ).append( removeButton ); |
| 187 | + this.propsDiv.append( propDiv.html( propInput ).append( ' ' ).append( removeButton ) ); |
158 | 188 | } |
159 | 189 | |
160 | 190 | this.getProperties = function() { |
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php |
— | — | @@ -30,6 +30,7 @@ |
31 | 31 | 'swl-group-name' => 'Group name:', |
32 | 32 | 'swl-group-properties' => 'Properties covered by this group:', |
33 | 33 | 'swl-group-remove-property' => 'Remove property', |
| 34 | + 'swl-group-add-property' => 'Add property', |
34 | 35 | 'swl-group-page-selection' => 'Pages in', |
35 | 36 | 'swl-group-save' => 'Save', |
36 | 37 | 'swl-group-delete' => 'Delete', |
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.php |
— | — | @@ -115,6 +115,7 @@ |
116 | 116 | 'swl-group-name', |
117 | 117 | 'swl-group-properties', |
118 | 118 | 'swl-group-remove-property', |
| 119 | + 'swl-group-add-property', |
119 | 120 | 'swl-group-page-selection', |
120 | 121 | 'swl-group-save', |
121 | 122 | 'swl-group-delete', |