Index: trunk/extensions/Collection/js/collection.js |
— | — | @@ -144,14 +144,19 @@ |
145 | 145 | return false; |
146 | 146 | } |
147 | 147 | |
148 | | -function update_save_button() { |
149 | | - if (!$('#saveButton').length) { |
150 | | - return; |
151 | | - } |
| 148 | +function update_buttons() { |
152 | 149 | if ($('#collectionList .article').length == 0) { |
153 | 150 | $('#saveButton').attr('disabled', 'disabled'); |
| 151 | + $('#downloadButton').attr('disabled', 'disabled'); |
| 152 | + $('input.order').attr('disabled', 'disabled'); |
154 | 153 | return; |
| 154 | + } else { |
| 155 | + $('#downloadButton').attr('disabled', ''); |
| 156 | + $('input.order').attr('disabled', ''); |
155 | 157 | } |
| 158 | + if (!$('#saveButton').length) { |
| 159 | + return; |
| 160 | + } |
156 | 161 | if (!$('#communityCollTitle').length || $('#personalCollType:checked').val()) { |
157 | 162 | $('#personalCollTitle').attr('disabled', ''); |
158 | 163 | $('#communityCollTitle').attr('disabled', 'disabled'); |
— | — | @@ -185,14 +190,7 @@ |
186 | 191 | $('#collectionListContainer').html(data.html); |
187 | 192 | $('.makeVisible').css('display', 'inline'); |
188 | 193 | 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(); |
197 | 195 | } |
198 | 196 | |
199 | 197 | function toggle_order_info(flag) { |
— | — | @@ -220,14 +218,14 @@ |
221 | 219 | window.coll_clear_collection = clear_collection; |
222 | 220 | window.coll_toggle_order_info = toggle_order_info; |
223 | 221 | toggle_order_info(false); |
224 | | - update_save_button(); |
| 222 | + update_buttons(); |
225 | 223 | 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); |
232 | 230 | $('#titleInput').change(set_titles); |
233 | 231 | $('#subtitleInput').change(set_titles); |
234 | 232 | } |