Merge pull request #3654 from consul/fix_javascript_typos
Fix JavaScript Lint errors
This commit is contained in:
@@ -17,14 +17,11 @@ App.AdvancedSearch =
|
||||
|
||||
init_calendar: ->
|
||||
locale = $("#js-locale").data("current-locale")
|
||||
if locale == "en"
|
||||
locale = ""
|
||||
|
||||
$(".js-calendar").datepicker
|
||||
regional: locale
|
||||
maxDate: "+0d"
|
||||
$(".js-calendar-full").datepicker
|
||||
regional: locale
|
||||
$(".js-calendar-full").datepicker()
|
||||
$.datepicker.setDefaults($.datepicker.regional[locale])
|
||||
|
||||
initialize: ->
|
||||
App.AdvancedSearch.init_calendar()
|
||||
|
||||
@@ -9,8 +9,8 @@ App.Answers =
|
||||
max_order = 0
|
||||
$(answers).find("[name$='[given_order]']").each (index, answer) ->
|
||||
value = parseFloat($(answer).val())
|
||||
max_order = if value > max_given_order then value else max_given_order
|
||||
return max_given_order
|
||||
max_order = if value > max_order then value else max_order
|
||||
return max_order
|
||||
|
||||
nestedAnswers: ->
|
||||
$('.js-answers').each (index, answers) ->
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
this.progressColumnValues = [ this.progressLabel ];
|
||||
|
||||
for (key in data) {
|
||||
if (data.hasOwnProperty(key)) {
|
||||
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
||||
this.xColumnValues.push(key);
|
||||
this.progressColumnValues.push(data[key]);
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
this.successfulColumnValues = [ this.successLabel ];
|
||||
|
||||
for (key in data) {
|
||||
if (data.hasOwnProperty(key)) {
|
||||
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
||||
this.addXColumnValue(key);
|
||||
this.successfulColumnValues.push(data[key]);
|
||||
}
|
||||
@@ -130,7 +130,7 @@
|
||||
|
||||
this.achievements = [];
|
||||
for (group in data) {
|
||||
if (data.hasOwnProperty(group)) {
|
||||
if (Object.prototype.hasOwnProperty.call(data, group)) {
|
||||
this.addXColumnValue(group);
|
||||
this.achievements.push({
|
||||
value: this.formatGroup(group),
|
||||
@@ -169,7 +169,7 @@
|
||||
color: function (color, d) {
|
||||
var achievement;
|
||||
|
||||
if (d.id === this.successfulColumnValues[0] || !d.hasOwnProperty('x')) {
|
||||
if (d.id === this.successfulColumnValues[0] || !Object.prototype.hasOwnProperty.call(d, 'x')) {
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ App.PollsAdmin =
|
||||
when "vote_collection"
|
||||
$("select[class='js-shift-vote-collection-dates']").show()
|
||||
$("select[class='js-shift-recount-scrutiny-dates']").hide()
|
||||
break
|
||||
when "recount_scrutiny"
|
||||
$("select[class='js-shift-recount-scrutiny-dates']").show()
|
||||
$("select[class='js-shift-vote-collection-dates']").hide()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<% if I18n.available_locales.size > 1 %>
|
||||
<div class="locale" id="js-locale" data-current-local="<%= I18n.locale %>">
|
||||
<div class="locale" id="js-locale" data-current-locale="<%= I18n.locale %>">
|
||||
<form class="locale-form">
|
||||
<label class="inline-block" for="locale-switcher">
|
||||
<%= t("layouts.header.locale") %>
|
||||
|
||||
@@ -124,6 +124,24 @@ describe "Admin shifts" do
|
||||
expect(page).to have_select("shift_date_recount_scrutiny_date", options: ["Select day", *recount_scrutiny_dates])
|
||||
end
|
||||
|
||||
scenario "Change option from Recount & Scrutinity to Collect Votes", :js do
|
||||
booth = create(:poll_booth)
|
||||
officer = create(:poll_officer)
|
||||
|
||||
create(:poll_shift, :vote_collection_task, officer: officer, booth: booth)
|
||||
create(:poll_shift, :recount_scrutiny_task, officer: officer, booth: booth)
|
||||
|
||||
visit new_admin_booth_shift_path(booth, officer_id: officer.id)
|
||||
|
||||
select "Recount & Scrutiny", from: "shift_task"
|
||||
|
||||
expect(page).to have_select("shift_date_recount_scrutiny_date", options: ["Select day"])
|
||||
|
||||
select "Collect Votes", from: "shift_task"
|
||||
|
||||
expect(page).to have_select("shift_date_vote_collection_date", options: ["Voting days ended"])
|
||||
end
|
||||
|
||||
scenario "Error on create", :js do
|
||||
poll = create(:poll, :current)
|
||||
booth = create(:poll_booth)
|
||||
|
||||
Reference in New Issue
Block a user