Skip to content

Commit

Permalink
Merge pull request consuldemocracy#3826 from consul/jquery3_compatibi…
Browse files Browse the repository at this point in the history
…lity

Update deprecated jQuery syntax
  • Loading branch information
javierm committed Nov 7, 2019
2 parents 8f38daa + 529f98c commit f035a39
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/ckeditor/reinit.js
Original file line number Diff line number Diff line change
@@ -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){};
Expand Down
6 changes: 3 additions & 3 deletions app/assets/javascripts/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -54,7 +54,7 @@
}
}
});
$("[name='progress_bar[kind]']").change();
$("[name='progress_bar[kind]']").trigger("change");
},
initialize: function() {
App.Forms.disableEnter();
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/table_sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/valuation_budget_investment_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
9 changes: 1 addition & 8 deletions spec/shared/features/nested_documentable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f035a39

Please sign in to comment.