luca 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,68 @@
1
+ Luca.components.DevelopmentConsole = Luca.View.extend
2
+ name: "development_console"
3
+
4
+ initialize: (@options={})->
5
+ Luca.View::initialize.apply @, arguments
6
+
7
+ beforeRender: ()->
8
+ @$el.append @make("div",class:"luca-ui-development-console")
9
+
10
+ @console_el = @$('.luca-ui-development-console')
11
+
12
+ console.log "Turning into console", @console_el, @$el
13
+
14
+ @console = @console_el.console
15
+ promptLabel: "Coffee> "
16
+ animateScroll: true
17
+ promptHistory: true
18
+ commandValidate: (line)->
19
+ valid = true
20
+
21
+ valid = false if line is ""
22
+
23
+ try
24
+ if CoffeeScript.compile(line)
25
+ valid = true
26
+ else
27
+ valid = false
28
+ catch error
29
+ valid = false
30
+
31
+ valid
32
+
33
+ commandHandle: (line)->
34
+ line = _( line ).strip()
35
+ line = "return #{ line }" unless line.match(/^return/)
36
+
37
+ compiled = CoffeeScript.compile(line)
38
+ try
39
+ ret = eval(compiled)
40
+ val = if ret? then JSON.stringify( ret ) else true
41
+ return val
42
+ catch error
43
+ if error.message.match /circular structure to JSON/
44
+ return ret.toString()
45
+
46
+ error.toString()
47
+
48
+
49
+
50
+
51
+
52
+ # var controller2 = console2.console({
53
+ # promptLabel: 'JavaScript> ',
54
+ # commandValidate:function(line){
55
+ # if (line == "") return false;
56
+ # else return true;
57
+ # },
58
+ # commandHandle:function(line){
59
+ # try { var ret = eval(line);
60
+ # if (typeof ret != 'undefined') return ret.toString();
61
+ # else return true; }
62
+ # catch (e) { return e.toString(); }
63
+ # },
64
+ # animateScroll:true,
65
+ # promptHistory:true,
66
+ # welcomeMessage:'Enter some JavaScript expressions to evaluate.'
67
+ # });
68
+ # controller2.promptText('5 * 4');
data/src/framework.coffee CHANGED
@@ -1,7 +1,7 @@
1
1
  _.mixin( _.string )
2
2
 
3
3
  window.Luca =
4
- VERSION: "0.7.6"
4
+ VERSION: "0.7.7"
5
5
  core: {}
6
6
  containers: {}
7
7
  components: {}
@@ -0,0 +1,15 @@
1
+ .luca-ui-development-console { font-size: 14px; margin-top:1em }
2
+ .luca-ui-development-console div.jquery-console-inner
3
+ { width:900px; height:200px; background:#efefef; padding:0.5em;
4
+ overflow:auto }
5
+ .luca-ui-development-console div.jquery-console-prompt-box
6
+ { color:#444; font-family:monospace; }
7
+ .luca-ui-development-console div.jquery-console-focus span.jquery-console-cursor
8
+ { background:#333; color:#eee; font-weight:bold }
9
+ .luca-ui-development-console div.jquery-console-message-error
10
+ { color:#ef0505; font-family:sans-serif; font-weight:bold;
11
+ padding:0.1em; }
12
+ .luca-ui-development-console div.jquery-console-message-success
13
+ { color:#187718; font-family:monospace;
14
+ padding:0.1em; }
15
+ .luca-ui-development-console span.jquery-console-prompt-label { font-weight:bold }