r75348 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75347‎ | r75348 | r75349 >
Date:11:11, 25 October 2010
Author:jojo
Status:ok
Tags:
Comment:
fix for enabling/disabling buttons for collections w/ chapter(s) only
Modified paths:
  • /trunk/extensions/Collection/js/collection.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/js/collection.js
@@ -144,14 +144,19 @@
145145 return false;
146146 }
147147
148 -function update_save_button() {
149 - if (!$('#saveButton').length) {
150 - return;
151 - }
 148+function update_buttons() {
152149 if ($('#collectionList .article').length == 0) {
153150 $('#saveButton').attr('disabled', 'disabled');
 151+ $('#downloadButton').attr('disabled', 'disabled');
 152+ $('input.order').attr('disabled', 'disabled');
154153 return;
 154+ } else {
 155+ $('#downloadButton').attr('disabled', '');
 156+ $('input.order').attr('disabled', '');
155157 }
 158+ if (!$('#saveButton').length) {
 159+ return;
 160+ }
156161 if (!$('#communityCollTitle').length || $('#personalCollType:checked').val()) {
157162 $('#personalCollTitle').attr('disabled', '');
158163 $('#communityCollTitle').attr('disabled', 'disabled');
@@ -185,14 +190,7 @@
186191 $('#collectionListContainer').html(data.html);
187192 $('.makeVisible').css('display', 'inline');
188193 make_sortable();
189 - if ($('#collectionList .article').length == 0) {
190 - $('#downloadButton').attr('disabled', 'disabled');
191 - $('input.order').attr('disabled', 'disabled');
192 - } else {
193 - $('#downloadButton').attr('disabled', '');
194 - $('input.order').attr('disabled', '');
195 - }
196 - update_save_button();
 194+ update_buttons();
197195 }
198196
199197 function toggle_order_info(flag) {
@@ -220,14 +218,14 @@
221219 window.coll_clear_collection = clear_collection;
222220 window.coll_toggle_order_info = toggle_order_info;
223221 toggle_order_info(false);
224 - update_save_button();
 222+ update_buttons();
225223 make_sortable();
226 - $('#personalCollTitle').keyup(update_save_button);
227 - $('#personalCollTitle').change(update_save_button);
228 - $('#communityCollTitle').keyup(update_save_button);
229 - $('#communityCollTitle').change(update_save_button);
230 - $('#personalCollType').change(update_save_button);
231 - $('#communityCollType').change(update_save_button);
 224+ $('#personalCollTitle').keyup(update_buttons);
 225+ $('#personalCollTitle').change(update_buttons);
 226+ $('#communityCollTitle').keyup(update_buttons);
 227+ $('#communityCollTitle').change(update_buttons);
 228+ $('#personalCollType').change(update_buttons);
 229+ $('#communityCollType').change(update_buttons);
232230 $('#titleInput').change(set_titles);
233231 $('#subtitleInput').change(set_titles);
234232 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r98982(bug 31360) Use removeAttr('disabled') instead of attr('disabled', ''). Conso...tstarling06:30, 5 October 2011

Status & tagging log