Merge pull request #3826 from consul/jquery3_compatibility

Update deprecated jQuery syntax
This commit is contained in:
Javier Martín
2019-11-07 19:00:14 +01:00
committed by GitHub
5 changed files with 7 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
$(document).bind("page:change", function() {
$(document).on("page:change", function() {
if (typeof(CKEDITOR) != "undefined"){
for(name in CKEDITOR.instances){
try{CKEDITOR.replace(name);}catch(err){};

View File

@@ -9,13 +9,13 @@
});
},
submitOnChange: function() {
$(".js-submit-on-change").unbind("change").on("change", function() {
$(".js-submit-on-change").off("change").on("change", function() {
$(this).closest("form").submit();
return false;
});
},
toggleLink: function() {
$(".js-toggle-link").unbind("click").on("click", function() {
$(".js-toggle-link").off("click").on("click", function() {
var toggle_txt;
$($(this).data("toggle-selector")).toggle("down");
if ($(this).data("toggle-text") !== undefined) {
@@ -54,7 +54,7 @@
}
}
});
$("[name='progress_bar[kind]']").change();
$("[name='progress_bar[kind]']").trigger("change");
},
initialize: function() {
App.Forms.disableEnter();

View File

@@ -17,7 +17,7 @@
};
},
initialize: function() {
$("table.sortable th").click(function() {
$("table.sortable th").on("click", function() {
var rows, table;
table = $(this).parents("table").eq(0);
rows = table.find("tbody tr").toArray().sort(App.TableSortable.comparer($(this).index()));

View File

@@ -23,7 +23,7 @@
}
},
showFeasibilityFieldsOnChange: function() {
$("#valuation_budget_investment_edit_form input[type=radio][name='budget_investment[feasibility]']").change(function() {
$("#valuation_budget_investment_edit_form input[type=radio][name='budget_investment[feasibility]']").on("change", function() {
App.ValuationBudgetInvestmentForm.showAllFields();
App.ValuationBudgetInvestmentForm.showFeasibilityFields();
});

View File

@@ -316,14 +316,7 @@ def documentable_attach_new_file(path, success = true)
document = all("#new_document").last
document_input = document.find("input[type=file]", visible: false)
page.execute_script("$('##{document_input[:id]}').css('display','block')")
attach_file(document_input[:id], path, visible: true)
page.execute_script("$('##{document_input[:id]}').css('display','none')")
# Poltergeist is not removing this attribute after file upload at
# https://github.com/teampoltergeist/poltergeist/blob/master/lib/capybara/poltergeist/client/browser.coffee#L187
# making https://github.com/teampoltergeist/poltergeist/blob/master/lib/capybara/poltergeist/client/browser.coffee#L186
# always choose the previous used input.
page.execute_script("$('##{document_input[:id]}').removeAttr('_poltergeist_selected')")
attach_file(document_input[:id], path, make_visible: true)
within document do
if success