marty 2.4.7 → 2.4.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile.dummy +8 -5
  3. data/Gemfile.lock +1 -1
  4. data/README.md +8 -0
  5. data/app/assets/javascripts/marty/application.js +1 -0
  6. data/app/assets/javascripts/marty/codemirror/codemirror.js +9730 -0
  7. data/app/{components/marty/script_form/client → assets/javascripts/marty/codemirror}/mode/delorean/delorean.js +0 -0
  8. data/app/assets/javascripts/marty/codemirror/mode/javascript/javascript.js +900 -0
  9. data/app/assets/javascripts/marty/codemirror/mode/python/python.js +399 -0
  10. data/app/{components/marty/script_form/client → assets/javascripts/marty/codemirror}/mode/ruby/ruby.js +135 -34
  11. data/app/{components/marty/script_form/client/Ext.ux.form.field.CodeMirror.js → assets/javascripts/marty/extjs/extensions/marty.js} +87 -6
  12. data/app/assets/stylesheets/marty/application.css +1 -13
  13. data/app/assets/stylesheets/marty/codemirror/codemirror.css +346 -0
  14. data/app/{components/marty/script_form/client → assets/stylesheets/marty/codemirror}/delorean.css +0 -0
  15. data/app/components/marty/auth_app/client/auth_app.js +82 -80
  16. data/app/components/marty/data_grid_view.rb +1 -54
  17. data/app/components/marty/data_grid_view/client/data_grid_view.js +49 -0
  18. data/app/components/marty/form.rb +1 -5
  19. data/app/components/marty/form/client/form.js +5 -0
  20. data/app/components/marty/grid.rb +1 -146
  21. data/app/components/marty/grid/client/grid.js +146 -0
  22. data/app/components/marty/import_view.rb +1 -32
  23. data/app/components/marty/import_view/client/import_view.js +32 -0
  24. data/app/components/marty/live_search_grid_panel.rb +1 -21
  25. data/app/components/marty/live_search_grid_panel/client/live_search_grid_panel.js +27 -0
  26. data/app/components/marty/main_auth_app.rb +4 -145
  27. data/app/components/marty/main_auth_app/client/main_auth_app.js +124 -0
  28. data/app/components/marty/mcfly_grid_panel.rb +1 -17
  29. data/app/components/marty/mcfly_grid_panel/client/mcfly_grid_panel.js +37 -0
  30. data/app/components/marty/new_posting_form.rb +1 -6
  31. data/app/components/marty/new_posting_form/client/new_posting_form.js +6 -0
  32. data/app/components/marty/panel.rb +1 -5
  33. data/app/components/marty/panel/client/panel.js +5 -0
  34. data/app/components/marty/posting_grid.rb +4 -55
  35. data/app/components/marty/posting_grid/client/posting_grid.js +50 -0
  36. data/app/components/marty/promise_view.rb +2 -75
  37. data/app/components/marty/promise_view/client/promise_view.css +12 -9
  38. data/app/components/marty/promise_view/client/promise_view.js +57 -0
  39. data/app/components/marty/report_form.rb +3 -69
  40. data/app/components/marty/report_form/client/report_form.js +78 -0
  41. data/app/components/marty/report_select.rb +1 -45
  42. data/app/components/marty/report_select/client/report_select.js +50 -0
  43. data/app/components/marty/reporting.rb +1 -8
  44. data/app/components/marty/reporting/client/reporting.js +8 -0
  45. data/app/components/marty/script_form.rb +2 -63
  46. data/app/components/marty/script_form/client/script_form.js +44 -0
  47. data/app/components/marty/script_tester.rb +1 -7
  48. data/app/components/marty/script_tester/client/script_tester.js +7 -0
  49. data/app/components/marty/scripting.rb +1 -55
  50. data/app/components/marty/scripting/client/scripting.js +62 -0
  51. data/app/components/marty/simple_app/client/simple_app.js +21 -13
  52. data/app/models/marty/promise.rb +22 -1
  53. data/app/views/layouts/marty/application.html.erb +8 -6
  54. data/docker-compose.dummy.yml +2 -0
  55. data/lib/marty/monkey.rb +0 -16
  56. data/lib/marty/version.rb +1 -1
  57. data/spec/dummy/config/initializers/assets.rb +1 -0
  58. data/spec/features/reporting_spec.rb +1 -0
  59. data/spec/features/scripting_spec.rb +4 -4
  60. data/spec/spec_helper.rb +1 -0
  61. data/spec/support/chromedriver.rb +5 -1
  62. data/spec/support/shared_connection_db_helpers.rb +42 -2
  63. metadata +29 -168
  64. data/app/assets/images/marty/.gitkeep +0 -0
  65. data/app/components/marty/mcfly_grid_panel/client/dup_in_form.js +0 -20
  66. data/app/components/marty/script_form/client/codemirror.css +0 -172
  67. data/app/components/marty/script_form/client/codemirror.js +0 -3130
  68. data/app/components/marty/script_form/client/mode/clike/clike.js +0 -284
  69. data/app/components/marty/script_form/client/mode/clike/index.html +0 -102
  70. data/app/components/marty/script_form/client/mode/clike/scala.html +0 -766
  71. data/app/components/marty/script_form/client/mode/clojure/clojure.js +0 -206
  72. data/app/components/marty/script_form/client/mode/clojure/index.html +0 -67
  73. data/app/components/marty/script_form/client/mode/coffeescript/LICENSE +0 -22
  74. data/app/components/marty/script_form/client/mode/coffeescript/coffeescript.js +0 -346
  75. data/app/components/marty/script_form/client/mode/coffeescript/index.html +0 -728
  76. data/app/components/marty/script_form/client/mode/commonlisp/commonlisp.js +0 -101
  77. data/app/components/marty/script_form/client/mode/commonlisp/index.html +0 -165
  78. data/app/components/marty/script_form/client/mode/css/css.js +0 -448
  79. data/app/components/marty/script_form/client/mode/css/index.html +0 -58
  80. data/app/components/marty/script_form/client/mode/css/test.js +0 -501
  81. data/app/components/marty/script_form/client/mode/diff/diff.js +0 -32
  82. data/app/components/marty/script_form/client/mode/diff/index.html +0 -105
  83. data/app/components/marty/script_form/client/mode/ecl/ecl.js +0 -203
  84. data/app/components/marty/script_form/client/mode/ecl/index.html +0 -42
  85. data/app/components/marty/script_form/client/mode/erlang/erlang.js +0 -463
  86. data/app/components/marty/script_form/client/mode/erlang/index.html +0 -63
  87. data/app/components/marty/script_form/client/mode/gfm/gfm.js +0 -150
  88. data/app/components/marty/script_form/client/mode/gfm/index.html +0 -48
  89. data/app/components/marty/script_form/client/mode/go/go.js +0 -170
  90. data/app/components/marty/script_form/client/mode/go/index.html +0 -73
  91. data/app/components/marty/script_form/client/mode/groovy/groovy.js +0 -210
  92. data/app/components/marty/script_form/client/mode/groovy/index.html +0 -72
  93. data/app/components/marty/script_form/client/mode/haskell/haskell.js +0 -242
  94. data/app/components/marty/script_form/client/mode/haskell/index.html +0 -61
  95. data/app/components/marty/script_form/client/mode/haxe/haxe.js +0 -429
  96. data/app/components/marty/script_form/client/mode/haxe/index.html +0 -91
  97. data/app/components/marty/script_form/client/mode/htmlembedded/htmlembedded.js +0 -72
  98. data/app/components/marty/script_form/client/mode/htmlembedded/index.html +0 -50
  99. data/app/components/marty/script_form/client/mode/htmlmixed/htmlmixed.js +0 -84
  100. data/app/components/marty/script_form/client/mode/htmlmixed/index.html +0 -52
  101. data/app/components/marty/script_form/client/mode/javascript/index.html +0 -78
  102. data/app/components/marty/script_form/client/mode/javascript/javascript.js +0 -361
  103. data/app/components/marty/script_form/client/mode/jinja2/index.html +0 -38
  104. data/app/components/marty/script_form/client/mode/jinja2/jinja2.js +0 -42
  105. data/app/components/marty/script_form/client/mode/less/index.html +0 -740
  106. data/app/components/marty/script_form/client/mode/less/less.js +0 -266
  107. data/app/components/marty/script_form/client/mode/lua/index.html +0 -73
  108. data/app/components/marty/script_form/client/mode/lua/lua.js +0 -140
  109. data/app/components/marty/script_form/client/mode/markdown/index.html +0 -343
  110. data/app/components/marty/script_form/client/mode/markdown/markdown.js +0 -382
  111. data/app/components/marty/script_form/client/mode/markdown/test.js +0 -1084
  112. data/app/components/marty/script_form/client/mode/mysql/index.html +0 -42
  113. data/app/components/marty/script_form/client/mode/mysql/mysql.js +0 -186
  114. data/app/components/marty/script_form/client/mode/ntriples/index.html +0 -33
  115. data/app/components/marty/script_form/client/mode/ntriples/ntriples.js +0 -172
  116. data/app/components/marty/script_form/client/mode/ocaml/index.html +0 -130
  117. data/app/components/marty/script_form/client/mode/ocaml/ocaml.js +0 -114
  118. data/app/components/marty/script_form/client/mode/pascal/LICENSE +0 -7
  119. data/app/components/marty/script_form/client/mode/pascal/index.html +0 -49
  120. data/app/components/marty/script_form/client/mode/pascal/pascal.js +0 -94
  121. data/app/components/marty/script_form/client/mode/perl/LICENSE +0 -19
  122. data/app/components/marty/script_form/client/mode/perl/index.html +0 -63
  123. data/app/components/marty/script_form/client/mode/perl/perl.js +0 -816
  124. data/app/components/marty/script_form/client/mode/php/index.html +0 -49
  125. data/app/components/marty/script_form/client/mode/php/php.js +0 -148
  126. data/app/components/marty/script_form/client/mode/pig/index.html +0 -43
  127. data/app/components/marty/script_form/client/mode/pig/pig.js +0 -172
  128. data/app/components/marty/script_form/client/mode/plsql/index.html +0 -63
  129. data/app/components/marty/script_form/client/mode/plsql/plsql.js +0 -217
  130. data/app/components/marty/script_form/client/mode/properties/index.html +0 -41
  131. data/app/components/marty/script_form/client/mode/properties/properties.js +0 -63
  132. data/app/components/marty/script_form/client/mode/python/LICENSE.txt +0 -21
  133. data/app/components/marty/script_form/client/mode/python/index.html +0 -123
  134. data/app/components/marty/script_form/client/mode/python/python.js +0 -338
  135. data/app/components/marty/script_form/client/mode/r/LICENSE +0 -24
  136. data/app/components/marty/script_form/client/mode/r/index.html +0 -74
  137. data/app/components/marty/script_form/client/mode/r/r.js +0 -141
  138. data/app/components/marty/script_form/client/mode/rpm/changes/changes.js +0 -19
  139. data/app/components/marty/script_form/client/mode/rpm/changes/index.html +0 -54
  140. data/app/components/marty/script_form/client/mode/rpm/spec/index.html +0 -100
  141. data/app/components/marty/script_form/client/mode/rpm/spec/spec.css +0 -5
  142. data/app/components/marty/script_form/client/mode/rpm/spec/spec.js +0 -66
  143. data/app/components/marty/script_form/client/mode/rst/index.html +0 -526
  144. data/app/components/marty/script_form/client/mode/rst/rst.js +0 -326
  145. data/app/components/marty/script_form/client/mode/ruby/LICENSE +0 -24
  146. data/app/components/marty/script_form/client/mode/ruby/index.html +0 -172
  147. data/app/components/marty/script_form/client/mode/rust/index.html +0 -49
  148. data/app/components/marty/script_form/client/mode/rust/rust.js +0 -432
  149. data/app/components/marty/script_form/client/mode/scheme/index.html +0 -65
  150. data/app/components/marty/script_form/client/mode/scheme/scheme.js +0 -230
  151. data/app/components/marty/script_form/client/mode/shell/index.html +0 -50
  152. data/app/components/marty/script_form/client/mode/shell/shell.js +0 -118
  153. data/app/components/marty/script_form/client/mode/sieve/LICENSE +0 -23
  154. data/app/components/marty/script_form/client/mode/sieve/index.html +0 -81
  155. data/app/components/marty/script_form/client/mode/sieve/sieve.js +0 -156
  156. data/app/components/marty/script_form/client/mode/smalltalk/index.html +0 -56
  157. data/app/components/marty/script_form/client/mode/smalltalk/smalltalk.js +0 -139
  158. data/app/components/marty/script_form/client/mode/smarty/index.html +0 -83
  159. data/app/components/marty/script_form/client/mode/smarty/smarty.js +0 -148
  160. data/app/components/marty/script_form/client/mode/sparql/index.html +0 -41
  161. data/app/components/marty/script_form/client/mode/sparql/sparql.js +0 -143
  162. data/app/components/marty/script_form/client/mode/stex/index.html +0 -98
  163. data/app/components/marty/script_form/client/mode/stex/stex.js +0 -182
  164. data/app/components/marty/script_form/client/mode/stex/test.js +0 -343
  165. data/app/components/marty/script_form/client/mode/tiddlywiki/index.html +0 -141
  166. data/app/components/marty/script_form/client/mode/tiddlywiki/tiddlywiki.css +0 -14
  167. data/app/components/marty/script_form/client/mode/tiddlywiki/tiddlywiki.js +0 -384
  168. data/app/components/marty/script_form/client/mode/tiki/index.html +0 -83
  169. data/app/components/marty/script_form/client/mode/tiki/tiki.css +0 -26
  170. data/app/components/marty/script_form/client/mode/tiki/tiki.js +0 -309
  171. data/app/components/marty/script_form/client/mode/vb/LICENSE.txt +0 -21
  172. data/app/components/marty/script_form/client/mode/vb/index.html +0 -89
  173. data/app/components/marty/script_form/client/mode/vb/vb.js +0 -260
  174. data/app/components/marty/script_form/client/mode/vbscript/index.html +0 -43
  175. data/app/components/marty/script_form/client/mode/vbscript/vbscript.js +0 -26
  176. data/app/components/marty/script_form/client/mode/velocity/index.html +0 -104
  177. data/app/components/marty/script_form/client/mode/velocity/velocity.js +0 -146
  178. data/app/components/marty/script_form/client/mode/verilog/index.html +0 -211
  179. data/app/components/marty/script_form/client/mode/verilog/verilog.js +0 -194
  180. data/app/components/marty/script_form/client/mode/xml/index.html +0 -45
  181. data/app/components/marty/script_form/client/mode/xml/xml.js +0 -318
  182. data/app/components/marty/script_form/client/mode/xquery/LICENSE +0 -20
  183. data/app/components/marty/script_form/client/mode/xquery/index.html +0 -223
  184. data/app/components/marty/script_form/client/mode/xquery/test/index.html +0 -27
  185. data/app/components/marty/script_form/client/mode/xquery/test/testBase.js +0 -42
  186. data/app/components/marty/script_form/client/mode/xquery/test/testEmptySequenceKeyword.js +0 -16
  187. data/app/components/marty/script_form/client/mode/xquery/test/testMultiAttr.js +0 -16
  188. data/app/components/marty/script_form/client/mode/xquery/test/testNamespaces.js +0 -91
  189. data/app/components/marty/script_form/client/mode/xquery/test/testProcessingInstructions.js +0 -16
  190. data/app/components/marty/script_form/client/mode/xquery/test/testQuotes.js +0 -19
  191. data/app/components/marty/script_form/client/mode/xquery/xquery.js +0 -451
  192. data/app/components/marty/script_form/client/mode/yaml/index.html +0 -68
  193. data/app/components/marty/script_form/client/mode/yaml/yaml.js +0 -95
  194. data/app/components/marty/script_form/client/theme/ambiance.css +0 -81
  195. data/app/components/marty/script_form/client/theme/blackboard.css +0 -25
  196. data/app/components/marty/script_form/client/theme/cobalt.css +0 -18
  197. data/app/components/marty/script_form/client/theme/eclipse.css +0 -25
  198. data/app/components/marty/script_form/client/theme/elegant.css +0 -10
  199. data/app/components/marty/script_form/client/theme/erlang-dark.css +0 -21
  200. data/app/components/marty/script_form/client/theme/lesser-dark.css +0 -44
  201. data/app/components/marty/script_form/client/theme/monokai.css +0 -28
  202. data/app/components/marty/script_form/client/theme/neat.css +0 -9
  203. data/app/components/marty/script_form/client/theme/night.css +0 -21
  204. data/app/components/marty/script_form/client/theme/rubyblue.css +0 -21
  205. data/app/components/marty/script_form/client/theme/vibrant-ink.css +0 -27
  206. data/app/components/marty/script_form/client/theme/xq-dark.css +0 -46
  207. data/app/components/marty/script_form/client/util/closetag.js +0 -164
  208. data/app/components/marty/script_form/client/util/dialog.css +0 -27
  209. data/app/components/marty/script_form/client/util/dialog.js +0 -70
  210. data/app/components/marty/script_form/client/util/foldcode.js +0 -196
  211. data/app/components/marty/script_form/client/util/formatting.js +0 -193
  212. data/app/components/marty/script_form/client/util/javascript-hint.js +0 -134
  213. data/app/components/marty/script_form/client/util/loadmode.js +0 -51
  214. data/app/components/marty/script_form/client/util/match-highlighter.js +0 -44
  215. data/app/components/marty/script_form/client/util/multiplex.js +0 -77
  216. data/app/components/marty/script_form/client/util/overlay.js +0 -54
  217. data/app/components/marty/script_form/client/util/pig-hint.js +0 -123
  218. data/app/components/marty/script_form/client/util/runmode-standalone.js +0 -90
  219. data/app/components/marty/script_form/client/util/runmode.js +0 -53
  220. data/app/components/marty/script_form/client/util/search.js +0 -118
  221. data/app/components/marty/script_form/client/util/searchcursor.js +0 -119
  222. data/app/components/marty/script_form/client/util/simple-hint.css +0 -16
  223. data/app/components/marty/script_form/client/util/simple-hint.js +0 -97
  224. data/app/components/marty/script_form/client/util/xml-hint.js +0 -137
  225. data/lib/marty/javascript/grid_view_in_form.js +0 -81
@@ -1,89 +1,91 @@
1
1
  {
2
- netzkeOnSignIn: function() {
3
- var me = this;
4
- this.signinWin = this.signinWin || Ext.create('Ext.Window', {
5
- modal: true,
6
- layout: 'fit',
2
+ netzkeOnSignIn: function () {
3
+ var me = this;
4
+ this.signinWin = this.signinWin || Ext.create('Ext.Window', {
5
+ modal: true,
6
+ layout: 'fit',
7
7
 
8
- submit: function() {
9
- var form = this.items.first();
10
- var values = form.getForm().getValues();
8
+ submit: function () {
9
+ var form = this.items.first();
10
+ var values = form.getForm().getValues();
11
11
 
12
- // calling the endpoint
13
- me.server.signIn(values, function(res) {
14
- if (res) {
15
- if (!me.authSpecMode) { this.signinWin.close(); }
16
- Ext.Msg.show({
17
- title: "Signed in",
18
- msg: "Signed in successfully, reloading...",
19
- icon: Ext.Msg.INFO,
20
- closable: false
21
- });
22
- if (!me.authSpecMode) { window.location.href = "/"; }
23
- }
24
- });
25
- },
26
-
27
- closeAction: 'hide',
28
- title: "Sign in",
29
- fbar: [
30
- {
31
- text: 'OK',
32
- name: 'signin_submit',
33
- handler: function() {
34
- this.up('window').submit();
35
- },
36
- },
37
- {
38
- text:'Cancel',
39
- handler: function() {
40
- this.up('window').close();
41
- },
42
- },
43
- ],
44
-
45
- items: {
46
- xtype: 'form',
47
- defaultType: 'textfield',
48
- bodyPadding: '15px 15px 0px 10px',
49
- defaults: {
50
- listeners: {
51
- specialkey: function (field, event) {
52
- if (event.getKey() == event.ENTER) {
53
- field.up('window').submit();
54
- }
55
- }
56
- },
57
- },
58
- items: [
59
- {
60
- fieldLabel: 'Login',
61
- name: 'login',
62
- },
63
- {
64
- fieldLabel: 'Password',
65
- name: 'password',
66
- inputType: 'password',
67
- }
68
- ]
12
+ // calling the endpoint
13
+ me.server.signIn(values, function (res) {
14
+ if (res) {
15
+ if (!me.authSpecMode) {
16
+ this.signinWin.close();
17
+ }
18
+ Ext.Msg.show({
19
+ title: "Signed in",
20
+ msg: "Signed in successfully, reloading...",
21
+ icon: Ext.Msg.INFO,
22
+ closable: false
23
+ });
24
+ if (!me.authSpecMode) {
25
+ window.location.href = "/";
69
26
  }
27
+ }
70
28
  });
29
+ },
71
30
 
72
- this.signinWin.show();
73
- this.signinWin.down('textfield').focus(false, 100);
74
- },
31
+ closeAction: 'hide',
32
+ title: "Sign in",
33
+ fbar: [{
34
+ text: 'OK',
35
+ name: 'signin_submit',
36
+ handler: function () {
37
+ this.up('window').submit();
38
+ },
39
+ },
40
+ {
41
+ text: 'Cancel',
42
+ handler: function () {
43
+ this.up('window').close();
44
+ },
45
+ },
46
+ ],
75
47
 
76
- netzkeOnSignOut: function() {
77
- this.server.signOut(null, function(success) {
78
- if (success) {
79
- Ext.Msg.show({
80
- title: "Signed out",
81
- msg: "Signed out, reloading the application...",
82
- icon: Ext.Msg.INFO,
83
- closable: false
84
- });
85
- window.location.href = "/";
48
+ items: {
49
+ xtype: 'form',
50
+ defaultType: 'textfield',
51
+ bodyPadding: '15px 15px 0px 10px',
52
+ defaults: {
53
+ listeners: {
54
+ specialkey: function (field, event) {
55
+ if (event.getKey() == event.ENTER) {
56
+ field.up('window').submit();
57
+ }
86
58
  }
87
- })
88
- }
59
+ },
60
+ },
61
+ items: [{
62
+ fieldLabel: 'Login',
63
+ name: 'login',
64
+ },
65
+ {
66
+ fieldLabel: 'Password',
67
+ name: 'password',
68
+ inputType: 'password',
69
+ }
70
+ ]
71
+ }
72
+ });
73
+
74
+ this.signinWin.show();
75
+ this.signinWin.down('textfield').focus(false, 100);
76
+ },
77
+
78
+ netzkeOnSignOut: function () {
79
+ this.server.signOut(null, function (success) {
80
+ if (success) {
81
+ Ext.Msg.show({
82
+ title: "Signed out",
83
+ msg: "Signed out, reloading the application...",
84
+ icon: Ext.Msg.INFO,
85
+ closable: false
86
+ });
87
+ window.location.href = "/";
88
+ }
89
+ })
90
+ }
89
91
  }
@@ -6,61 +6,8 @@ module Marty; class DataGridView < McflyGridPanel
6
6
 
7
7
  include Extras::Layout
8
8
 
9
- def self.show_grid_js(options={})
10
- dg = options[:data_grid] || 'data_grid'
11
- title_str = options[:title_str] || 'Data Grid'
12
-
13
- javascript = l(<<-JS)
14
- function() {
15
- var sel = this.getSelectionModel().getSelection()[0];
16
- var record_id = sel && sel.getId();
17
- this.server.showGrid({record_id: record_id,
18
- data_grid: "#{dg}",
19
- title_str: "#{title_str}"});
20
- }
21
- JS
22
- javascript
23
- end
24
-
25
- def self.client_show_grid_js
26
- javascript = l(<<-JS)
27
- function(count, data, title_str) {
28
- var columns = [];
29
- var fields = [];
30
-
31
- for (var i=0; i<count; i++) {
32
- fields.push("a" + i);
33
- columns.push({dataIndex: "a" + i, text: i, flex: 1});
34
- }
35
-
36
- Ext.create('Ext.Window', {
37
- height: "80%",
38
- width: "80%",
39
- x: 0,
40
- y: 0,
41
- autoWidth: true,
42
- modal: true,
43
- autoScroll: true,
44
- title: title_str,
45
- items: {
46
- xtype: 'grid',
47
- border: false,
48
- hideHeaders: false,
49
- columns: columns,
50
- store: Ext.create('Ext.data.ArrayStore', {
51
- fields: fields,
52
- data: data,
53
- })
54
- },
55
- }).show();
56
- }
57
- JS
58
- javascript
59
- end
60
-
61
9
  client_class do |c|
62
- c.netzke_show_grid = DataGridView.show_grid_js
63
- c.netzke_client_show_grid = DataGridView.client_show_grid_js
10
+ c.include :data_grid_view
64
11
  end
65
12
 
66
13
  def configure(c)
@@ -0,0 +1,49 @@
1
+ {
2
+ netzkeShowGrid: function (options = {}) {
3
+ var dg = options.dataGrid || 'data_grid'
4
+ var title_str = options.titleStr || 'Data Grid'
5
+
6
+ var sel = this.getSelectionModel().getSelection()[0];
7
+ var record_id = sel && sel.getId();
8
+ this.server.showGrid({
9
+ record_id: record_id,
10
+ data_grid: dg,
11
+ title_str: title_str
12
+ });
13
+ },
14
+
15
+ netzkeClientShowGrid: function (count, data, title_str) {
16
+ var columns = [];
17
+ var fields = [];
18
+
19
+ for (var i = 0; i < count; i++) {
20
+ fields.push("a" + i);
21
+ columns.push({
22
+ dataIndex: "a" + i,
23
+ text: i,
24
+ flex: 1
25
+ });
26
+ }
27
+
28
+ Ext.create('Ext.Window', {
29
+ height: "80%",
30
+ width: "80%",
31
+ x: 0,
32
+ y: 0,
33
+ autoWidth: true,
34
+ modal: true,
35
+ autoScroll: true,
36
+ title: title_str,
37
+ items: {
38
+ xtype: 'grid',
39
+ border: false,
40
+ hideHeaders: false,
41
+ columns: columns,
42
+ store: Ext.create('Ext.data.ArrayStore', {
43
+ fields: fields,
44
+ data: data,
45
+ })
46
+ },
47
+ }).show();
48
+ },
49
+ }
@@ -2,10 +2,6 @@ class Marty::Form < Netzke::Form::Base
2
2
  extend ::Marty::Permissions
3
3
 
4
4
  client_class do |c|
5
- c.find_component = l(<<-JS)
6
- function(name) {
7
- return Ext.ComponentQuery.query(`[name=${name}]`)[0];
8
- }
9
- JS
5
+ c.include :form
10
6
  end
11
7
  end
@@ -0,0 +1,5 @@
1
+ {
2
+ findComponent: function (name) {
3
+ return Ext.ComponentQuery.query(`[name=${name}]`)[0];
4
+ }
5
+ }
@@ -13,152 +13,7 @@ class Marty::Grid < ::Netzke::Grid::Base
13
13
  end
14
14
 
15
15
  client_class do |c|
16
- c.get_component = l(<<-JS)
17
- function(name) {
18
- return Ext.getCmp(name);
19
- }
20
- JS
21
-
22
- c.find_component = l(<<-JS)
23
- function(name) {
24
- return Ext.ComponentQuery.query(`[name=${name}]`)[0];
25
- }
26
- JS
27
-
28
- c.set_disable_component_actions = l(<<-JS)
29
- function(prefix, flag) {
30
- for (var key in this.actions) {
31
- if (key.substring(0, prefix.length) == prefix) {
32
- this.actions[key].setDisabled(flag);
33
- }
34
- }
35
- }
36
- JS
37
-
38
- c.init_component = l(<<-JS)
39
- function() {
40
- this.dockedItems = this.dockedItems || [];
41
- if (this.paging == 'pagination') {
42
- this.dockedItems.push({
43
- xtype: 'pagingtoolbar',
44
- dock: 'bottom',
45
- layout: {overflowHandler: 'Menu'},
46
- listeners: {
47
- 'beforechange': this.disableDirtyPageWarning ? {} : {
48
- fn: this.netzkeBeforePageChange, scope: this
49
- }
50
- },
51
- store: this.store,
52
- items: this.bbar && ["-"].concat(this.bbar)
53
- });
54
- } else if (this.bbar) {
55
- this.dockedItems.push({
56
- xtype: 'toolbar',
57
- dock: 'bottom',
58
- layout: {overflowHandler: 'Menu'},
59
- items: this.bbar
60
- });
61
- }
62
-
63
- // block creation of toolbars in parent
64
- delete this.bbar;
65
- var paging = this.paging
66
- if (paging != 'buffered') { this.paging = false; }
67
- this.callParent();
68
- this.paging = paging
69
-
70
- var me = this;
71
-
72
- var children = me.serverConfig.child_components || [];
73
- me.onSelectionChange(
74
- function(m) {
75
- var has_sel = m.hasSelection();
76
-
77
- var rid = null;
78
- if (has_sel) {
79
- if (m.type == 'spreadsheet') {
80
- var cell = m.getSelected().startCell;
81
- rid = cell && cell.record.getId();
82
- }
83
- if (!rid) {
84
- selected = m.getSelection()[0];
85
- rid = selected && selected.getId();
86
- }
87
- }
88
-
89
- me.serverConfig.selected = rid;
90
- me.setDisableComponentActions('do', !has_sel);
91
-
92
- for (var child of children) {
93
- var comp = me.findComponent(child)
94
- if (comp) {
95
- comp.serverConfig.parent_id = rid;
96
- if (comp.setDisableComponentActions) {
97
- comp.setDisableComponentActions('parent', !has_sel);
98
- }
99
- if (comp.reload) { comp.reload() }
100
- }
101
- }
102
- });
103
-
104
- var store = me.getStore();
105
- var linked = me.serverConfig.linked_components || [];
106
- for (var event of ['update', 'netzkerefresh']) {
107
- store.on(event, function() {
108
- for (var link of linked) {
109
- var comp = me.findComponent(link);
110
- if (comp && comp.reload) { comp.reload() }
111
- }
112
- }, this);
113
- }
114
- }
115
- JS
116
-
117
- c.on_selection_change = l(<<-JS)
118
- function(f) {
119
- var me = this;
120
- me.getSelectionModel().on('selectionchange', f);
121
- }
122
- JS
123
-
124
- c.do_view_in_form = l(<<-JS)
125
- function(record){
126
- this.netzkeLoadComponent("view_window", {
127
- serverConfig: {record_id: record.id},
128
- callback: function(w){
129
- w.show();
130
- w.on('close', function(){
131
- if (w.closeRes === "ok") {
132
- this.netzkeReloadStore();
133
- }
134
- }, this);
135
- }});
136
- }
137
- JS
138
-
139
- c.reload = l(<<-JS)
140
- function(opts={}) {
141
- this.netzkeReloadStore(opts);
142
- }
143
- JS
144
-
145
- c.reload_all = l(<<-JS)
146
- function() {
147
- var me = this;
148
- var children = me.serverConfig.child_components || [];
149
- this.store.reload();
150
- for (child of children) {
151
- var comp = me.findComponent(child);
152
- if (comp && comp.reload) { comp.reload() }
153
- }
154
- }
155
- JS
156
-
157
- c.clear_filters = l(<<-JS)
158
- function() {
159
- this.filters.clearFilters();
160
- }
161
- JS
16
+ c.include :grid
162
17
  end
163
18
 
164
19
  ######################################################################