Support for seeing this.now() in spell palette.

This commit is contained in:
Nick Winter 2014-02-14 16:52:50 -08:00
parent 2b1079912a
commit 50f683534f
6 changed files with 28 additions and 12 deletions

View file

@ -11,5 +11,5 @@ module.exports.load = (key) ->
module.exports.save = (key, value) ->
s = JSON.stringify(value)
localStorage.setItem(key, s)
module.exports.remove = (key) -> localStorage.removeItem key
module.exports.remove = (key) -> localStorage.removeItem key

View file

@ -1,5 +1,5 @@
button.close(type="button", data-dismiss="alert") ×
span.problem-message= message
span.problem-message!= message
if hint
br
span.problem-hint= hint
span.problem-hint!= hint

View file

@ -17,7 +17,7 @@ else if doc.type == 'function'
div
code= doc.owner + '.' + doc.name + '(' + argumentExamples.join(', ') + ');'
if doc.type != 'function' && doc.type != 'snippet'
if (doc.type != 'function' && doc.type != 'snippet') || doc.name == 'now'
p.value
strong Current Value:
pre

View file

@ -17,8 +17,9 @@ module.exports = class ProblemAlertView extends View
getRenderData: (context={}) ->
context = super context
context.message = @problem.aetherProblem.message.replace("\n", "<br>")
context.hint = @problem.aetherProblem.hint?.replace("\n", "<br>")
format = (s) -> s?.replace("\n", "<br>").replace('<', '&lt;').replace('>', '&gt;')
context.message = format @problem.aetherProblem.message
context.hint = format @problem.aetherProblem.hint
context
afterRender: ->

View file

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

View file

@ -15,12 +15,26 @@ exports.config =
javascripts:
defaultExtension: 'coffee'
joinTo:
'javascripts/world.js': /^((app(\/|\\)lib(\/|\\)world(?!(\/|\\)test))|(app(\/|\\)lib(\/|\\)CocoClass.coffee)|(app(\/|\\)lib(\/|\\)utils.coffee)|(vendor(\/|\\)scripts(\/|\\)Box2dWeb-2.1.a.3)|(bower_components(\/|\\)lodash(\/|\\)dist(\/|\\)lodash.js)|(vendor(\/|\\)scripts(\/|\\)string_score.js)|(bower_components(\/|\\)aether(\/|\\)build(\/|\\)aether.js))/
'javascripts/world.js': ///^(
(app[\/\\]lib[\/\\]world(?![\/\\]test))
|(app[\/\\]lib[\/\\]CocoClass.coffee)
|(app[\/\\]lib[\/\\]utils.coffee)
|(vendor[\/\\]scripts[\/\\]Box2dWeb-2.1.a.3)
|(vendor[\/\\]scripts[\/\\]string_score.js)
|(bower_components[\/\\]lodash[\/\\]dist[\/\\]lodash.js)
|(bower_components[\/\\]aether[\/\\]build[\/\\]aether.js)
)///
'javascripts/app.js': /^app/
'javascripts/vendor.js': /^(vendor(\/|\\)(?!(scripts\/Box2d|scripts\/box2d))|bower_components)/
'javascripts/vendor_with_box2d.js': /^(vendor(\/|\\)(?!scripts\/box2d)|bower_components)/ # include box2dweb for profiling (and for IE9...)
'test/javascripts/test.js': /^test(\/|\\)(?!vendor)/
'test/javascripts/test-vendor.js': /^test(\/|\\)(?=vendor)/
'javascripts/vendor.js': ///^(
vendor[\/\\](?!(scripts[\/\\]Box2d|scripts[\/\\]box2d))
|bower_components
)///
'javascripts/vendor_with_box2d.js': ///^(
vendor[\/\\](?!scripts[\/\\]box2d)
|bower_components # include box2dweb for profiling (and for IE9...)
)///
'test/javascripts/test.js': /^test[\/\\](?!vendor)/
'test/javascripts/test-vendor.js': /^test[\/\\](?=vendor)/
order:
before: [
'bower_components/jquery/jquery.js'