Conflicts:
	app/views/play/level_view.coffee
This commit is contained in:
Scott Erickson 2014-02-13 10:04:42 -08:00
commit df2171e921
28 changed files with 120 additions and 127 deletions

View file

@ -1,6 +1,10 @@
@import "bootstrap/variables"
@import "bootstrap/mixins"
// https://github.com/twbs/bootstrap/issues/9237 -- need a version that's not !important
.secret
display: none
h1 h2 h3 h4
letter-spacing: 2px

View file

@ -8,7 +8,7 @@ block content
p(data-i18n="account_settings.not_logged_in") Log in or create an account to change your settings.
else
button.btn#save-button.disabled.hide(data-i18n="account_settings.saveBackups") Changes Save Automatically
button.btn#save-button.disabled.secret(data-i18n="account_settings.saveBackups") Changes Save Automatically
ul.nav.nav-pills#settings-tabs
li

View file

@ -9,9 +9,9 @@ block content
button.btn.btn-warning#unsubscribe-button(data-i18n="account.unsubscribe_button") Do it
.progress.progress-striped.active.hide
.progress.progress-striped.active.secret
.progress-bar
p.hide#fail-alert(data-i18n="account.unsubscribe_failed").alert.alert-danger Failed
p.secret#fail-alert(data-i18n="account.unsubscribe_failed").alert.alert-danger Failed
p.hide#success-alert(data-i18n="account.unsubscribe_success").alert.alert-success Success
p.secret#success-alert(data-i18n="account.unsubscribe_success").alert.alert-success Success

View file

@ -3,13 +3,13 @@ div.well
span#thang-props
a#thang-name-link
span= thang.id
input.hide(value=thang.id)
input.secret(value=thang.id)
| (
span(data-i18n="editor.level_components_type") Type
| :
a#thang-type-link
span= thang.thangType
input.hide(value=thang.thangType)
input.secret(value=thang.thangType)
| )
#thang-components-edit-view

View file

@ -31,4 +31,4 @@
- path = '/file/db/thang.type/'+thangType.original+'/portrait.png'
img(title="Add " + thangType.name, src=path, alt="")
div.clearfix
#editor-level-thang-edit.hide
#editor-level-thang-edit.secret

View file

@ -1,6 +1,6 @@
div#color-groups-treema
div#color-group-settings.hide
div#color-group-settings.secret
div#shape-buttons
canvas#tinting-display(width=400, height=400)

View file

@ -21,7 +21,7 @@ block content
.modal-footer
button.btn(data-dismiss="modal") Cancel
button.btn.btn-primary.new-model-submit Create
.modal-body.wait.hide
.modal-body.wait.secret
h3 Reticulating Splines...
.progress.progress-striped.active
.progress-bar

View file

@ -22,6 +22,6 @@ block modal-body-content
textarea#contact-message.form-control(name="message", rows=8)
block modal-footer-content
span.sending-indicator.pull-left.hide(data-i18n="common.sending") Sending...
span.sending-indicator.pull-left.secret(data-i18n="common.sending") Sending...
a(href='#', data-dismiss="modal", aria-hidden="true", data-i18n="common.cancel").btn Cancel
button.btn.btn-primary#contact-submit-button(data-i18n="contact.send") Send Feedback

View file

@ -14,7 +14,7 @@
img(src="http://www.manbitesgod.com/images/picturecoupleb.jpg")
img(src="http://www.manbitesgod.com/images/manrantb.jpg")
.modal-body.wait.hide
.modal-body.wait.secret
block modal-body-wait-content
h3 Reticulating Splines...
.progress.progress-striped.active

View file

@ -11,11 +11,11 @@
#canvas-left-gradient.gradient
#canvas-top-gradient.gradient
a.btn.btn-primary.banner.hide#level-done-button(data-i18n="play_level.done") Done
a.btn.btn-primary.banner.secret#level-done-button(data-i18n="play_level.done") Done
#goals-view.hide
#goals-view.secret
#gold-view.hide.expanded
#gold-view.secret.expanded
#level-chat-view

View file

@ -2,7 +2,7 @@
table
tbody
.open-chat-area.hide
.open-chat-area.secret
table
tbody

View file

@ -15,7 +15,7 @@
button.btn.btn-success.sign-up-button.btn-large(data-toggle="coco-modal", data-target="modal/signup", data-i18n="play_level.victory_sign_up") Sign Up to Save Progress
span(data-i18n="play_level.victory_sign_up_poke") Want to save your code? Create a free account!
else
div.rating.hide
div.rating.secret
span(data-i18n="play_level.victory_rate_the_level") Rate the level:
i.icon-star-empty
i.icon-star-empty
@ -30,7 +30,7 @@
else
a.btn.btn-primary(href="/", data-dismiss="modal", data-i18n="play_level.victory_go_home") Go Home
if !me.get('anonymous')
div.review.hide
div.review.secret
span(data-i18n="play_level.victory_review") Tell us more!
br
textarea

View file

@ -11,7 +11,7 @@ button.btn.btn-xs.btn-inverse#music-button(title="Toggle Music")
| ♫
.scrubber
.progress.hide
.progress.secret
.progress-bar
.scrubber-handle
@ -27,11 +27,11 @@ button.btn.btn-xs.btn-inverse#music-button(title="Toggle Music")
li(title="Ctrl/Cmd + \\: Toggle debug display").selectable#debug-toggle
i.icon-globe
| Debug Mode
i.icon-ok.hide
i.icon-ok.secret
li(title="Ctrl/Cmd + G: Toggle grid display").selectable#grid-toggle
i.icon-th
span(data-i18n="play_level.grid") Grid
i.icon-ok.hide
i.icon-ok.secret
li.selectable#edit-wizard-settings
i.icon-user
span(data-i18n="play_level.customize_wizard") Customize Wizard

View file

@ -102,7 +102,7 @@ module.exports = class SettingsView extends View
res = me.save()
return unless res
save = $('#save-button', @$el).text($.i18n.t('common.saving', defaultValue: 'Saving...'))
.addClass('btn-info').removeClass('hide').removeClass('btn-danger')
.addClass('btn-info').show().removeClass('btn-danger')
res.error ->
errors = JSON.parse(res.responseText)

View file

@ -15,21 +15,21 @@ module.exports = class UnsubscribeView extends RootView
context
onUnsubscribeButtonClicked: ->
@$el.find('#unsubscribe-button').addClass 'hide'
@$el.find('.progress').removeClass 'hide'
@$el.find('.alert').addClass 'hide'
@$el.find('#unsubscribe-button').hide()
@$el.find('.progress').show()
@$el.find('.alert').hide()
email = @getQueryVariable 'email'
url = "/auth/unsubscribe?email=#{encodeURIComponent(email)}"
success = =>
@$el.find('.progress').addClass 'hide'
@$el.find('#success-alert').removeClass 'hide'
@$el.find('.progress').hide()
@$el.find('#success-alert').show()
me.fetch()
error = =>
@$el.find('.progress').addClass 'hide'
@$el.find('#fail-alert').removeClass 'hide'
@$el.find('#unsubscribe-button').removeClass 'hide'
@$el.find('.progress').hide()
@$el.find('#fail-alert').show()
@$el.find('#unsubscribe-button').show()
$.ajax { url: url, success: success, error: error }

View file

@ -57,7 +57,7 @@ module.exports = class WizardSettingsTabView extends RootView
updateSliderVisibility: (colorGroup) ->
enabled = colorGroup.find('.color-group-checkbox').prop('checked')
colorGroup.find('.sliders').toggleClass 'hide', not enabled
colorGroup.find('.sliders').toggle Boolean(enabled)
updateColorSettings: (colorGroup) ->
wizardSettings = me.get('wizard') or {}

View file

@ -67,7 +67,7 @@ module.exports = class LevelThangEditView extends View
span = link.find('span')
input = link.find('input')
if wasEditing then span.text(input.val()) else input.val(span.text())
link.find('span, input').toggleClass('hide')
link.find('span, input').toggle()
input.select() unless wasEditing
@thangData.id = span.text()
@saveThang()
@ -78,7 +78,7 @@ module.exports = class LevelThangEditView extends View
span = link.find('span')
input = link.find('input')
span.text(input.val()) if wasEditing
link.find('span, input').toggleClass('hide')
link.find('span, input').toggle()
input.select() unless wasEditing
thangTypeName = input.val()
thangType = _.find @supermodel.getModels(ThangType), (m) -> m.get('name') is thangTypeName

View file

@ -374,7 +374,7 @@ module.exports = class ThangsTabView extends View
thangData = @thangsTreema.get "id=#{e.thangID}"
@editThangView = new LevelThangEditView thangData: thangData, supermodel: @supermodel, level: @level, world: @world
@insertSubView @editThangView
@$el.find('.thangs-column').addClass('hide')
@$el.find('.thangs-column').hide()
Backbone.Mediator.publish 'level:view-switched', e
onLevelThangEdited: (e) ->
@ -383,7 +383,7 @@ module.exports = class ThangsTabView extends View
onLevelThangDoneEditing: ->
@removeSubView @editThangView
@$el.find('.thangs-column').removeClass('hide')
@$el.find('.thangs-column').show()
class ThangsNode extends TreemaNode.nodeMap.array

View file

@ -130,7 +130,7 @@ module.exports = class ColorsTabView extends CocoView
@thangType.set('colorGroups', @colorGroups.data)
onColorGroupSelected: (e, selected) =>
@$el.find('#color-group-settings').toggleClass('hide', not selected.length)
@$el.find('#color-group-settings').toggle selected.length > 0
treema = @colorGroups.getLastSelectedTreema()
return unless treema
@currentColorGroupTreema = treema

View file

@ -115,7 +115,7 @@ module.exports = class CocoView extends Backbone.View
visibleModal.willDisappear() if visibleModal
visibleModal.destroy()
visibleModal = null
$('#modal-wrapper .modal').off 'hidden.bs.modal', @modalClosed
#$('#modal-wrapper .modal').off 'hidden.bs.modal', @modalClosed
if waitingModal
wm = waitingModal
waitingModal = null
@ -127,7 +127,7 @@ module.exports = class CocoView extends Backbone.View
# Loading RootViews
showLoading: ($el=@$el) ->
$el.find('>').addClass('hide')
$el.find('>').hide()
$el.append($('<div class="loading-screen"></div>')
.append('<h2>Loading</h2>')
.append('<div class="progress progress-striped active loading"><div class="progress-bar"></div></div>'))
@ -136,18 +136,18 @@ module.exports = class CocoView extends Backbone.View
hideLoading: ->
return unless @_lastLoading?
@_lastLoading.find('.loading-screen').remove()
@_lastLoading.find('>').removeClass('hide')
@_lastLoading.find('>').show()
@_lastLoading = null
# Loading ModalViews
enableModalInProgress: (modal) ->
$('> div', modal).addClass('hide')
$('.wait', modal).removeClass('hide')
$('> div', modal).hide()
$('.wait', modal).show()
disableModalInProgress: (modal) ->
$('> div', modal).removeClass('hide')
$('.wait', modal).addClass('hide')
$('> div', modal).show()
$('.wait', modal).hide()
# Subscriptions

View file

@ -46,11 +46,11 @@ module.exports = class GoalsView extends View
li.prepend($('<i></i>').addClass(stateIconMap[state.status]))
list.append(li)
goals.push goal
if goals.length then @$el.removeClass('hide') else @$el.addClass('hide')
@$el.toggle goals.length > 0
render: ->
super()
@$el.addClass('hide').addClass('expanded')
onSetLetterbox: (e) ->
if e.on then @$el.hide() else @$el.show()
@$el.toggle not e.on

View file

@ -19,4 +19,4 @@ module.exports = class GoldView extends View
goldEl.text(e.gold)
onSetLetterbox: (e) ->
if e.on then @$el.hide() else @$el.show()
@$el.toggle not e.on

View file

@ -153,7 +153,7 @@ module.exports = class HUDView extends View
@bubble.removeClass(@lastMood) if @lastMood
@lastMood = mood
@bubble.text('')
group = $('<div class="enter hide"></div>')
group = $('<div class="enter secret"></div>')
@bubble.append(group)
if responses
@lastResponses = responses
@ -176,7 +176,7 @@ module.exports = class HUDView extends View
if @animator.done()
clearInterval(@messageInterval)
@messageInterval = null
$('.enter', @bubble).removeClass("hide").css('opacity', 0.0).delay(500).animate({opacity:1.0}, 500, @animateEnterButton)
$('.enter', @bubble).removeClass("secret").css('opacity', 0.0).delay(500).animate({opacity:1.0}, 500, @animateEnterButton)
if @lastResponses
buttons = $('.enter button')
for response, i in @lastResponses
@ -207,10 +207,10 @@ module.exports = class HUDView extends View
switchToDialogueElements: ->
@dialogueMode = true
$('.thang-elem', @$el).addClass('hide')
@$el.find('.thang-canvas-wrapper').removeClass('hide')
$('.thang-elem', @$el).addClass('secret')
@$el.find('.thang-canvas-wrapper').removeClass('secret')
$('.dialogue-area', @$el)
.removeClass('hide')
.removeClass('secret')
.animate({opacity:1.0}, 200)
$('.dialogue-bubble', @$el)
.css('opacity', 0.0)
@ -220,8 +220,8 @@ module.exports = class HUDView extends View
switchToThangElements: ->
@dialogueMode = false
$('.thang-elem', @$el).removeClass('hide')
$('.dialogue-area', @$el).addClass('hide')
$('.thang-elem', @$el).removeClass('secret')
$('.dialogue-area', @$el).addClass('secret')
update: ->
return unless @thang and not @speaker
@ -321,7 +321,7 @@ module.exports = class HUDView extends View
changed = true
break
return unless changed
ael.toggleClass 'hidden', not timespans.length
ael.toggleClass 'secret', not timespans.length
@lastActionTimespans[action] = timespans
timeline = ael.find('.action-timeline .timeline-wrapper').empty()
lifespan = @thang.world.totalFrames / @thang.world.frameRate

View file

@ -27,10 +27,7 @@ module.exports = class LevelChatView extends View
updateMultiplayerVisibility: ->
return unless @$el?
if @session.get('multiplayer')
@$el.removeClass('hide')
else
@$el.addClass('hide')
@$el.toggle Boolean @session.get('multiplayer')
afterRender: ->
@chatTables = $('table', @$el)
@ -48,7 +45,7 @@ module.exports = class LevelChatView extends View
row.fadeOut(1000, -> $(this).remove())
onNewMessage: (e) ->
@$el.removeClass('hide') unless e.message.system
@$el.show() unless e.message.system
@addOne(e.message)
@trimClosedPanel()
@playNoise() if e.message.authorID isnt me.id
@ -108,16 +105,10 @@ module.exports = class LevelChatView extends View
return false
onIconClick: ->
openPanel = $('.open-chat-area', @$el)
closedPanel = $('.closed-chat-area', @$el)
@open = not @open
if @open
closedPanel.addClass('hide')
openPanel.removeClass('hide')
@scrollDown()
else
openPanel.addClass('hide')
closedPanel.removeClass('hide')
openPanel = $('.open-chat-area', @$el).toggle @open
closedPanel = $('.closed-chat-area', @$el).toggle not @open
@scrollDown() if @open
if window.getSelection?
sel = window.getSelection()
sel.empty?()

View file

@ -35,7 +35,7 @@ module.exports = class MultiplayerModal extends View
updateLinkSection: ->
multiplayer = @$el.find('#multiplayer').prop('checked')
la = @$el.find('#link-area')
if multiplayer then la.show() else la.hide()
la.toggle Boolean(multiplayer)
true
onHidden: ->

View file

@ -55,8 +55,8 @@ module.exports = class PlaybackView extends View
@$el.find('#music-button').toggleClass('music-on', me.get('music'))
onSetLetterbox: (e) ->
button = @$el.find '#play-button, .scrubber-handle'
if e.on then button.css('visibility', 'hidden') else button.css('visibility', 'visible')
buttons = @$el.find '#play-button, .scrubber-handle'
buttons.css 'visibility', if e.on then 'hidden' else 'visible'
@disabled = e.on
onWindowResize: (s...) =>
@ -64,17 +64,17 @@ module.exports = class PlaybackView extends View
onNewWorld: (e) ->
pct = parseInt(100 * e.world.totalFrames / e.world.maxTotalFrames) + '%'
@barWidth = $('.progress', @$el).css('width', pct).removeClass('hide').width()
@barWidth = $('.progress', @$el).css('width', pct).show().width()
onToggleDebug: ->
return if @shouldIgnore()
flag = $('#debug-toggle i.icon-ok')
Backbone.Mediator.publish('level-set-debug', {debug: flag.hasClass('hide')})
Backbone.Mediator.publish('level-set-debug', {debug: flag.hasClass('invisible')})
onToggleGrid: ->
return if @shouldIgnore()
flag = $('#grid-toggle i.icon-ok')
Backbone.Mediator.publish('level-set-grid', {grid: flag.hasClass('hide')})
Backbone.Mediator.publish('level-set-grid', {grid: flag.hasClass('invisible')})
onEditWizardSettings: ->
Backbone.Mediator.publish 'edit-wizard-settings'
@ -145,13 +145,11 @@ module.exports = class PlaybackView extends View
onSetDebug: (e) ->
flag = $('#debug-toggle i.icon-ok')
flag.removeClass('hide')
flag.addClass('hide') unless e.debug
flag.toggleClass 'invisible', not e.debug
onSetGrid: (e) ->
flag = $('#grid-toggle i.icon-ok')
flag.removeClass('hide')
flag.addClass('hide') unless e.grid
flag.toggleClass 'invisible', not e.grid
# to refactor

View file

@ -64,7 +64,7 @@ module.exports = class SpellPaletteEntryView extends View
content.replace /\#\{(.*?)\}/g, (s, properties) => @formatValue downTheChain(owner, properties.split('.'))
formatValue: (v) ->
return '<Function>' if @doc.type is 'function'
return '[Function]' if not v and @doc.type is 'function'
unless v?
if @doc.owner is 'this'
v = @thang[@doc.name]

View file

@ -117,6 +117,7 @@ module.exports = class PlayLevelView extends View
window.onPlayLevelViewLoaded? @ # still a hack
@loadingScreen = new LoadingScreen(@$el.find('canvas')[0])
@loadingScreen.show()
@$el.find('#level-done-button').hide()
super()
onLevelLoaderLoaded: =>
@ -197,8 +198,7 @@ module.exports = class PlayLevelView extends View
onDonePressed: -> @showVictory()
onShowVictory: (e) ->
console.log 'show vict', e
$('#level-done-button').removeClass('hide')
$('#level-done-button').show()
@showVictory() if e.showModal
setTimeout(@preloadNextLevel, 3000)