From 488c11d9a7446d710a40e73d9f6422e0ec98edff Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 13 Apr 2016 20:27:49 +0200 Subject: [PATCH] Bug 16238: Use .prop() instead of .attr() for 'disabled' Signed-off-by: Owen Leonard Signed-off-by: Jonathan Druart --- koha-tmpl/intranet-tmpl/prog/en/js/ajax.js | 4 ++-- .../prog/en/js/marc_subfields_structure.js | 6 +++--- .../intranet-tmpl/prog/en/js/pages/preferences.js | 4 ++-- .../prog/en/modules/acqui/addorderiso2709.tt | 4 ++-- .../prog/en/modules/acqui/lateorders.tt | 4 ++-- .../prog/en/modules/admin/currency.tt | 4 ++-- .../prog/en/modules/admin/smart-rules.tt | 8 ++++---- .../prog/en/modules/admin/transport-cost-matrix.tt | 6 +++--- .../prog/en/modules/catalogue/itemsearch.tt | 6 +++--- .../prog/en/modules/cataloguing/additem.tt | 2 +- .../intranet-tmpl/prog/en/modules/circ/returns.tt | 4 ++-- .../prog/en/modules/members/member-flags.tt | 6 +++--- .../prog/en/modules/members/member.tt | 10 ++++----- .../prog/en/modules/reports/catalogue_stats.tt | 12 +++++------ .../en/modules/reports/guided_reports_start.tt | 24 +++++++++++----------- .../prog/en/modules/serials/subscription-add.tt | 8 ++++---- .../intranet-tmpl/prog/en/modules/tags/review.tt | 12 +++++------ .../prog/en/modules/tools/batchMod-edit.tt | 4 ++-- .../prog/en/modules/tools/batch_delete_records.tt | 2 +- 19 files changed, 65 insertions(+), 65 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/ajax.js b/koha-tmpl/intranet-tmpl/prog/en/js/ajax.js index a8a9241..eebfa1c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/ajax.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/ajax.js @@ -34,7 +34,7 @@ KOHA.AJAX = { MarkRunning: function ( selector, text ) { text = text || _("Loading..."); $( selector ) - .attr( 'disabled', 'disabled' ) + .prop('disabled', true) .each( function () { var $spinner = $( '' ); var selector_type = this.localName; @@ -62,7 +62,7 @@ KOHA.AJAX = { }, MarkDone: function ( selector ) { $( selector ) - .removeAttr( 'disabled' ) + .prop('disabled', false) .each( function () { var selector_type = this.localName; if (selector_type === undefined) selector_type = this.nodeName; // IE only diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/marc_subfields_structure.js b/koha-tmpl/intranet-tmpl/prog/en/js/marc_subfields_structure.js index 2745564..197c04c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/marc_subfields_structure.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/marc_subfields_structure.js @@ -11,10 +11,10 @@ $(document).ready(function() { /* Function to enable/disable hidden values checkboxes when Flag is (de)selected */ function enable_cb(tab) { if ($("#hidden_flagged_" + tab).is(':checked')) { - $('.inclusive_' + tab).attr('disabled',true).prop('checked', false); + $('.inclusive_' + tab).prop('disabled', true).prop('checked', false); } else { - $('.inclusive_' + tab).removeAttr('disabled'); + $('.inclusive_' + tab).prop('disabled', false); } } @@ -140,4 +140,4 @@ function populateHiddenCheckboxes(tab) { enable_cb(tab); -} \ No newline at end of file +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js index 54286de..70365cd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js @@ -54,7 +54,7 @@ $( document ).ready( function () { })); function mark_modified() { - $( this.form ).find( '.save-all' ).removeAttr( 'disabled' ); + $( this.form ).find( '.save-all' ).prop('disabled', false); $( this ).addClass( 'modified' ); var name_cell = $( this ).parents( '.name-row' ).find( '.name-cell' ); if ( !name_cell.find( '.modified-warning' ).length ) @@ -90,7 +90,7 @@ $( document ).ready( function () { $( '.prefs-tab .action .cancel' ).click( function () { KOHA.Preferences.Modified = false } ); - $( '.prefs-tab .save-all' ).attr( 'disabled', true ).click( function () { + $( '.prefs-tab .save-all' ).prop('disabled', true).click( function () { KOHA.Preferences.Save( this.form ); return false; } ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt index 722b725..ea4eb05 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -105,8 +105,8 @@ } ); $("input:checkbox").prop("checked", false); - $("div.biblio.unselected select").attr("disabled", false); - $("div.biblio.unselected input").attr("disabled", false); + $("div.biblio.unselected select").prop('disabled', false); + $("div.biblio.unselected input").prop('disabled', false); $("#checkAll").click(function(){ $("#Aform").checkCheckboxes(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt index 5bebcb6..9a62bb2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt @@ -17,9 +17,9 @@ function check_uncheck() { var all_nodes = $(late_orderst.fnGetNodes()); if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) { var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid"); - $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").attr('disabled', 'disabled'); + $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true); } else { - $("input:checkbox[name=ordernumber]").removeAttr('disabled'); + $("input:checkbox[name=ordernumber]").prop('disabled', false); } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt index 8617c9d..de465a2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt @@ -14,11 +14,11 @@ function check_currency(val) { if ( val == 1.0 ) { - $("#active").removeAttr('disabled'); + $("#active").prop('disabled', false); $("#hint").html(""); } else { $("#active").prop('checked', false); - $("#active").attr('disabled','disabled'); + $("#active").prop('disabled', true); $("#hint").html(_("The active currency must have a rate of 1.0")); } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt index 4dc4eb0..744cef8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -14,13 +14,13 @@ function clear_edit(){ var type = $(this).attr("type"); if (type != "button" && type != "submit" ) { $(this).val(""); - $(this).removeAttr("disabled"); + $(this).prop('disabled', false); } if ( type == "checkbox" ) { $(this).prop('checked', false); } }); - $(edit_row).find("select").removeAttr("disabled"); + $(edit_row).find("select").prop('disabled', false); $(edit_row).find("select option:first").attr("selected", "selected"); $(edit_row).find("td:last input[name='clear']").remove(); } @@ -90,8 +90,8 @@ $(document).ready(function() { } } }); - $("#default-circulation-rules tr:last td:eq(0) select").attr('disabled', 'disabled'); - $("#default-circulation-rules tr:last td:eq(1) select").attr('disabled', 'disabled'); + $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true); + $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true); return false; }); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt index 1a52a3f..f108dbd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt @@ -16,9 +16,9 @@ function disable_transport_cost_chg(e, cost_id) { } function disable_transport_cost(cost_id, disable) { if (disable) { - $('#celldiv_'+cost_id).find('input[type=text]').attr("disabled","disabled").addClass('disabled-transfer'); + $('#celldiv_'+cost_id).find('input[type=text]').prop('disabled', true).addClass('disabled-transfer'); } else { - $('#celldiv_'+cost_id).find('input:disabled').removeAttr("disabled").removeClass('disabled-transfer'); + $('#celldiv_'+cost_id).find('input:disabled').prop('disabled', false).removeClass('disabled-transfer'); } } function enable_cost_input(cost_id) { @@ -35,7 +35,7 @@ function enable_cost_input(cost_id) { } function form_submit (f) { - $(f).find('input:disabled').removeAttr("disabled"); + $(f).find('input:disabled').prop('disabled', false); return true; } //]]> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt index 09e6b84..0ab63c2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt @@ -197,7 +197,7 @@ copy.find('input,select').not('[type="hidden"]').each(function() { $(this).val(''); }); - copy.find('.form-field-conjunction').removeAttr('disabled'); + copy.find('.form-field-conjunction').prop('disabled', false); form_field.after(copy); copy.find('select.form-field-column').change(); } @@ -230,12 +230,12 @@ $('#results-wrapper').empty().html(results_heading + table); var params = []; - $form.find('select').not('[disabled]').find('option:selected').each(function () { + $form.find('select').not(':disabled').find('option:selected').each(function () { var name = $(this).parent('select').attr('name'); var value = $(this).val(); params.push({ 'name': name, 'value': value }); }); - $form.find('input[type="text"],input[type="hidden"]').not('[disabled]').each(function () { + $form.find('input[type="text"],input[type="hidden"]').not(':disabled').each(function () { params.push({ 'name': $(this).attr('name'), 'value': $(this).val() }); }); $form.find('input[type="radio"]:checked').each(function() { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt index 1de8960..b5d6203 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -72,7 +72,7 @@ function Check(f) { // So we use disabled instead. But disabled prevent values from being passed through the form at submit. // So we "un-disable" the elements just before submitting. // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that. - $("select[name=field_value]").removeAttr("disabled"); + $("select[name=field_value]").prop('disabled', false); return true; } else { var alertString2 = _("Form not submitted because of the following problem(s)"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index 4dd0cae..95465df 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -81,13 +81,13 @@ $(document).ready(function () { $("#barcode").addClass("alert"); $("#dropboxmode").show(); - $("#return_date_override_fields :input").attr("disabled", true); + $("#return_date_override_fields :input").prop('disabled', true); $("#return_date_override").datetimepicker("disable"); } else { $("#barcode").removeClass("alert"); $("#dropboxmode").hide(); - $("#return_date_override_fields :input").attr("disabled", false); + $("#return_date_override_fields :input").prop('disabled', false); $("#return_date_override").datetimepicker("enable"); } $("#barcode").focus(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt index aa5031f..51176db 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt @@ -17,7 +17,7 @@ $('input[name="flag"]').each(function() { if($(this).attr('id') != "flag-0"){ - $(this).attr('disabled', 'disabled'); + $(this).prop('disabled', true); $(this).prop('checked', false); } }); @@ -27,14 +27,14 @@ if($('input[id="flag-0"]:checked').length){ $('input[name="flag"]').each(function() { if($(this).attr('id') != "flag-0"){ - $(this).attr('disabled', 'disabled'); + $(this).prop('disabled', true); $(this).prop('checked', false); } }); } else { $('input[name="flag"]').each(function() { - $(this).removeAttr('disabled', 'disabled'); + $(this).prop('disabled', false); }); } }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt index 43883f8..940478f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt @@ -11,7 +11,7 @@