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

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

View file

@ -17,7 +17,7 @@ else if doc.type == 'function'
div div
code= doc.owner + '.' + doc.name + '(' + argumentExamples.join(', ') + ');' 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 p.value
strong Current Value: strong Current Value:
pre pre

View file

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

View file

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

View file

@ -15,12 +15,26 @@ exports.config =
javascripts: javascripts:
defaultExtension: 'coffee' defaultExtension: 'coffee'
joinTo: 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/app.js': /^app/
'javascripts/vendor.js': /^(vendor(\/|\\)(?!(scripts\/Box2d|scripts\/box2d))|bower_components)/ 'javascripts/vendor.js': ///^(
'javascripts/vendor_with_box2d.js': /^(vendor(\/|\\)(?!scripts\/box2d)|bower_components)/ # include box2dweb for profiling (and for IE9...) vendor[\/\\](?!(scripts[\/\\]Box2d|scripts[\/\\]box2d))
'test/javascripts/test.js': /^test(\/|\\)(?!vendor)/ |bower_components
'test/javascripts/test-vendor.js': /^test(\/|\\)(?=vendor)/ )///
'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: order:
before: [ before: [
'bower_components/jquery/jquery.js' 'bower_components/jquery/jquery.js'