Merge pull request #3338 from consul/backport-coffeelint
Add CoffeeLint rules
This commit is contained in:
@@ -8,12 +8,12 @@ App.Banners =
|
||||
.addClass(style, true)
|
||||
|
||||
update_background_color: (selector, text_selector, background_color) ->
|
||||
$(selector).css('background-color', background_color);
|
||||
$(text_selector).val(background_color);
|
||||
$(selector).css('background-color', background_color)
|
||||
$(text_selector).val(background_color)
|
||||
|
||||
update_font_color: (selector, text_selector, font_color) ->
|
||||
$(selector).css('color', font_color);
|
||||
$(text_selector).val(font_color);
|
||||
$(selector).css('color', font_color)
|
||||
$(text_selector).val(font_color)
|
||||
|
||||
initialize: ->
|
||||
$('[data-js-banner-title]').on
|
||||
@@ -26,18 +26,18 @@ App.Banners =
|
||||
|
||||
$("#banner_background_color_picker").on
|
||||
change: ->
|
||||
App.Banners.update_background_color("#js-banner-background", "#banner_background_color", $(this).val());
|
||||
App.Banners.update_background_color("#js-banner-background", "#banner_background_color", $(this).val())
|
||||
|
||||
$("#banner_background_color").on
|
||||
change: ->
|
||||
App.Banners.update_background_color("#js-banner-background", "#banner_background_color_picker", $(this).val());
|
||||
App.Banners.update_background_color("#js-banner-background", "#banner_background_color_picker", $(this).val())
|
||||
|
||||
$("#banner_font_color_picker").on
|
||||
change: ->
|
||||
App.Banners.update_font_color("#js-banner-title", "#banner_font_color", $(this).val());
|
||||
App.Banners.update_font_color("#js-banner-description", "#banner_font_color", $(this).val());
|
||||
App.Banners.update_font_color("#js-banner-title", "#banner_font_color", $(this).val())
|
||||
App.Banners.update_font_color("#js-banner-description", "#banner_font_color", $(this).val())
|
||||
|
||||
$("#banner_font_color").on
|
||||
change: ->
|
||||
App.Banners.update_font_color("#js-banner-title", "#banner_font_color_picker", $(this).val());
|
||||
App.Banners.update_font_color("#js-banner-description", "#banner_font_color_picker", $(this).val());
|
||||
App.Banners.update_font_color("#js-banner-title", "#banner_font_color_picker", $(this).val())
|
||||
App.Banners.update_font_color("#js-banner-description", "#banner_font_color_picker", $(this).val())
|
||||
|
||||
@@ -8,6 +8,3 @@ App.CheckAllNone =
|
||||
$('[data-check-none]').on 'click', ->
|
||||
target_name = $(this).data('check-none')
|
||||
$("[name='" + target_name + "']").prop('checked', false)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,5 +8,3 @@ App.CheckboxToggle =
|
||||
$target.show()
|
||||
else
|
||||
$target.hide()
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ App.Globalize =
|
||||
if $(this).data("locale") == locale
|
||||
$(this).show()
|
||||
App.Globalize.highlight_locale($(this))
|
||||
$(".js-globalize-locale option:selected").removeAttr("selected");
|
||||
$(".js-globalize-locale option:selected").removeAttr("selected")
|
||||
return
|
||||
|
||||
display_translations: (locale) ->
|
||||
@@ -19,14 +19,14 @@ App.Globalize =
|
||||
$('#js_delete_' + locale).show()
|
||||
|
||||
highlight_locale: (element) ->
|
||||
$('.js-globalize-locale-link').removeClass('is-active');
|
||||
element.addClass('is-active');
|
||||
$('.js-globalize-locale-link').removeClass('is-active')
|
||||
element.addClass('is-active')
|
||||
|
||||
remove_language: (locale) ->
|
||||
$(".js-globalize-attribute[data-locale=" + locale + "]").each ->
|
||||
$(this).val('').hide()
|
||||
if CKEDITOR.instances[$(this).attr('id')]
|
||||
CKEDITOR.instances[$(this).attr('id')].setData('')
|
||||
CKEDITOR.instances[$(this).attr('id')].setData('')
|
||||
$(".js-globalize-locale-link[data-locale=" + locale + "]").hide()
|
||||
next = $(".js-globalize-locale-link:visible").first()
|
||||
App.Globalize.highlight_locale(next)
|
||||
|
||||
@@ -2,6 +2,6 @@ App.InvestmentReportAlert =
|
||||
initialize: ->
|
||||
$('#js-investment-report-alert').on 'click', ->
|
||||
if this.checked && $('#budget_investment_feasibility_unfeasible').is(':checked')
|
||||
confirm(this.dataset.alert + "\n" + this.dataset.notFeasibleAlert);
|
||||
confirm(this.dataset.alert + "\n" + this.dataset.notFeasibleAlert)
|
||||
else if this.checked
|
||||
confirm(this.dataset.alert);
|
||||
confirm(this.dataset.alert)
|
||||
|
||||
@@ -38,7 +38,7 @@ App.LegislationAnnotatable =
|
||||
|
||||
renderAnnotationComments: (event) ->
|
||||
if event.offset
|
||||
$("#comments-box").css({top: event.offset - $('.calc-comments').offset().top})
|
||||
$("#comments-box").css({ top: event.offset - $('.calc-comments').offset().top })
|
||||
|
||||
if App.LegislationAnnotatable.isMobile()
|
||||
return
|
||||
@@ -105,7 +105,7 @@ App.LegislationAnnotatable =
|
||||
dataType: 'script').done (->
|
||||
$('#new_legislation_annotation #legislation_annotation_quote').val(@annotation.quote)
|
||||
$('#new_legislation_annotation #legislation_annotation_ranges').val(JSON.stringify(@annotation.ranges))
|
||||
$('#comments-box').css({top: position.top - $('.calc-comments').offset().top})
|
||||
$('#comments-box').css({ top: position.top - $('.calc-comments').offset().top })
|
||||
|
||||
unless $('[data-legislation-open-phase]').data('legislation-open-phase') == false
|
||||
App.LegislationAnnotatable.highlight('#7fff9a')
|
||||
@@ -143,7 +143,7 @@ App.LegislationAnnotatable =
|
||||
el.addClass('current-annotation')
|
||||
$('#comments-box').html('')
|
||||
App.LegislationAllegations.show_comments()
|
||||
$('html,body').animate({scrollTop: el.offset().top})
|
||||
$('html,body').animate({ scrollTop: el.offset().top })
|
||||
$.event.trigger
|
||||
type: "renderLegislationAnnotation"
|
||||
annotation_id: ann_id
|
||||
|
||||
@@ -3,6 +3,3 @@ App.LocationChanger =
|
||||
initialize: ->
|
||||
$('.js-location-changer').on 'change', ->
|
||||
window.location.assign($(this).val())
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ App.Map =
|
||||
App.Map.initializeMap map
|
||||
|
||||
$('.js-toggle-map').on
|
||||
click: ->
|
||||
App.Map.toggleMap()
|
||||
click: ->
|
||||
App.Map.toggleMap()
|
||||
|
||||
initializeMap: (element) ->
|
||||
App.Map.cleanInvestmentCoordinates(element)
|
||||
@@ -27,12 +27,13 @@ App.Map =
|
||||
removeMarkerSelector = $(element).data('marker-remove-selector')
|
||||
addMarkerInvestments = $(element).data('marker-investments-coordinates')
|
||||
editable = $(element).data('marker-editable')
|
||||
marker = null;
|
||||
marker = null
|
||||
markerIcon = L.divIcon(
|
||||
className: 'map-marker'
|
||||
iconSize: [30, 30]
|
||||
iconAnchor: [15, 40]
|
||||
html: '<div class="map-icon"></div>')
|
||||
className: 'map-marker'
|
||||
iconSize: [30, 30]
|
||||
iconAnchor: [15, 40]
|
||||
html: '<div class="map-icon"></div>'
|
||||
)
|
||||
|
||||
createMarker = (latitude, longitude) ->
|
||||
markerLatLng = new (L.LatLng)(latitude, longitude)
|
||||
@@ -46,7 +47,7 @@ App.Map =
|
||||
e.preventDefault()
|
||||
if marker
|
||||
map.removeLayer(marker)
|
||||
marker = null;
|
||||
marker = null
|
||||
clearFormfields()
|
||||
return
|
||||
|
||||
@@ -105,8 +106,8 @@ App.Map =
|
||||
marker.on 'click', openMarkerPopup
|
||||
|
||||
toggleMap: ->
|
||||
$('.map').toggle()
|
||||
$('.js-location-map-remove-marker').toggle()
|
||||
$('.map').toggle()
|
||||
$('.js-location-map-remove-marker').toggle()
|
||||
|
||||
cleanInvestmentCoordinates: (element) ->
|
||||
markers = $(element).attr('data-marker-investments-coordinates')
|
||||
|
||||
@@ -4,7 +4,7 @@ App.Polls =
|
||||
rand = ''
|
||||
for n in [0..5]
|
||||
rand = Math.random().toString(36).substr(2) # remove `0.`
|
||||
token = token + rand;
|
||||
token = token + rand
|
||||
|
||||
token = token.substring(0, 64)
|
||||
return token
|
||||
@@ -23,7 +23,7 @@ App.Polls =
|
||||
click: =>
|
||||
token_message = $(".js-token-message")
|
||||
if !token_message.is(':visible')
|
||||
token_message.html(token_message.html() + "<br><strong>" + @token + "</strong>");
|
||||
token_message.html(token_message.html() + "<br><strong>" + @token + "</strong>")
|
||||
token_message.show()
|
||||
false
|
||||
|
||||
@@ -32,13 +32,12 @@ App.Polls =
|
||||
answer = $(element).closest('div.answer')
|
||||
|
||||
if $(answer).hasClass('medium-6')
|
||||
$(answer).removeClass("medium-6");
|
||||
$(answer).addClass("answer-divider");
|
||||
$(answer).removeClass("medium-6")
|
||||
$(answer).addClass("answer-divider")
|
||||
unless $(answer).hasClass('first')
|
||||
$(answer).insertBefore($(answer).prev('div.answer'));
|
||||
$(answer).insertBefore($(answer).prev('div.answer'))
|
||||
else
|
||||
$(answer).addClass("medium-6");
|
||||
$(answer).removeClass("answer-divider");
|
||||
$(answer).addClass("medium-6")
|
||||
$(answer).removeClass("answer-divider")
|
||||
unless $(answer).hasClass('first')
|
||||
$(answer).insertAfter($(answer).next('div.answer'));
|
||||
|
||||
$(answer).insertAfter($(answer).next('div.answer'))
|
||||
|
||||
@@ -5,8 +5,8 @@ App.PollsAdmin =
|
||||
change: ->
|
||||
switch ($(this).val())
|
||||
when 'vote_collection'
|
||||
$("select[class='js-shift-vote-collection-dates']").show();
|
||||
$("select[class='js-shift-recount-scrutiny-dates']").hide();
|
||||
$("select[class='js-shift-vote-collection-dates']").show()
|
||||
$("select[class='js-shift-recount-scrutiny-dates']").hide()
|
||||
when 'recount_scrutiny'
|
||||
$("select[class='js-shift-recount-scrutiny-dates']").show();
|
||||
$("select[class='js-shift-vote-collection-dates']").hide();
|
||||
$("select[class='js-shift-recount-scrutiny-dates']").show()
|
||||
$("select[class='js-shift-vote-collection-dates']").hide()
|
||||
|
||||
@@ -22,15 +22,15 @@ App.PreventDoubleSubmission =
|
||||
|
||||
initialize: ->
|
||||
$('form').on('submit', (event) ->
|
||||
unless event.target.id == "new_officing_voter" ||
|
||||
unless event.target.id == "new_officing_voter" ||
|
||||
event.target.id == "admin_download_emails"
|
||||
|
||||
buttons = $(this).find(':button, :submit')
|
||||
App.PreventDoubleSubmission.disable_buttons(buttons)
|
||||
).on('ajax:success', (event) ->
|
||||
unless event.target.id == "new_officing_voter" ||
|
||||
unless event.target.id == "new_officing_voter" ||
|
||||
event.target.id == "admin_download_emails"
|
||||
|
||||
|
||||
buttons = $(this).find(':button, :submit')
|
||||
App.PreventDoubleSubmission.reset_buttons(buttons)
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
App.SendAdminNotificationAlert =
|
||||
initialize: ->
|
||||
$('#js-send-admin_notification-alert').on 'click', ->
|
||||
confirm(this.dataset.alert);
|
||||
confirm(this.dataset.alert)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
App.SendNewsletterAlert =
|
||||
initialize: ->
|
||||
$('#js-send-newsletter-alert').on 'click', ->
|
||||
confirm(this.dataset.alert);
|
||||
confirm(this.dataset.alert)
|
||||
|
||||
@@ -4,4 +4,4 @@ App.SocialShare =
|
||||
$(".social-share-button a").each ->
|
||||
element = $(this)
|
||||
site = element.data('site')
|
||||
element.append("<span class='show-for-sr'>#{site}</span>")
|
||||
element.append("<span class='show-for-sr'>#{site}</span>")
|
||||
|
||||
@@ -2,8 +2,8 @@ App.Sortable =
|
||||
initialize: ->
|
||||
$(".sortable").sortable
|
||||
update: (event, ui) ->
|
||||
new_order = $(this).sortable('toArray', {attribute: 'data-answer-id'});
|
||||
new_order = $(this).sortable('toArray', { attribute: 'data-answer-id' })
|
||||
$.ajax
|
||||
url: $('.sortable').data('js-url'),
|
||||
data: {ordered_list: new_order},
|
||||
data: { ordered_list: new_order },
|
||||
type: 'POST'
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
buildGraph = (el) ->
|
||||
url = $(el).data 'graph'
|
||||
conf = bindto: el, data: {x: 'x', url: url, mimeType: 'json'}, axis: { x: {type: 'timeseries',tick: { format: '%Y-%m-%d' } }}
|
||||
conf = bindto: el, data: { x: 'x', url: url, mimeType: 'json' }, axis: { x: { type: 'timeseries', tick: { format: '%Y-%m-%d' } } }
|
||||
graph = c3.generate conf
|
||||
|
||||
App.Stats =
|
||||
|
||||
@@ -9,7 +9,7 @@ App.Suggest =
|
||||
callback = ->
|
||||
$.ajax
|
||||
url: $this.data('js-url')
|
||||
data: {search: $this.val()},
|
||||
data: { search: $this.val() },
|
||||
type: 'GET',
|
||||
dataType: 'html'
|
||||
success: (stHtml) ->
|
||||
|
||||
@@ -20,4 +20,3 @@ App.TableSortable =
|
||||
table.append rows[i]
|
||||
i++
|
||||
return
|
||||
|
||||
@@ -11,24 +11,24 @@ App.TagAutocomplete =
|
||||
source: (request, response) ->
|
||||
$.ajax
|
||||
url: $('.tag-autocomplete').data('js-url'),
|
||||
data: {search: App.TagAutocomplete.extractLast( request.term )},
|
||||
data: { search: App.TagAutocomplete.extractLast( request.term ) },
|
||||
type: 'GET',
|
||||
dataType: 'json'
|
||||
success: ( data ) ->
|
||||
response( data );
|
||||
response( data )
|
||||
|
||||
minLength: 0,
|
||||
search: ->
|
||||
App.TagAutocomplete.extractLast( this.value );
|
||||
App.TagAutocomplete.extractLast( this.value )
|
||||
focus: ->
|
||||
return false;
|
||||
return false
|
||||
select: ( event, ui ) -> (
|
||||
terms = App.TagAutocomplete.split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
return false;);
|
||||
terms = App.TagAutocomplete.split( this.value )
|
||||
terms.pop()
|
||||
terms.push( ui.item.value )
|
||||
terms.push( "" )
|
||||
this.value = terms.join( ", " )
|
||||
return false;)
|
||||
|
||||
initialize: ->
|
||||
App.TagAutocomplete.init_autocomplete();
|
||||
App.TagAutocomplete.init_autocomplete()
|
||||
|
||||
@@ -34,4 +34,3 @@ App.TreeNavigator =
|
||||
link.parents('ul').each ->
|
||||
$(this).show()
|
||||
$(this).siblings('span').removeClass('closed').addClass('open')
|
||||
|
||||
|
||||
@@ -29,4 +29,4 @@ App.ValuationBudgetInvestmentForm =
|
||||
initialize: ->
|
||||
App.ValuationBudgetInvestmentForm.showFeasibilityFields()
|
||||
App.ValuationBudgetInvestmentForm.showFeasibilityFieldsOnChange()
|
||||
false
|
||||
false
|
||||
|
||||
@@ -29,4 +29,4 @@ App.ValuationSpendingProposalForm =
|
||||
initialize: ->
|
||||
App.ValuationSpendingProposalForm.showFeasibilityFields()
|
||||
App.ValuationSpendingProposalForm.showFeasibilityFieldsOnChange()
|
||||
false
|
||||
false
|
||||
|
||||
Reference in New Issue
Block a user