mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Updated some $attr, $val, and $prop calls.
This commit is contained in:
parent
4995742d77
commit
01cfcbedc7
11 changed files with 32 additions and 31 deletions
|
@ -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: =>
|
||||
|
|
|
@ -5,17 +5,17 @@ template = require 'templates/cla'
|
|||
module.exports = class CLAView extends View
|
||||
id: "cla-view"
|
||||
template: template
|
||||
|
||||
|
||||
events:
|
||||
'click #agreement-button': 'onAgree'
|
||||
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
c.signedOn = moment(me.get('signedCLA')).format('LLLL') if me.get('signedCLA')
|
||||
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() }
|
||||
|
@ -23,9 +23,9 @@ module.exports = class CLAView extends View
|
|||
success: @onAgreeSucceeded
|
||||
error: @onAgreeFailed
|
||||
})
|
||||
|
||||
|
||||
onAgreeSucceeded: =>
|
||||
@$el.find('#agreement-button').text('Success')
|
||||
|
||||
onAgreeFailed: =>
|
||||
@$el.find('#agreement-button').text('Failed')
|
||||
@$el.find('#agreement-button').text('Failed')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -27,10 +27,10 @@ module.exports = class ThangTypeEditView extends View
|
|||
'click #upload-button': -> @$el.find('input#real-upload-button').click()
|
||||
'change #real-upload-button': 'animationFileChosen'
|
||||
'change #animations-select': 'showAnimation'
|
||||
|
||||
|
||||
subscriptions:
|
||||
'save-new-version': 'saveNewThangType'
|
||||
|
||||
|
||||
# init / render
|
||||
|
||||
constructor: (options, @thangTypeID) ->
|
||||
|
@ -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)
|
||||
|
@ -205,7 +205,7 @@ module.exports = class ThangTypeEditView extends View
|
|||
movieClip.regX = -reg.x
|
||||
movieClip.regY = -reg.y
|
||||
@showDisplayObject(movieClip)
|
||||
|
||||
|
||||
getSpriteOptions: -> { resolutionFactor: @resolution, thang: @mockThang}
|
||||
|
||||
showSprite: (actionName) ->
|
||||
|
@ -215,14 +215,14 @@ module.exports = class ThangTypeEditView extends View
|
|||
@currentSprite?.destroy()
|
||||
@currentSprite = sprite
|
||||
@showDisplayObject(sprite.displayObject)
|
||||
|
||||
|
||||
updatePortrait: ->
|
||||
options = @getSpriteOptions()
|
||||
portrait = @thangType.getPortrait(options)
|
||||
return unless portrait
|
||||
portrait?.attr('id', 'portrait').addClass('img-polaroid')
|
||||
$('#portrait').replaceWith(portrait)
|
||||
|
||||
|
||||
showDisplayObject: (displayObject) ->
|
||||
@clearDisplayObject()
|
||||
displayObject.x = CENTER.x
|
||||
|
|
|
@ -16,7 +16,7 @@ module.exports = class RootView extends CocoView
|
|||
events:
|
||||
"click #logout-button": "logoutAccount"
|
||||
'change .language-dropdown': 'showDiplomatSuggestionModal'
|
||||
|
||||
|
||||
shortcuts:
|
||||
'backspace, delete': 'preventBackspace'
|
||||
# 'backspace': 'preventBackspace'
|
||||
|
@ -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: ->
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -8,7 +8,7 @@ module.exports = class MultiplayerModal extends View
|
|||
events:
|
||||
'click textarea': 'onClickLink'
|
||||
'change #multiplayer': 'updateLinkSection'
|
||||
|
||||
|
||||
constructor: (options) ->
|
||||
super(options)
|
||||
@session = options.session
|
||||
|
@ -21,19 +21,20 @@ module.exports = class MultiplayerModal extends View
|
|||
@session.id)
|
||||
c.multiplayer = @session.get('multiplayer')
|
||||
c
|
||||
|
||||
|
||||
afterRender: ->
|
||||
super()
|
||||
@updateLinkSection()
|
||||
|
||||
|
||||
onClickLink: (e) =>
|
||||
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'))
|
||||
@session.set('multiplayer', multiplayer)
|
||||
multiplayer = Boolean(@$el.find('#multiplayer').prop('checked'))
|
||||
@session.set('multiplayer', multiplayer)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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) ->
|
||||
|
|
Loading…
Reference in a new issue