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: ->
|
getSubscriptions: ->
|
||||||
inputs = $('#email-pane input[type="checkbox"]', @$el)
|
inputs = $('#email-pane input[type="checkbox"]', @$el)
|
||||||
inputs = ($(i) for i in inputs)
|
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 = (s.replace('email_', '') for s in subs)
|
||||||
subs
|
subs
|
||||||
|
|
||||||
toggleEmailSubscriptions: =>
|
toggleEmailSubscriptions: =>
|
||||||
subs = @getSubscriptions()
|
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()
|
||||||
|
|
||||||
save: =>
|
save: =>
|
||||||
|
|
|
@ -5,17 +5,17 @@ template = require 'templates/cla'
|
||||||
module.exports = class CLAView extends View
|
module.exports = class CLAView extends View
|
||||||
id: "cla-view"
|
id: "cla-view"
|
||||||
template: template
|
template: template
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'click #agreement-button': 'onAgree'
|
'click #agreement-button': 'onAgree'
|
||||||
|
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
c = super()
|
c = super()
|
||||||
c.signedOn = moment(me.get('signedCLA')).format('LLLL') if me.get('signedCLA')
|
c.signedOn = moment(me.get('signedCLA')).format('LLLL') if me.get('signedCLA')
|
||||||
c
|
c
|
||||||
|
|
||||||
onAgree: ->
|
onAgree: ->
|
||||||
@$el.find('#agreement-button').attr('disabled', true).text('Saving')
|
@$el.find('#agreement-button').prop('disabled', true).text('Saving')
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/db/user/me/agreeToCLA"
|
url: "/db/user/me/agreeToCLA"
|
||||||
data: { 'githubUsername': @$el.find('#github-username').val() }
|
data: { 'githubUsername': @$el.find('#github-username').val() }
|
||||||
|
@ -23,9 +23,9 @@ module.exports = class CLAView extends View
|
||||||
success: @onAgreeSucceeded
|
success: @onAgreeSucceeded
|
||||||
error: @onAgreeFailed
|
error: @onAgreeFailed
|
||||||
})
|
})
|
||||||
|
|
||||||
onAgreeSucceeded: =>
|
onAgreeSucceeded: =>
|
||||||
@$el.find('#agreement-button').text('Success')
|
@$el.find('#agreement-button').text('Success')
|
||||||
|
|
||||||
onAgreeFailed: =>
|
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) ->
|
_.forEach checkboxes, (el) ->
|
||||||
el = $(el)
|
el = $(el)
|
||||||
if el.attr('name') in me.get('emailSubscriptions')
|
if el.attr('name') in me.get('emailSubscriptions')
|
||||||
el.attr('checked', true)
|
el.prop('checked', true)
|
||||||
|
|
||||||
onCheckboxChanged: (e) ->
|
onCheckboxChanged: (e) ->
|
||||||
el = $(e.target)
|
el = $(e.target)
|
||||||
checked = el.attr('checked')
|
checked = el.prop('checked')
|
||||||
subscription = el.attr('name')
|
subscription = el.attr('name')
|
||||||
subscriptions = me.get('emailSubscriptions')
|
subscriptions = me.get('emailSubscriptions')
|
||||||
if checked and not (subscription in subscriptions)
|
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()
|
'click #upload-button': -> @$el.find('input#real-upload-button').click()
|
||||||
'change #real-upload-button': 'animationFileChosen'
|
'change #real-upload-button': 'animationFileChosen'
|
||||||
'change #animations-select': 'showAnimation'
|
'change #animations-select': 'showAnimation'
|
||||||
|
|
||||||
subscriptions:
|
subscriptions:
|
||||||
'save-new-version': 'saveNewThangType'
|
'save-new-version': 'saveNewThangType'
|
||||||
|
|
||||||
# init / render
|
# init / render
|
||||||
|
|
||||||
constructor: (options, @thangTypeID) ->
|
constructor: (options, @thangTypeID) ->
|
||||||
|
@ -160,7 +160,7 @@ module.exports = class ThangTypeEditView extends View
|
||||||
@file = e.target.files[0]
|
@file = e.target.files[0]
|
||||||
return unless @file
|
return unless @file
|
||||||
return unless @file.type is 'text/javascript'
|
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 = new FileReader()
|
||||||
@reader.onload = @onFileLoad
|
@reader.onload = @onFileLoad
|
||||||
@reader.readAsText(@file)
|
@reader.readAsText(@file)
|
||||||
|
@ -205,7 +205,7 @@ module.exports = class ThangTypeEditView extends View
|
||||||
movieClip.regX = -reg.x
|
movieClip.regX = -reg.x
|
||||||
movieClip.regY = -reg.y
|
movieClip.regY = -reg.y
|
||||||
@showDisplayObject(movieClip)
|
@showDisplayObject(movieClip)
|
||||||
|
|
||||||
getSpriteOptions: -> { resolutionFactor: @resolution, thang: @mockThang}
|
getSpriteOptions: -> { resolutionFactor: @resolution, thang: @mockThang}
|
||||||
|
|
||||||
showSprite: (actionName) ->
|
showSprite: (actionName) ->
|
||||||
|
@ -215,14 +215,14 @@ module.exports = class ThangTypeEditView extends View
|
||||||
@currentSprite?.destroy()
|
@currentSprite?.destroy()
|
||||||
@currentSprite = sprite
|
@currentSprite = sprite
|
||||||
@showDisplayObject(sprite.displayObject)
|
@showDisplayObject(sprite.displayObject)
|
||||||
|
|
||||||
updatePortrait: ->
|
updatePortrait: ->
|
||||||
options = @getSpriteOptions()
|
options = @getSpriteOptions()
|
||||||
portrait = @thangType.getPortrait(options)
|
portrait = @thangType.getPortrait(options)
|
||||||
return unless portrait
|
return unless portrait
|
||||||
portrait?.attr('id', 'portrait').addClass('img-polaroid')
|
portrait?.attr('id', 'portrait').addClass('img-polaroid')
|
||||||
$('#portrait').replaceWith(portrait)
|
$('#portrait').replaceWith(portrait)
|
||||||
|
|
||||||
showDisplayObject: (displayObject) ->
|
showDisplayObject: (displayObject) ->
|
||||||
@clearDisplayObject()
|
@clearDisplayObject()
|
||||||
displayObject.x = CENTER.x
|
displayObject.x = CENTER.x
|
||||||
|
|
|
@ -16,7 +16,7 @@ module.exports = class RootView extends CocoView
|
||||||
events:
|
events:
|
||||||
"click #logout-button": "logoutAccount"
|
"click #logout-button": "logoutAccount"
|
||||||
'change .language-dropdown': 'showDiplomatSuggestionModal'
|
'change .language-dropdown': 'showDiplomatSuggestionModal'
|
||||||
|
|
||||||
shortcuts:
|
shortcuts:
|
||||||
'backspace, delete': 'preventBackspace'
|
'backspace, delete': 'preventBackspace'
|
||||||
# 'backspace': 'preventBackspace'
|
# 'backspace': 'preventBackspace'
|
||||||
|
@ -56,7 +56,7 @@ module.exports = class RootView extends CocoView
|
||||||
code2 isnt code and code2.split('-')[0] is code)
|
code2 isnt code and code2.split('-')[0] is code)
|
||||||
for code, localeInfo of locale when not (code in genericCodes) or code is preferred
|
for code, localeInfo of locale when not (code in genericCodes) or code is preferred
|
||||||
$select.append(
|
$select.append(
|
||||||
$("<option></option>").attr("value", code).text(localeInfo.nativeDescription))
|
$("<option></option>").val(code).text(localeInfo.nativeDescription))
|
||||||
$select.val(preferred).fancySelect()
|
$select.val(preferred).fancySelect()
|
||||||
|
|
||||||
showDiplomatSuggestionModal: ->
|
showDiplomatSuggestionModal: ->
|
||||||
|
|
|
@ -14,6 +14,6 @@ module.exports = class DiplomatSuggestionView extends View
|
||||||
currentSubscriptions = me.get("emailSubscriptions")
|
currentSubscriptions = me.get("emailSubscriptions")
|
||||||
me.set("emailSubscriptions", currentSubscriptions.concat ["translator"]) if "translator" not in currentSubscriptions
|
me.set("emailSubscriptions", currentSubscriptions.concat ["translator"]) if "translator" not in currentSubscriptions
|
||||||
me.save()
|
me.save()
|
||||||
$("#email_translator").attr("checked", 1)
|
$("#email_translator").prop("checked", 1)
|
||||||
@hide()
|
@hide()
|
||||||
return
|
return
|
||||||
|
|
|
@ -37,7 +37,7 @@ module.exports = class SignupModalView extends View
|
||||||
@enableModalInProgress(modal) # TODO: part of forms
|
@enableModalInProgress(modal) # TODO: part of forms
|
||||||
|
|
||||||
checkAge: (e) ->
|
checkAge: (e) ->
|
||||||
$("#signup-button", @$el).attr 'disabled', not $(e.target).attr('checked')
|
$("#signup-button", @$el).prop 'disabled', not $(e.target).prop('checked')
|
||||||
|
|
||||||
createAccount: (e) =>
|
createAccount: (e) =>
|
||||||
forms.clearFormAlerts(@$el)
|
forms.clearFormAlerts(@$el)
|
||||||
|
@ -46,7 +46,7 @@ module.exports = class SignupModalView extends View
|
||||||
delete userObject["confirm-age"]
|
delete userObject["confirm-age"]
|
||||||
for key, val of me.attributes when key in ["preferredLanguage", "testGroupNumber", "dateCreated", "wizardColor1", "name", "music", "volume"]
|
for key, val of me.attributes when key in ["preferredLanguage", "testGroupNumber", "dateCreated", "wizardColor1", "name", "music", "volume"]
|
||||||
userObject[key] ?= val
|
userObject[key] ?= val
|
||||||
subscribe = @$el.find('#signup-subscribe').attr('checked')
|
subscribe = @$el.find('#signup-subscribe').prop('checked')
|
||||||
userObject.emailSubscriptions = if subscribe then ['announcement'] else []
|
userObject.emailSubscriptions = if subscribe then ['announcement'] else []
|
||||||
res = tv4.validateMultiple userObject, User.schema.attributes
|
res = tv4.validateMultiple userObject, User.schema.attributes
|
||||||
return forms.applyErrorsToForm(@$el, res.errors) unless res.valid
|
return forms.applyErrorsToForm(@$el, res.errors) unless res.valid
|
||||||
|
|
|
@ -8,7 +8,7 @@ module.exports = class MultiplayerModal extends View
|
||||||
events:
|
events:
|
||||||
'click textarea': 'onClickLink'
|
'click textarea': 'onClickLink'
|
||||||
'change #multiplayer': 'updateLinkSection'
|
'change #multiplayer': 'updateLinkSection'
|
||||||
|
|
||||||
constructor: (options) ->
|
constructor: (options) ->
|
||||||
super(options)
|
super(options)
|
||||||
@session = options.session
|
@session = options.session
|
||||||
|
@ -21,19 +21,20 @@ module.exports = class MultiplayerModal extends View
|
||||||
@session.id)
|
@session.id)
|
||||||
c.multiplayer = @session.get('multiplayer')
|
c.multiplayer = @session.get('multiplayer')
|
||||||
c
|
c
|
||||||
|
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
super()
|
super()
|
||||||
@updateLinkSection()
|
@updateLinkSection()
|
||||||
|
|
||||||
onClickLink: (e) =>
|
onClickLink: (e) =>
|
||||||
e.target.select()
|
e.target.select()
|
||||||
|
|
||||||
updateLinkSection: =>
|
updateLinkSection: =>
|
||||||
multiplayer = @$el.find('#multiplayer').attr('checked')
|
multiplayer = @$el.find('#multiplayer').prop('checked')
|
||||||
la = @$el.find('#link-area')
|
la = @$el.find('#link-area')
|
||||||
if multiplayer then la.show() else la.hide()
|
if multiplayer then la.show() else la.hide()
|
||||||
|
true
|
||||||
|
|
||||||
onHidden: ->
|
onHidden: ->
|
||||||
multiplayer = Boolean(@$el.find('#multiplayer').attr('checked'))
|
multiplayer = Boolean(@$el.find('#multiplayer').prop('checked'))
|
||||||
@session.set('multiplayer', multiplayer)
|
@session.set('multiplayer', multiplayer)
|
||||||
|
|
|
@ -73,7 +73,7 @@ module.exports = class CastButtonView extends View
|
||||||
else
|
else
|
||||||
s = $.i18n.t("play_level.tome_cast_button_cast", defaultValue: "Spell Cast")
|
s = $.i18n.t("play_level.tome_cast_button_cast", defaultValue: "Spell Cast")
|
||||||
@castButton.text s
|
@castButton.text s
|
||||||
@castButton.attr 'disabled', not castable
|
@castButton.prop 'disabled', not castable
|
||||||
|
|
||||||
setAutocastDelay: (delay) ->
|
setAutocastDelay: (delay) ->
|
||||||
#console.log "Set autocast delay to", delay
|
#console.log "Set autocast delay to", delay
|
||||||
|
|
|
@ -95,4 +95,4 @@ module.exports = class SpellListEntryView extends View
|
||||||
disabled = not enabled
|
disabled = not enabled
|
||||||
# Should refactor the disabling list so we can target the spell list separately?
|
# Should refactor the disabling list so we can target the spell list separately?
|
||||||
# Should not call it 'editor' any more?
|
# 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.
|
# 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
|
#@setTeam @world.teamForPlayer(@bus.countPlayers()) unless me.team
|
||||||
#$('#multiplayer-team-selection').toggle(@world.playableTeams.length > 1)
|
#$('#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)
|
# .bind('change', @setTeam)
|
||||||
|
|
||||||
onSessionWillSave: (e) ->
|
onSessionWillSave: (e) ->
|
||||||
|
|
Reference in a new issue