Updated some $attr, $val, and $prop calls.

This commit is contained in:
Nick Winter 2014-01-04 15:49:13 -08:00
parent 4995742d77
commit 01cfcbedc7
11 changed files with 32 additions and 31 deletions

View file

@ -77,13 +77,13 @@ module.exports = class SettingsView extends View
getSubscriptions: ->
inputs = $('#email-pane input[type="checkbox"]', @$el)
inputs = ($(i) for i in inputs)
subs = (i.attr('name') for i in inputs when i.attr('checked'))
subs = (i.attr('name') for i in inputs when i.prop('checked'))
subs = (s.replace('email_', '') for s in subs)
subs
toggleEmailSubscriptions: =>
subs = @getSubscriptions()
$('#email-pane input[type="checkbox"]', @$el).attr('checked', not Boolean(subs.length))
$('#email-pane input[type="checkbox"]', @$el).prop('checked', not Boolean(subs.length))
@save()
save: =>

View file

@ -15,7 +15,7 @@ module.exports = class CLAView extends View
c
onAgree: ->
@$el.find('#agreement-button').attr('disabled', true).text('Saving')
@$el.find('#agreement-button').prop('disabled', true).text('Saving')
$.ajax({
url: "/db/user/me/agreeToCLA"
data: { 'githubUsername': @$el.find('#github-username').val() }

View file

@ -15,11 +15,11 @@ module.exports = class ContributeView extends View
_.forEach checkboxes, (el) ->
el = $(el)
if el.attr('name') in me.get('emailSubscriptions')
el.attr('checked', true)
el.prop('checked', true)
onCheckboxChanged: (e) ->
el = $(e.target)
checked = el.attr('checked')
checked = el.prop('checked')
subscription = el.attr('name')
subscriptions = me.get('emailSubscriptions')
if checked and not (subscription in subscriptions)

View file

@ -160,7 +160,7 @@ module.exports = class ThangTypeEditView extends View
@file = e.target.files[0]
return unless @file
return unless @file.type is 'text/javascript'
@$el.find('#upload-button').val('disabled', true)
@$el.find('#upload-button').prop('disabled', true)
@reader = new FileReader()
@reader.onload = @onFileLoad
@reader.readAsText(@file)

View file

@ -56,7 +56,7 @@ module.exports = class RootView extends CocoView
code2 isnt code and code2.split('-')[0] is code)
for code, localeInfo of locale when not (code in genericCodes) or code is preferred
$select.append(
$("<option></option>").attr("value", code).text(localeInfo.nativeDescription))
$("<option></option>").val(code).text(localeInfo.nativeDescription))
$select.val(preferred).fancySelect()
showDiplomatSuggestionModal: ->

View file

@ -14,6 +14,6 @@ module.exports = class DiplomatSuggestionView extends View
currentSubscriptions = me.get("emailSubscriptions")
me.set("emailSubscriptions", currentSubscriptions.concat ["translator"]) if "translator" not in currentSubscriptions
me.save()
$("#email_translator").attr("checked", 1)
$("#email_translator").prop("checked", 1)
@hide()
return

View file

@ -37,7 +37,7 @@ module.exports = class SignupModalView extends View
@enableModalInProgress(modal) # TODO: part of forms
checkAge: (e) ->
$("#signup-button", @$el).attr 'disabled', not $(e.target).attr('checked')
$("#signup-button", @$el).prop 'disabled', not $(e.target).prop('checked')
createAccount: (e) =>
forms.clearFormAlerts(@$el)
@ -46,7 +46,7 @@ module.exports = class SignupModalView extends View
delete userObject["confirm-age"]
for key, val of me.attributes when key in ["preferredLanguage", "testGroupNumber", "dateCreated", "wizardColor1", "name", "music", "volume"]
userObject[key] ?= val
subscribe = @$el.find('#signup-subscribe').attr('checked')
subscribe = @$el.find('#signup-subscribe').prop('checked')
userObject.emailSubscriptions = if subscribe then ['announcement'] else []
res = tv4.validateMultiple userObject, User.schema.attributes
return forms.applyErrorsToForm(@$el, res.errors) unless res.valid

View file

@ -30,10 +30,11 @@ module.exports = class MultiplayerModal extends View
e.target.select()
updateLinkSection: =>
multiplayer = @$el.find('#multiplayer').attr('checked')
multiplayer = @$el.find('#multiplayer').prop('checked')
la = @$el.find('#link-area')
if multiplayer then la.show() else la.hide()
true
onHidden: ->
multiplayer = Boolean(@$el.find('#multiplayer').attr('checked'))
multiplayer = Boolean(@$el.find('#multiplayer').prop('checked'))
@session.set('multiplayer', multiplayer)

View file

@ -73,7 +73,7 @@ module.exports = class CastButtonView extends View
else
s = $.i18n.t("play_level.tome_cast_button_cast", defaultValue: "Spell Cast")
@castButton.text s
@castButton.attr 'disabled', not castable
@castButton.prop 'disabled', not castable
setAutocastDelay: (delay) ->
#console.log "Set autocast delay to", delay

View file

@ -95,4 +95,4 @@ module.exports = class SpellListEntryView extends View
disabled = not enabled
# Should refactor the disabling list so we can target the spell list separately?
# Should not call it 'editor' any more?
@$el.toggleClass('disabled', disabled).find('*').attr('disabled', disabled)
@$el.toggleClass('disabled', disabled).find('*').prop('disabled', disabled)

View file

@ -353,7 +353,7 @@ module.exports = class PlayLevelView extends View
# Need to set this team stuff before the Tome loads... let's think about this with Scott.
#@setTeam @world.teamForPlayer(@bus.countPlayers()) unless me.team
#$('#multiplayer-team-selection').toggle(@world.playableTeams.length > 1)
# .find('input').attr('checked', -> $(@).val() is me.team)
# .find('input').prop('checked', -> $(@).val() is me.team)
# .bind('change', @setTeam)
onSessionWillSave: (e) ->