erp_app 3.0.10 → 3.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. data/lib/erp_app/version.rb +1 -1
  2. data/public/javascripts/erp_app/codemirror/README.md +1 -1
  3. data/public/javascripts/erp_app/codemirror/doc/compress.html +11 -3
  4. data/public/javascripts/erp_app/codemirror/doc/docs.css +16 -5
  5. data/public/javascripts/erp_app/codemirror/doc/internals.html +6 -3
  6. data/public/javascripts/erp_app/codemirror/doc/manual.html +103 -41
  7. data/public/javascripts/erp_app/codemirror/doc/oldrelease.html +43 -5
  8. data/public/javascripts/erp_app/codemirror/doc/reporting.html +6 -3
  9. data/public/javascripts/erp_app/codemirror/doc/upgrade_v2.2.html +7 -4
  10. data/public/javascripts/erp_app/codemirror/keymap/vim.js +10 -6
  11. data/public/javascripts/erp_app/codemirror/lib/codemirror.css +16 -12
  12. data/public/javascripts/erp_app/codemirror/lib/codemirror.js +699 -787
  13. data/public/javascripts/erp_app/codemirror/lib/util/closetag.js +35 -35
  14. data/public/javascripts/erp_app/codemirror/lib/util/dialog.js +4 -1
  15. data/public/javascripts/erp_app/codemirror/lib/util/formatting.js +147 -253
  16. data/public/javascripts/erp_app/codemirror/lib/util/javascript-hint.js +3 -3
  17. data/public/javascripts/erp_app/codemirror/lib/util/loadmode.js +1 -1
  18. data/public/javascripts/erp_app/codemirror/lib/util/multiplex.js +5 -9
  19. data/public/javascripts/erp_app/codemirror/lib/util/overlay.js +3 -1
  20. data/public/javascripts/erp_app/codemirror/lib/util/pig-hint.js +1 -1
  21. data/public/javascripts/erp_app/codemirror/lib/util/runmode-standalone.js +90 -0
  22. data/public/javascripts/erp_app/codemirror/lib/util/runmode.js +8 -4
  23. data/public/javascripts/erp_app/codemirror/lib/util/search.js +4 -4
  24. data/public/javascripts/erp_app/codemirror/lib/util/searchcursor.js +13 -11
  25. data/public/javascripts/erp_app/codemirror/lib/util/simple-hint.js +89 -68
  26. data/public/javascripts/erp_app/codemirror/lib/util/xml-hint.js +8 -8
  27. data/public/javascripts/erp_app/codemirror/mode/clike/clike.js +6 -2
  28. data/public/javascripts/erp_app/codemirror/mode/clike/index.html +1 -0
  29. data/public/javascripts/erp_app/codemirror/mode/clike/scala.html +1 -0
  30. data/public/javascripts/erp_app/codemirror/mode/clojure/clojure.js +8 -9
  31. data/public/javascripts/erp_app/codemirror/mode/clojure/index.html +1 -0
  32. data/public/javascripts/erp_app/codemirror/mode/coffeescript/coffeescript.js +3 -3
  33. data/public/javascripts/erp_app/codemirror/mode/coffeescript/index.html +1 -0
  34. data/public/javascripts/erp_app/codemirror/mode/commonlisp/commonlisp.js +101 -0
  35. data/public/javascripts/erp_app/codemirror/mode/commonlisp/index.html +165 -0
  36. data/public/javascripts/erp_app/codemirror/mode/css/css.js +339 -15
  37. data/public/javascripts/erp_app/codemirror/mode/css/index.html +3 -0
  38. data/public/javascripts/erp_app/codemirror/mode/css/test.js +501 -0
  39. data/public/javascripts/erp_app/codemirror/mode/diff/index.html +1 -0
  40. data/public/javascripts/erp_app/codemirror/mode/ecl/ecl.js +1 -1
  41. data/public/javascripts/erp_app/codemirror/mode/erlang/index.html +1 -0
  42. data/public/javascripts/erp_app/codemirror/mode/gfm/gfm.js +10 -4
  43. data/public/javascripts/erp_app/codemirror/mode/gfm/index.html +1 -0
  44. data/public/javascripts/erp_app/codemirror/mode/go/go.js +2 -2
  45. data/public/javascripts/erp_app/codemirror/mode/go/index.html +1 -0
  46. data/public/javascripts/erp_app/codemirror/mode/groovy/groovy.js +1 -1
  47. data/public/javascripts/erp_app/codemirror/mode/groovy/index.html +1 -0
  48. data/public/javascripts/erp_app/codemirror/mode/haskell/haskell.js +2 -2
  49. data/public/javascripts/erp_app/codemirror/mode/haskell/index.html +1 -0
  50. data/public/javascripts/erp_app/codemirror/mode/haxe/haxe.js +4 -7
  51. data/public/javascripts/erp_app/codemirror/mode/haxe/index.html +1 -0
  52. data/public/javascripts/erp_app/codemirror/mode/htmlembedded/htmlembedded.js +8 -4
  53. data/public/javascripts/erp_app/codemirror/mode/htmlembedded/index.html +1 -0
  54. data/public/javascripts/erp_app/codemirror/mode/htmlmixed/htmlmixed.js +12 -13
  55. data/public/javascripts/erp_app/codemirror/mode/htmlmixed/index.html +1 -0
  56. data/public/javascripts/erp_app/codemirror/mode/javascript/index.html +1 -0
  57. data/public/javascripts/erp_app/codemirror/mode/javascript/javascript.js +3 -3
  58. data/public/javascripts/erp_app/codemirror/mode/jinja2/index.html +1 -0
  59. data/public/javascripts/erp_app/codemirror/mode/less/index.html +124 -2
  60. data/public/javascripts/erp_app/codemirror/mode/less/less.js +94 -60
  61. data/public/javascripts/erp_app/codemirror/mode/lua/index.html +1 -0
  62. data/public/javascripts/erp_app/codemirror/mode/markdown/index.html +3 -0
  63. data/public/javascripts/erp_app/codemirror/mode/markdown/markdown.js +134 -20
  64. data/public/javascripts/erp_app/codemirror/mode/markdown/test.js +1084 -0
  65. data/public/javascripts/erp_app/codemirror/mode/mysql/index.html +1 -0
  66. data/public/javascripts/erp_app/codemirror/mode/ntriples/index.html +1 -0
  67. data/public/javascripts/erp_app/codemirror/mode/ntriples/ntriples.js +4 -4
  68. data/public/javascripts/erp_app/codemirror/mode/ocaml/ocaml.js +1 -1
  69. data/public/javascripts/erp_app/codemirror/mode/pascal/index.html +1 -0
  70. data/public/javascripts/erp_app/codemirror/mode/pascal/pascal.js +1 -1
  71. data/public/javascripts/erp_app/codemirror/mode/perl/index.html +1 -0
  72. data/public/javascripts/erp_app/codemirror/mode/perl/perl.js +71 -71
  73. data/public/javascripts/erp_app/codemirror/mode/php/index.html +1 -0
  74. data/public/javascripts/erp_app/codemirror/mode/php/php.js +7 -9
  75. data/public/javascripts/erp_app/codemirror/mode/pig/index.html +1 -0
  76. data/public/javascripts/erp_app/codemirror/mode/pig/pig.js +3 -3
  77. data/public/javascripts/erp_app/codemirror/mode/plsql/index.html +1 -0
  78. data/public/javascripts/erp_app/codemirror/mode/properties/index.html +1 -0
  79. data/public/javascripts/erp_app/codemirror/mode/python/index.html +1 -0
  80. data/public/javascripts/erp_app/codemirror/mode/python/python.js +1 -1
  81. data/public/javascripts/erp_app/codemirror/mode/r/index.html +1 -0
  82. data/public/javascripts/erp_app/codemirror/mode/rpm/changes/index.html +1 -0
  83. data/public/javascripts/erp_app/codemirror/mode/rpm/spec/index.html +1 -0
  84. data/public/javascripts/erp_app/codemirror/mode/rst/index.html +1 -0
  85. data/public/javascripts/erp_app/codemirror/mode/ruby/index.html +1 -0
  86. data/public/javascripts/erp_app/codemirror/mode/rust/index.html +1 -0
  87. data/public/javascripts/erp_app/codemirror/mode/scheme/index.html +1 -0
  88. data/public/javascripts/erp_app/codemirror/mode/scheme/scheme.js +1 -1
  89. data/public/javascripts/erp_app/codemirror/mode/shell/shell.js +2 -2
  90. data/public/javascripts/erp_app/codemirror/mode/sieve/LICENSE +23 -0
  91. data/public/javascripts/erp_app/codemirror/mode/sieve/index.html +81 -0
  92. data/public/javascripts/erp_app/codemirror/mode/sieve/sieve.js +156 -0
  93. data/public/javascripts/erp_app/codemirror/mode/smalltalk/index.html +1 -0
  94. data/public/javascripts/erp_app/codemirror/mode/smalltalk/smalltalk.js +2 -2
  95. data/public/javascripts/erp_app/codemirror/mode/smarty/index.html +1 -0
  96. data/public/javascripts/erp_app/codemirror/mode/smarty/smarty.js +2 -2
  97. data/public/javascripts/erp_app/codemirror/mode/sparql/index.html +1 -0
  98. data/public/javascripts/erp_app/codemirror/mode/stex/index.html +3 -0
  99. data/public/javascripts/erp_app/codemirror/mode/stex/stex.js +1 -1
  100. data/public/javascripts/erp_app/codemirror/mode/stex/test.js +343 -0
  101. data/public/javascripts/erp_app/codemirror/mode/tiddlywiki/index.html +1 -0
  102. data/public/javascripts/erp_app/codemirror/mode/tiki/index.html +1 -0
  103. data/public/javascripts/erp_app/codemirror/mode/tiki/tiki.js +4 -11
  104. data/public/javascripts/erp_app/codemirror/mode/vb/index.html +1 -0
  105. data/public/javascripts/erp_app/codemirror/mode/vb/vb.js +2 -2
  106. data/public/javascripts/erp_app/codemirror/mode/vbscript/index.html +1 -0
  107. data/public/javascripts/erp_app/codemirror/mode/velocity/index.html +1 -0
  108. data/public/javascripts/erp_app/codemirror/mode/velocity/velocity.js +1 -1
  109. data/public/javascripts/erp_app/codemirror/mode/verilog/index.html +1 -0
  110. data/public/javascripts/erp_app/codemirror/mode/verilog/verilog.js +1 -1
  111. data/public/javascripts/erp_app/codemirror/mode/xml/index.html +2 -1
  112. data/public/javascripts/erp_app/codemirror/mode/xml/xml.js +2 -10
  113. data/public/javascripts/erp_app/codemirror/mode/xquery/index.html +3 -2
  114. data/public/javascripts/erp_app/codemirror/mode/xquery/xquery.js +7 -4
  115. data/public/javascripts/erp_app/codemirror/mode/yaml/index.html +1 -0
  116. data/public/javascripts/erp_app/codemirror/package.json +15 -23
  117. data/public/javascripts/erp_app/codemirror/test/driver.js +109 -22
  118. data/public/javascripts/erp_app/codemirror/test/index.html +129 -16
  119. data/public/javascripts/erp_app/codemirror/test/lint/lint.js +120 -0
  120. data/public/javascripts/erp_app/codemirror/test/lint/parse-js.js +1372 -0
  121. data/public/javascripts/erp_app/codemirror/test/mode_test.css +0 -12
  122. data/public/javascripts/erp_app/codemirror/test/mode_test.js +66 -27
  123. data/public/javascripts/erp_app/codemirror/test/phantom_driver.js +30 -0
  124. data/public/javascripts/erp_app/codemirror/test/run.js +32 -0
  125. data/public/javascripts/erp_app/codemirror/test/test.js +213 -8
  126. data/public/javascripts/erp_app/shared/dynamic_editable_grid.js +33 -27
  127. data/public/javascripts/erp_app/shared/dynamic_editable_grid_loader_panel.js +2 -1
  128. metadata +15 -3
  129. data/public/javascripts/erp_app/codemirror/mode/stex/test.html +0 -263
@@ -8,15 +8,3 @@
8
8
  .mt-output .mt-style {
9
9
  font-size: x-small;
10
10
  }
11
-
12
- .mt-test {
13
- border-left: 10px solid #fff;
14
- }
15
-
16
- .mt-pass {
17
- border-left: 10px solid #cfc;
18
- }
19
-
20
- .mt-fail {
21
- border-left: 10px solid #fcc;
22
- }
@@ -10,33 +10,49 @@ ModeTest.modeOptions = {};
10
10
  ModeTest.modeName = CodeMirror.defaults.mode;
11
11
 
12
12
  /* keep track of results for printSummary */
13
- ModeTest.tests = 0;
13
+ ModeTest.testCount = 0;
14
14
  ModeTest.passes = 0;
15
15
 
16
16
  /**
17
17
  * Run a test; prettyprints the results using document.write().
18
- *
19
- * @param string to highlight
20
- *
21
- * @param style[i] expected style of the i'th token in string
22
- *
23
- * @param token[i] expected value for the i'th token in string
18
+ *
19
+ * @param name Name of test
20
+ * @param text String to highlight.
21
+ * @param expected Expected styles and tokens: Array(style, token, [style, token,...])
22
+ * @param modeName
23
+ * @param modeOptions
24
+ * @param expectedFail
24
25
  */
25
- ModeTest.test = function() {
26
- ModeTest.tests += 1;
26
+ ModeTest.testMode = function(name, text, expected, modeName, modeOptions, expectedFail) {
27
+ ModeTest.testCount += 1;
28
+
29
+ if (!modeName) modeName = ModeTest.modeName;
30
+
31
+ if (!modeOptions) modeOptions = ModeTest.modeOptions;
27
32
 
28
- var mode = CodeMirror.getMode(ModeTest.modeOptions, ModeTest.modeName);
33
+ var mode = CodeMirror.getMode(modeOptions, modeName);
29
34
 
30
- if (arguments.length < 1) {
31
- throw "must have text for test";
35
+ if (expected.length < 0) {
36
+ throw "must have text for test (" + name + ")";
32
37
  }
33
- if (arguments.length % 2 != 1) {
34
- throw "must have text for test plus expected (style, token) pairs";
38
+ if (expected.length % 2 != 0) {
39
+ throw "must have text for test (" + name + ") plus expected (style, token) pairs";
35
40
  }
41
+ return test(
42
+ modeName + "_" + name,
43
+ function(){
44
+ return ModeTest.compare(text, expected, mode);
45
+ },
46
+ expectedFail
47
+ );
48
+
49
+ }
50
+
51
+ ModeTest.compare = function (text, arguments, mode) {
36
52
 
37
- var text = arguments[0];
38
53
  var expectedOutput = [];
39
- for (var i = 1; i < arguments.length; i += 2) {
54
+ for (var i = 0; i < arguments.length; i += 2) {
55
+ arguments[i] = (arguments[i] != null ? arguments[i].split(' ').sort().join(' ') : arguments[i]);
40
56
  expectedOutput.push([arguments[i],arguments[i + 1]]);
41
57
  }
42
58
 
@@ -50,20 +66,26 @@ ModeTest.test = function() {
50
66
  }
51
67
 
52
68
  var s = '';
53
- s += '<div class="mt-test ' + passStyle + '">';
54
- s += '<pre>' + ModeTest.htmlEscape(text) + '</pre>';
55
- s += '<div class="cm-s-default">';
56
69
  if (pass || expectedOutput.length == 0) {
70
+ s += '<div class="mt-test ' + passStyle + '">';
71
+ s += '<pre>' + ModeTest.htmlEscape(text) + '</pre>';
72
+ s += '<div class="cm-s-default">';
57
73
  s += ModeTest.prettyPrintOutputTable(observedOutput);
74
+ s += '</div>';
75
+ s += '</div>';
76
+ return s;
58
77
  } else {
78
+ s += '<div class="mt-test ' + passStyle + '">';
79
+ s += '<pre>' + ModeTest.htmlEscape(text) + '</pre>';
80
+ s += '<div class="cm-s-default">';
59
81
  s += 'expected:';
60
82
  s += ModeTest.prettyPrintOutputTable(expectedOutput);
61
83
  s += 'observed:';
62
84
  s += ModeTest.prettyPrintOutputTable(observedOutput);
85
+ s += '</div>';
86
+ s += '</div>';
87
+ throw s;
63
88
  }
64
- s += '</div>';
65
- s += '</div>';
66
- document.write(s);
67
89
  }
68
90
 
69
91
  /**
@@ -85,11 +107,27 @@ ModeTest.highlight = function(string, mode) {
85
107
  var line = lines[i];
86
108
  var stream = new CodeMirror.StringStream(line);
87
109
  if (line == "" && mode.blankLine) mode.blankLine(state);
110
+ var pos = 0;
111
+ var st = [];
112
+ /* Start copied code from CodeMirror.highlight */
88
113
  while (!stream.eol()) {
89
- var style = mode.token(stream, state);
90
- var substr = line.slice(stream.start, stream.pos);
91
- output.push([style, substr]);
114
+ var style = mode.token(stream, state), substr = stream.current();
92
115
  stream.start = stream.pos;
116
+ if (pos && st[pos-1] == style) {
117
+ st[pos-2] += substr;
118
+ } else if (substr) {
119
+ st[pos++] = substr; st[pos++] = style;
120
+ }
121
+ // Give up when line is ridiculously long
122
+ if (stream.pos > 5000) {
123
+ st[pos++] = this.text.slice(stream.pos); st[pos++] = null;
124
+ break;
125
+ }
126
+ }
127
+ /* End copied code from CodeMirror.highlight */
128
+ for (var x = 0; x < st.length; x += 2) {
129
+ st[x + 1] = (st[x + 1] != null ? st[x + 1].split(' ').sort().join(' ') : st[x + 1]);
130
+ output.push([st[x + 1], st[x]]);
93
131
  }
94
132
  }
95
133
 
@@ -131,7 +169,7 @@ ModeTest.prettyPrintOutputTable = function(output) {
131
169
  var token = output[i];
132
170
  s +=
133
171
  '<td class="mt-token">' +
134
- '<span class="cm-' + token[0] + '">' +
172
+ '<span class="cm-' + String(token[0]).replace(/ +/g, " cm-") + '">' +
135
173
  ModeTest.htmlEscape(token[1]).replace(/ /g,'&middot;') +
136
174
  '</span>' +
137
175
  '</td>';
@@ -150,7 +188,8 @@ ModeTest.prettyPrintOutputTable = function(output) {
150
188
  * Print how many tests have run so far and how many of those passed.
151
189
  */
152
190
  ModeTest.printSummary = function() {
153
- document.write(ModeTest.passes + ' passes for ' + ModeTest.tests + ' tests');
191
+ ModeTest.runTests(ModeTest.displayTest);
192
+ document.write(ModeTest.passes + ' passes for ' + ModeTest.testCount + ' tests');
154
193
  }
155
194
 
156
195
  /**
@@ -0,0 +1,30 @@
1
+ var page = require('webpage').create();
2
+
3
+ page.open("http://localhost:3000/test/index.html", function (status) {
4
+ if (status != "success") {
5
+ console.log("page couldn't be loaded successfully");
6
+ phantom.exit(1);
7
+ }
8
+ waitFor(function () {
9
+ return page.evaluate(function () {
10
+ var output = document.getElementById('status');
11
+ if (!output) { return false; }
12
+ return (/^(\d+ failures?|all passed)/i).test(output.innerText);
13
+ });
14
+ }, function () {
15
+ var failed = page.evaluate(function () { return window.failed; });
16
+ var output = page.evaluate(function () {
17
+ return document.getElementById('status').innerText;
18
+ });
19
+ console.log(output);
20
+ phantom.exit(failed > 0 ? 1 : 0);
21
+ });
22
+ });
23
+
24
+ function waitFor (test, cb) {
25
+ if (test()) {
26
+ cb();
27
+ } else {
28
+ setTimeout(function () { waitFor(test, cb); }, 250);
29
+ }
30
+ }
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+
3
+ var lint = require("./lint/lint");
4
+
5
+ lint.checkDir("mode");
6
+ lint.checkDir("lib");
7
+
8
+ var ok = lint.success();
9
+
10
+ var files = new (require('node-static').Server)('.');
11
+
12
+ var server = require('http').createServer(function (req, res) {
13
+ req.addListener('end', function () {
14
+ files.serve(req, res);
15
+ });
16
+ }).addListener('error', function (err) {
17
+ throw err;
18
+ }).listen(3000, function () {
19
+ var child_process = require('child_process');
20
+ child_process.exec("which phantomjs", function (err) {
21
+ if (err) {
22
+ console.error("PhantomJS is not installed. Download from http://phantomjs.org");
23
+ process.exit(1);
24
+ }
25
+ var cmd = 'phantomjs test/phantom_driver.js';
26
+ child_process.exec(cmd, function (err, stdout) {
27
+ server.close();
28
+ console.log(stdout);
29
+ process.exit(err || !ok ? 1 : 0);
30
+ });
31
+ });
32
+ });
@@ -22,7 +22,9 @@ function byClassName(elt, cls) {
22
22
  return found;
23
23
  }
24
24
 
25
- test("fromTextArea", function() {
25
+ var ie_lt8 = /MSIE [1-7]\b/.test(navigator.userAgent);
26
+
27
+ test("core_fromTextArea", function() {
26
28
  var te = document.getElementById("code");
27
29
  te.value = "CONTENT";
28
30
  var cm = CodeMirror.fromTextArea(te);
@@ -100,9 +102,13 @@ testCM("indent", function(cm) {
100
102
  cm.setOption("indentUnit", 8);
101
103
  cm.indentLine(1);
102
104
  eq(cm.getLine(1), "\tblah();");
105
+ cm.setOption("indentUnit", 10);
106
+ cm.setOption("tabSize", 4);
107
+ cm.indentLine(1);
108
+ eq(cm.getLine(1), "\t\t blah();");
103
109
  }, {value: "if (x) {\nblah();\n}", indentUnit: 3, indentWithTabs: true, tabSize: 8});
104
110
 
105
- test("defaults", function() {
111
+ test("core_defaults", function() {
106
112
  var olddefaults = CodeMirror.defaults, defs = CodeMirror.defaults = {};
107
113
  for (var opt in olddefaults) defs[opt] = olddefaults[opt];
108
114
  defs.indentUnit = 5;
@@ -251,13 +257,14 @@ testCM("markTextSingleLine", function(cm) {
251
257
  var r = cm.markText({line: 0, ch: 3}, {line: 0, ch: 6}, "foo");
252
258
  cm.replaceRange(test.c, {line: 0, ch: test.a}, {line: 0, ch: test.b});
253
259
  var f = r.find();
254
- eq(f.from && f.from.ch, test.f); eq(f.to && f.to.ch, test.t);
260
+ eq(f && f.from.ch, test.f); eq(f && f.to.ch, test.t);
255
261
  });
256
262
  });
257
263
 
258
264
  testCM("markTextMultiLine", function(cm) {
259
265
  function p(v) { return v && {line: v[0], ch: v[1]}; }
260
266
  forEach([{a: [0, 0], b: [0, 5], c: "", f: [0, 0], t: [2, 5]},
267
+ {a: [0, 0], b: [0, 5], c: "foo\n", f: [1, 0], t: [3, 5]},
261
268
  {a: [0, 1], b: [0, 10], c: "", f: [0, 1], t: [2, 5]},
262
269
  {a: [0, 5], b: [0, 6], c: "x", f: [0, 6], t: [2, 5]},
263
270
  {a: [0, 0], b: [1, 0], c: "", f: [0, 0], t: [1, 5]},
@@ -269,16 +276,33 @@ testCM("markTextMultiLine", function(cm) {
269
276
  {a: [1, 5], b: [2, 5], c: "", f: [0, 5], t: [1, 5]},
270
277
  {a: [2, 0], b: [2, 3], c: "", f: [0, 5], t: [2, 2]},
271
278
  {a: [2, 5], b: [3, 0], c: "a\nb", f: [0, 5], t: [2, 5]},
272
- {a: [2, 3], b: [3, 0], c: "x", f: [0, 5], t: [2, 4]},
279
+ {a: [2, 3], b: [3, 0], c: "x", f: [0, 5], t: [2, 3]},
273
280
  {a: [1, 1], b: [1, 9], c: "1\n2\n3", f: [0, 5], t: [4, 5]}], function(test) {
274
281
  cm.setValue("aaaaaaaaaa\nbbbbbbbbbb\ncccccccccc\ndddddddd\n");
275
- var r = cm.markText({line: 0, ch: 5}, {line: 2, ch: 5}, "foo");
282
+ var r = cm.markText({line: 0, ch: 5}, {line: 2, ch: 5}, "CodeMirror-matchingbracket");
276
283
  cm.replaceRange(test.c, p(test.a), p(test.b));
277
284
  var f = r.find();
278
- eqPos(f.from, p(test.f)); eqPos(f.to, p(test.t));
285
+ eqPos(f && f.from, p(test.f)); eqPos(f && f.to, p(test.t));
279
286
  });
280
287
  });
281
288
 
289
+ testCM("markTextUndo", function(cm) {
290
+ var marker1 = cm.markText({line: 0, ch: 1}, {line: 0, ch: 3}, "CodeMirror-matchingbracket");
291
+ var marker2 = cm.markText({line: 0, ch: 0}, {line: 2, ch: 1}, "CodeMirror-matchingbracket");
292
+ var bookmark = cm.setBookmark({line: 1, ch: 5});
293
+ cm.replaceRange("foo", {line: 0, ch: 2});
294
+ cm.replaceRange("bar\baz\bug\n", {line: 2, ch: 0}, {line: 3, ch: 0});
295
+ cm.setValue("");
296
+ eq(marker1.find(), null); eq(marker2.find(), null); eq(bookmark.find(), null);
297
+ cm.undo();
298
+ eqPos(bookmark.find(), {line: 1, ch: 5});
299
+ cm.undo(); cm.undo();
300
+ var m1Pos = marker1.find(), m2Pos = marker2.find();
301
+ eqPos(m1Pos.from, {line: 0, ch: 1}); eqPos(m1Pos.to, {line: 0, ch: 3});
302
+ eqPos(m2Pos.from, {line: 0, ch: 0}); eqPos(m2Pos.to, {line: 2, ch: 1});
303
+ eqPos(bookmark.find(), {line: 1, ch: 5});
304
+ }, {value: "1234\n56789\n00\n"});
305
+
282
306
  testCM("markClearBetween", function(cm) {
283
307
  cm.setValue("aaa\nbbb\nccc\nddd\n");
284
308
  cm.markText({line: 0, ch: 0}, {line: 2}, "foo");
@@ -322,7 +346,7 @@ testCM("scrollSnap", function(cm) {
322
346
  cm.setCursor({line: 100, ch: 180});
323
347
  cm.setCursor({line: 199, ch: 0});
324
348
  info = cm.getScrollInfo();
325
- is(info.x == 0 && info.y == info.height - 100, "scrolled clean to bottom");
349
+ is(info.x == 0 && info.y > info.height - 100, "scrolled clean to bottom");
326
350
  });
327
351
 
328
352
  testCM("selectionPos", function(cm) {
@@ -357,7 +381,7 @@ testCM("selectionPos", function(cm) {
357
381
  }
358
382
  }
359
383
  is(sawTop && sawBottom && sawMiddle, "all parts");
360
- });
384
+ }, null, ie_lt8);
361
385
 
362
386
  testCM("restoreHistory", function(cm) {
363
387
  cm.setValue("abc\ndef");
@@ -464,4 +488,185 @@ testCM("wrappingAndResizing", function(cm) {
464
488
  var coords = cm.charCoords(pos);
465
489
  eqPos(pos, cm.coordsChar({x: coords.x + 2, y: coords.y + 2}));
466
490
  });
491
+ }, null, ie_lt8);
492
+
493
+ testCM("measureEndOfLine", function(cm) {
494
+ cm.setSize(null, "auto");
495
+ var inner = byClassName(cm.getWrapperElement(), "CodeMirror-lines")[0].firstChild;
496
+ var w = 20, lh = inner.offsetHeight;
497
+ for (var step = 10;; w += step) {
498
+ cm.setSize(w);
499
+ if (inner.offsetHeight < 2.5 * lh) {
500
+ if (step == 10) { w -= 10; step = 1; }
501
+ else { break; }
502
+ }
503
+ }
504
+ cm.setValue(cm.getValue() + "\n\n");
505
+ var endPos = cm.charCoords({line: 0, ch: 18}, "local");
506
+ is(endPos.y > lh * .8, "not at top");
507
+ is(endPos.x > w - 20, "not at right");
508
+ endPos = cm.charCoords({line: 0, ch: 18});
509
+ eqPos(cm.coordsChar({x: endPos.x, y: endPos.y + 2}), {line: 0, ch: 18});
510
+ }, {mode: "text/html", value: "<!-- foo barrr -->", lineWrapping: true}, ie_lt8);
511
+
512
+ testCM("scrollVerticallyAndHorizontally", function(cm) {
513
+ cm.setSize(100, 100);
514
+ addDoc(cm, 40, 40);
515
+ cm.setCursor(39);
516
+ var wrap = cm.getWrapperElement(), bar = byClassName(wrap, "CodeMirror-scrollbar")[0];
517
+ is(bar.offsetHeight < wrap.offsetHeight, "vertical scrollbar limited by horizontal one");
518
+ var cursorBox = byClassName(wrap, "CodeMirror-cursor")[0].getBoundingClientRect();
519
+ var editorBox = wrap.getBoundingClientRect();
520
+ is(cursorBox.bottom < editorBox.top + cm.getScrollerElement().clientHeight,
521
+ "bottom line visible");
522
+ }, {gutter: true});
523
+
524
+ testCM("moveV stuck", function(cm) {
525
+ var lines = byClassName(cm.getWrapperElement(), "CodeMirror-lines")[0].firstChild, h0 = lines.offsetHeight;
526
+ var val = "fooooooooooooooooooooooooo baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar\n";
527
+ cm.setValue(val);
528
+ for (var w = 50;; w += 5) {
529
+ cm.setSize(w);
530
+ if (lines.offsetHeight <= 3 * h0) break;
531
+ }
532
+ cm.setCursor({line: 0, ch: val.length - 1});
533
+ cm.moveV(-1, "line");
534
+ eqPos(cm.getCursor(), {line: 0, ch: 26});
535
+ }, {lineWrapping: true}, ie_lt8);
536
+
537
+ testCM("clickTab", function(cm) {
538
+ var p0 = cm.charCoords({line: 0, ch: 0}), p1 = cm.charCoords({line: 0, ch: 1});
539
+ eqPos(cm.coordsChar({x: p0.x + 5, y: p0.y + 5}), {line: 0, ch: 0});
540
+ eqPos(cm.coordsChar({x: p1.x - 5, y: p1.y + 5}), {line: 0, ch: 1});
541
+ }, {value: "\t\n\n", lineWrapping: true, tabSize: 8});
542
+
543
+ testCM("verticalScroll", function(cm) {
544
+ cm.setSize(100, 200);
545
+ cm.setValue("foo\nbar\nbaz\n");
546
+ var sc = cm.getScrollerElement(), baseWidth = sc.scrollWidth;
547
+ cm.setLine(0, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah");
548
+ is(sc.scrollWidth > baseWidth, "scrollbar present");
549
+ cm.setLine(0, "foo");
550
+ eq(sc.scrollWidth, baseWidth, "scrollbar gone");
551
+ cm.setLine(0, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah");
552
+ cm.setLine(1, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbh");
553
+ is(sc.scrollWidth > baseWidth, "present again");
554
+ var curWidth = sc.scrollWidth;
555
+ cm.setLine(0, "foo");
556
+ is(sc.scrollWidth < curWidth, "scrollbar smaller");
557
+ is(sc.scrollWidth > baseWidth, "but still present");
558
+ });
559
+
560
+ testCM("extraKeys", function(cm) {
561
+ var outcome;
562
+ function fakeKey(expected, code, props) {
563
+ if (typeof code == "string") code = code.charCodeAt(0);
564
+ var e = {type: "keydown", keyCode: code, preventDefault: function(){}, stopPropagation: function(){}};
565
+ if (props) for (var n in props) e[n] = props[n];
566
+ outcome = null;
567
+ cm.triggerOnKeyDown(e);
568
+ eq(outcome, expected);
569
+ }
570
+ CodeMirror.commands.testCommand = function() {outcome = "tc";};
571
+ CodeMirror.commands.goTestCommand = function() {outcome = "gtc";};
572
+ cm.setOption("extraKeys", {"Shift-X": function() {outcome = "sx";},
573
+ "X": function() {outcome = "x";},
574
+ "Ctrl-Alt-U": function() {outcome = "cau";},
575
+ "End": "testCommand",
576
+ "Home": "goTestCommand",
577
+ "Tab": false});
578
+ fakeKey(null, "U");
579
+ fakeKey("cau", "U", {ctrlKey: true, altKey: true});
580
+ fakeKey(null, "U", {shiftKey: true, ctrlKey: true, altKey: true});
581
+ fakeKey("x", "X");
582
+ fakeKey("sx", "X", {shiftKey: true});
583
+ fakeKey("tc", 35);
584
+ fakeKey(null, 35, {shiftKey: true});
585
+ fakeKey("gtc", 36);
586
+ fakeKey("gtc", 36, {shiftKey: true});
587
+ fakeKey(null, 9);
467
588
  });
589
+
590
+ testCM("wordMovementCommands", function(cm) {
591
+ cm.execCommand("goWordLeft");
592
+ eqPos(cm.getCursor(), {line: 0, ch: 0});
593
+ cm.execCommand("goWordRight"); cm.execCommand("goWordRight");
594
+ eqPos(cm.getCursor(), {line: 0, ch: 7});
595
+ cm.execCommand("goWordLeft");
596
+ eqPos(cm.getCursor(), {line: 0, ch: 5});
597
+ cm.execCommand("goWordRight"); cm.execCommand("goWordRight");
598
+ eqPos(cm.getCursor(), {line: 0, ch: 12});
599
+ cm.execCommand("goWordLeft");
600
+ eqPos(cm.getCursor(), {line: 0, ch: 9});
601
+ cm.execCommand("goWordRight"); cm.execCommand("goWordRight"); cm.execCommand("goWordRight");
602
+ eqPos(cm.getCursor(), {line: 1, ch: 1});
603
+ cm.execCommand("goWordRight");
604
+ eqPos(cm.getCursor(), {line: 1, ch: 9});
605
+ cm.execCommand("goWordRight");
606
+ eqPos(cm.getCursor(), {line: 1, ch: 13});
607
+ cm.execCommand("goWordRight"); cm.execCommand("goWordRight");
608
+ eqPos(cm.getCursor(), {line: 2, ch: 0});
609
+ }, {value: "this is (the) firstline.\na foo12\u00e9\u00f8\u00d7bar\n"});
610
+
611
+ testCM("charMovementCommands", function(cm) {
612
+ cm.execCommand("goCharLeft"); cm.execCommand("goColumnLeft");
613
+ eqPos(cm.getCursor(), {line: 0, ch: 0});
614
+ cm.execCommand("goCharRight"); cm.execCommand("goCharRight");
615
+ eqPos(cm.getCursor(), {line: 0, ch: 2});
616
+ cm.setCursor({line: 1, ch: 0});
617
+ cm.execCommand("goColumnLeft");
618
+ eqPos(cm.getCursor(), {line: 1, ch: 0});
619
+ cm.execCommand("goCharLeft");
620
+ eqPos(cm.getCursor(), {line: 0, ch: 5});
621
+ cm.execCommand("goColumnRight");
622
+ eqPos(cm.getCursor(), {line: 0, ch: 5});
623
+ cm.execCommand("goCharRight");
624
+ eqPos(cm.getCursor(), {line: 1, ch: 0});
625
+ cm.execCommand("goLineEnd");
626
+ eqPos(cm.getCursor(), {line: 1, ch: 5});
627
+ cm.execCommand("goLineStartSmart");
628
+ eqPos(cm.getCursor(), {line: 1, ch: 1});
629
+ cm.execCommand("goLineStartSmart");
630
+ eqPos(cm.getCursor(), {line: 1, ch: 0});
631
+ cm.setCursor({line: 2, ch: 0});
632
+ cm.execCommand("goCharRight"); cm.execCommand("goColumnRight");
633
+ eqPos(cm.getCursor(), {line: 2, ch: 0});
634
+ }, {value: "line1\n ine2\n"});
635
+
636
+ testCM("verticalMovementCommands", function(cm) {
637
+ cm.execCommand("goLineUp");
638
+ eqPos(cm.getCursor(), {line: 0, ch: 0});
639
+ cm.execCommand("goLineDown");
640
+ eqPos(cm.getCursor(), {line: 1, ch: 0});
641
+ cm.setCursor({line: 1, ch: 12});
642
+ cm.execCommand("goLineDown");
643
+ eqPos(cm.getCursor(), {line: 2, ch: 5});
644
+ cm.execCommand("goLineDown");
645
+ eqPos(cm.getCursor(), {line: 3, ch: 0});
646
+ cm.execCommand("goLineUp");
647
+ eqPos(cm.getCursor(), {line: 2, ch: 5});
648
+ cm.execCommand("goLineUp");
649
+ eqPos(cm.getCursor(), {line: 1, ch: 12});
650
+ cm.execCommand("goPageDown");
651
+ eqPos(cm.getCursor(), {line: 5, ch: 0});
652
+ cm.execCommand("goPageDown"); cm.execCommand("goLineDown");
653
+ eqPos(cm.getCursor(), {line: 5, ch: 0});
654
+ cm.execCommand("goPageUp");
655
+ eqPos(cm.getCursor(), {line: 0, ch: 0});
656
+ }, {value: "line1\nlong long line2\nline3\n\nline5\n"});
657
+
658
+ testCM("verticalMovementCommandsWrapping", function(cm) {
659
+ cm.setSize(120);
660
+ cm.setCursor({line: 0, ch: 5});
661
+ cm.execCommand("goLineDown");
662
+ eq(cm.getCursor().line, 0);
663
+ is(cm.getCursor().ch > 5, "moved beyond wrap");
664
+ for (var i = 0; ; ++i) {
665
+ is(i < 20, "no endless loop");
666
+ cm.execCommand("goLineDown");
667
+ var cur = cm.getCursor();
668
+ if (cur.line == 1) eq(cur.ch, 5);
669
+ if (cur.line == 2) { eq(cur.ch, 1); break; }
670
+ }
671
+ }, {value: "a very long line that wraps around somehow so that we can test cursor movement\nshortone\nk",
672
+ lineWrapping: true});
@@ -74,35 +74,41 @@ Ext.define("Compass.ErpApp.Shared.DynamicEditableGrid",{
74
74
  idProperty: ((config.id_property != undefined) ? config.id_property : "id")
75
75
  });
76
76
  plugins.push(this.editing);
77
- tbar = {
78
- items:[{
79
- text: 'Add',
80
- iconCls: 'icon-add',
81
- handler: function(button) {
82
- var grid = button.findParentByType('shared_dynamiceditablegrid');
83
- var edit = grid.editing;
84
- grid.store.insert(0, new Model());
85
- edit.startEdit(0,0);
86
- }
87
- },
88
- '-',
89
- {
90
- text: 'Delete',
91
- iconCls: 'icon-delete',
92
- handler: function(button) {
93
- var grid = button.findParentByType('shared_dynamiceditablegrid');
94
- var selection = grid.getView().getSelectionModel().getSelection()[0];
95
- if (selection) {
96
- grid.store.remove(selection);
97
- }
98
- }
99
- }]
100
- };
101
-
77
+
102
78
  config = Ext.apply({
103
- plugins:plugins,
104
- tbar:tbar
79
+ plugins:plugins
105
80
  }, config);
81
+
82
+ if (config.showEditorToolbar){
83
+ tbar = {
84
+ items:[{
85
+ text: 'Add',
86
+ iconCls: 'icon-add',
87
+ handler: function(button) {
88
+ var grid = button.findParentByType('shared_dynamiceditablegrid');
89
+ var edit = grid.editing;
90
+ grid.store.insert(0, new Model());
91
+ edit.startEdit(0,0);
92
+ }
93
+ },
94
+ '-',
95
+ {
96
+ text: 'Delete',
97
+ iconCls: 'icon-delete',
98
+ handler: function(button) {
99
+ var grid = button.findParentByType('shared_dynamiceditablegrid');
100
+ var selection = grid.getView().getSelectionModel().getSelection()[0];
101
+ if (selection) {
102
+ grid.store.remove(selection);
103
+ }
104
+ }
105
+ }]
106
+ };
107
+
108
+ config = Ext.apply({
109
+ tbar:tbar
110
+ }, config);
111
+ }
106
112
  }
107
113
 
108
114
  config = Ext.apply({
@@ -31,7 +31,8 @@ Ext.define("Compass.ErpApp.Shared.DynamicEditableGridLoaderPanel",{
31
31
  selType: (config.selType || 'rowmodel'),
32
32
  multiSelect: (config.multiSelect || false),
33
33
  allowDeselect: (config.allowDeselect || false),
34
- timeout: (config.timeout || 30000)
34
+ timeout: (config.timeout || 30000),
35
+ showEditorToolbar: (config.showEditorToolbar === false ? false : true)
35
36
  });
36
37
  self.down('shared_dynamiceditablegrid').getStore().load();
37
38
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erp_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.10
4
+ version: 3.0.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-26 00:00:00.000000000 Z
12
+ date: 2012-10-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: will_paginate
@@ -1341,6 +1341,7 @@ files:
1341
1341
  - public/javascripts/erp_app/codemirror/lib/util/multiplex.js
1342
1342
  - public/javascripts/erp_app/codemirror/lib/util/overlay.js
1343
1343
  - public/javascripts/erp_app/codemirror/lib/util/pig-hint.js
1344
+ - public/javascripts/erp_app/codemirror/lib/util/runmode-standalone.js
1344
1345
  - public/javascripts/erp_app/codemirror/lib/util/runmode.js
1345
1346
  - public/javascripts/erp_app/codemirror/lib/util/search.js
1346
1347
  - public/javascripts/erp_app/codemirror/lib/util/searchcursor.js
@@ -1356,8 +1357,11 @@ files:
1356
1357
  - public/javascripts/erp_app/codemirror/mode/coffeescript/coffeescript.js
1357
1358
  - public/javascripts/erp_app/codemirror/mode/coffeescript/index.html
1358
1359
  - public/javascripts/erp_app/codemirror/mode/coffeescript/LICENSE
1360
+ - public/javascripts/erp_app/codemirror/mode/commonlisp/commonlisp.js
1361
+ - public/javascripts/erp_app/codemirror/mode/commonlisp/index.html
1359
1362
  - public/javascripts/erp_app/codemirror/mode/css/css.js
1360
1363
  - public/javascripts/erp_app/codemirror/mode/css/index.html
1364
+ - public/javascripts/erp_app/codemirror/mode/css/test.js
1361
1365
  - public/javascripts/erp_app/codemirror/mode/diff/diff.js
1362
1366
  - public/javascripts/erp_app/codemirror/mode/diff/index.html
1363
1367
  - public/javascripts/erp_app/codemirror/mode/ecl/ecl.js
@@ -1388,6 +1392,7 @@ files:
1388
1392
  - public/javascripts/erp_app/codemirror/mode/lua/lua.js
1389
1393
  - public/javascripts/erp_app/codemirror/mode/markdown/index.html
1390
1394
  - public/javascripts/erp_app/codemirror/mode/markdown/markdown.js
1395
+ - public/javascripts/erp_app/codemirror/mode/markdown/test.js
1391
1396
  - public/javascripts/erp_app/codemirror/mode/mysql/index.html
1392
1397
  - public/javascripts/erp_app/codemirror/mode/mysql/mysql.js
1393
1398
  - public/javascripts/erp_app/codemirror/mode/ntriples/index.html
@@ -1430,6 +1435,9 @@ files:
1430
1435
  - public/javascripts/erp_app/codemirror/mode/scheme/scheme.js
1431
1436
  - public/javascripts/erp_app/codemirror/mode/shell/index.html
1432
1437
  - public/javascripts/erp_app/codemirror/mode/shell/shell.js
1438
+ - public/javascripts/erp_app/codemirror/mode/sieve/index.html
1439
+ - public/javascripts/erp_app/codemirror/mode/sieve/LICENSE
1440
+ - public/javascripts/erp_app/codemirror/mode/sieve/sieve.js
1433
1441
  - public/javascripts/erp_app/codemirror/mode/smalltalk/index.html
1434
1442
  - public/javascripts/erp_app/codemirror/mode/smalltalk/smalltalk.js
1435
1443
  - public/javascripts/erp_app/codemirror/mode/smarty/index.html
@@ -1438,7 +1446,7 @@ files:
1438
1446
  - public/javascripts/erp_app/codemirror/mode/sparql/sparql.js
1439
1447
  - public/javascripts/erp_app/codemirror/mode/stex/index.html
1440
1448
  - public/javascripts/erp_app/codemirror/mode/stex/stex.js
1441
- - public/javascripts/erp_app/codemirror/mode/stex/test.html
1449
+ - public/javascripts/erp_app/codemirror/mode/stex/test.js
1442
1450
  - public/javascripts/erp_app/codemirror/mode/tiddlywiki/index.html
1443
1451
  - public/javascripts/erp_app/codemirror/mode/tiddlywiki/tiddlywiki.css
1444
1452
  - public/javascripts/erp_app/codemirror/mode/tiddlywiki/tiddlywiki.js
@@ -1472,8 +1480,12 @@ files:
1472
1480
  - public/javascripts/erp_app/codemirror/README.md
1473
1481
  - public/javascripts/erp_app/codemirror/test/driver.js
1474
1482
  - public/javascripts/erp_app/codemirror/test/index.html
1483
+ - public/javascripts/erp_app/codemirror/test/lint/lint.js
1484
+ - public/javascripts/erp_app/codemirror/test/lint/parse-js.js
1475
1485
  - public/javascripts/erp_app/codemirror/test/mode_test.css
1476
1486
  - public/javascripts/erp_app/codemirror/test/mode_test.js
1487
+ - public/javascripts/erp_app/codemirror/test/phantom_driver.js
1488
+ - public/javascripts/erp_app/codemirror/test/run.js
1477
1489
  - public/javascripts/erp_app/codemirror/test/test.js
1478
1490
  - public/javascripts/erp_app/codemirror/theme/ambiance.css
1479
1491
  - public/javascripts/erp_app/codemirror/theme/blackboard.css