lanes 0.1.9.5 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (304) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/Rakefile +1 -1
  4. data/client/lanes/Boot.cjsx +3 -3
  5. data/client/lanes/Config.coffee +38 -3
  6. data/client/lanes/access/Extension.coffee +1 -1
  7. data/client/lanes/access/LoginDialog.cjsx +57 -47
  8. data/client/lanes/access/Roles.coffee +2 -2
  9. data/client/lanes/access/User.coffee +4 -3
  10. data/client/lanes/access/screens/user-management/UserManagement.cjsx +12 -11
  11. data/client/lanes/components/calendar/Calendar.cjsx +16 -0
  12. data/client/lanes/components/calendar/index.js +3 -0
  13. data/client/lanes/components/calendar/styles.scss +3 -0
  14. data/client/lanes/components/grid/Body.cjsx +86 -0
  15. data/client/lanes/components/grid/CellStyles.coffee +20 -0
  16. data/client/lanes/components/grid/EditingMixin.cjsx +84 -24
  17. data/client/lanes/components/grid/Editor.cjsx +45 -0
  18. data/client/lanes/components/grid/Grid.cjsx +62 -104
  19. data/client/lanes/components/grid/Header.cjsx +35 -0
  20. data/client/lanes/components/grid/PopOverMixin.cjsx +19 -9
  21. data/client/lanes/components/grid/PopoverEditor.cjsx +7 -1
  22. data/client/lanes/components/grid/RowEditor.cjsx +1 -1
  23. data/client/lanes/components/grid/Selections.cjsx +39 -0
  24. data/client/lanes/components/grid/Toolbar.cjsx +24 -5
  25. data/client/lanes/components/grid/editors.scss +22 -50
  26. data/client/lanes/components/grid/index.js +0 -1
  27. data/client/lanes/components/grid/row-editor.scss +68 -0
  28. data/client/lanes/components/grid/styles.scss +79 -3
  29. data/client/lanes/components/modal/Modal.cjsx +64 -24
  30. data/client/lanes/components/modal/styles.scss +12 -0
  31. data/client/lanes/components/record-finder/Clause.cjsx +11 -4
  32. data/client/lanes/components/record-finder/Dialog.cjsx +23 -24
  33. data/client/lanes/components/record-finder/RecordFinder.cjsx +45 -14
  34. data/client/lanes/components/record-finder/styles.scss +9 -6
  35. data/client/lanes/components/select-field/SelectField.cjsx +108 -53
  36. data/client/lanes/components/select-field/styles.scss +19 -0
  37. data/client/lanes/components/shared/ControlLabel.cjsx +45 -0
  38. data/client/lanes/components/shared/DateTime.cjsx +48 -0
  39. data/client/lanes/components/shared/DisplayValue.cjsx +16 -0
  40. data/client/lanes/components/shared/FieldMixin.cjsx +54 -23
  41. data/client/lanes/components/shared/FieldSet.cjsx +12 -35
  42. data/client/lanes/components/shared/FieldWrapper.cjsx +13 -0
  43. data/client/lanes/components/shared/FormGroup.cjsx +37 -0
  44. data/client/lanes/components/shared/Icon.cjsx +20 -0
  45. data/client/lanes/components/shared/ImageSaver.cjsx +33 -0
  46. data/client/lanes/components/shared/Input.cjsx +19 -0
  47. data/client/lanes/components/shared/InputFieldMixin.cjsx +48 -0
  48. data/client/lanes/components/shared/JobProgress.cjsx +27 -0
  49. data/client/lanes/components/shared/NetworkActivityOverlay.cjsx +58 -0
  50. data/client/lanes/components/shared/NumberInput.cjsx +29 -0
  51. data/client/lanes/components/shared/ResizeSensor.cjsx +11 -0
  52. data/client/lanes/components/shared/ScreenWrapper.cjsx +13 -0
  53. data/client/lanes/components/shared/Throbber.cjsx +3 -0
  54. data/client/lanes/components/shared/ToggleField.cjsx +33 -0
  55. data/client/lanes/components/shared/Tooltip.cjsx +2 -2
  56. data/client/lanes/components/shared/fields.scss +75 -13
  57. data/client/lanes/components/shared/fieldset.scss +3 -5
  58. data/client/lanes/components/shared/image-saver.scss +38 -0
  59. data/client/lanes/components/shared/index.js +2 -0
  60. data/client/lanes/{styles/plugins → components/shared}/overlay.scss +17 -4
  61. data/client/lanes/components/shared/resize-sensor.scss +30 -0
  62. data/client/lanes/components/shared/styles.scss +13 -0
  63. data/client/lanes/components/shared/throbber.scss +53 -0
  64. data/client/lanes/components/toolbar/RemoteChangeSets.cjsx +21 -48
  65. data/client/lanes/components/toolbar/SaveButton.cjsx +24 -0
  66. data/client/lanes/components/toolbar/Toolbar.cjsx +24 -37
  67. data/client/lanes/components/toolbar/changes-notification.scss +10 -6
  68. data/client/lanes/components/toolbar/styles.scss +29 -9
  69. data/client/lanes/extension/Base.coffee +4 -5
  70. data/client/lanes/index.js +0 -1
  71. data/client/lanes/index.scss.erb +10 -1
  72. data/client/lanes/lib/HotReload.coffee +13 -15
  73. data/client/lanes/lib/MakeBaseClass.coffee +6 -1
  74. data/client/lanes/lib/development.coffee +2 -0
  75. data/client/lanes/lib/dom-polyfills.coffee +5 -0
  76. data/client/lanes/lib/dom.coffee +38 -9
  77. data/client/lanes/lib/format.coffee +11 -0
  78. data/client/lanes/lib/index.js.erb +2 -0
  79. data/client/lanes/lib/production.coffee +6 -0
  80. data/client/lanes/lib/utilFunctions.coffee +50 -15
  81. data/client/lanes/models/AssociationMap.coffee +122 -46
  82. data/client/lanes/models/AssociationProxy.coffee +147 -0
  83. data/client/lanes/models/Base.coffee +97 -85
  84. data/client/lanes/models/ChangeMonitor.coffee +7 -3
  85. data/client/lanes/models/ChangeSet.coffee +2 -2
  86. data/client/lanes/models/Collection.coffee +49 -6
  87. data/client/lanes/models/JobStatus.coffee +32 -0
  88. data/client/lanes/models/PubSub.coffee +7 -5
  89. data/client/lanes/models/Query.coffee +115 -34
  90. data/client/lanes/models/ServerCache.coffee +67 -52
  91. data/client/lanes/models/State.coffee +97 -0
  92. data/client/lanes/models/Sync.coffee +18 -13
  93. data/client/lanes/models/SystemSettings.coffee +0 -0
  94. data/client/lanes/models/index.js +1 -0
  95. data/client/lanes/models/mixins/FileSupport.coffee +60 -0
  96. data/client/lanes/models/mixins/HasCodeField.coffee +13 -6
  97. data/client/lanes/models/query/ArrayResult.coffee +188 -0
  98. data/client/lanes/models/query/CollectionResult.coffee +71 -0
  99. data/client/lanes/models/query/Result.coffee +9 -0
  100. data/client/lanes/react/Component.coffee +7 -3
  101. data/client/lanes/react/PubSub.coffee +7 -7
  102. data/client/lanes/react/Root.cjsx +1 -4
  103. data/client/lanes/react/Screen.coffee +1 -0
  104. data/client/lanes/react/TypeValidators.coffee +3 -3
  105. data/client/lanes/react/Viewport.coffee +41 -7
  106. data/client/lanes/react/index.js +0 -1
  107. data/client/lanes/react/mixins/Access.coffee +4 -1
  108. data/client/lanes/react/mixins/Data.coffee +40 -25
  109. data/client/lanes/react/mixins/FieldErrors.coffee +27 -0
  110. data/client/lanes/react/mixins/RelayEditingState.coffee +4 -0
  111. data/client/lanes/react/mixins/Screen.coffee +14 -0
  112. data/client/lanes/react/mixins/Viewport.coffee +9 -3
  113. data/client/lanes/screens/ChangeListener.coffee +3 -3
  114. data/client/lanes/screens/Commands.coffee +14 -7
  115. data/client/lanes/screens/CommonComponents.cjsx +20 -0
  116. data/client/lanes/screens/Definitions.coffee +64 -20
  117. data/client/lanes/screens/SystemSettings.cjsx +56 -0
  118. data/client/lanes/screens/UserPreferences.cjsx +38 -0
  119. data/client/lanes/screens/index.js +3 -0
  120. data/client/lanes/screens/styles.scss +2 -1
  121. data/client/lanes/styles/fonts.scss +1 -0
  122. data/client/lanes/styles/global.scss +2 -1
  123. data/client/lanes/styles/global/flexbox.scss +16 -0
  124. data/client/lanes/styles/global/styles.scss +1 -0
  125. data/client/lanes/styles/mixins/_dropdown.scss +21 -0
  126. data/client/lanes/styles/mixins/_flexbox.scss +394 -0
  127. data/client/lanes/styles/mixins/all.scss +2 -0
  128. data/client/lanes/styles/variables.scss +28 -0
  129. data/client/lanes/testing/BeforeEach.coffee +15 -14
  130. data/client/lanes/testing/Helpers.coffee +14 -5
  131. data/client/lanes/testing/TestObjects.coffee +10 -2
  132. data/client/lanes/testing/index.js +1 -0
  133. data/client/lanes/testing/jasmine-react.js +125 -0
  134. data/client/lanes/vendor/base.js +56049 -74987
  135. data/client/lanes/vendor/calendar.js +17301 -0
  136. data/client/lanes/vendor/calendar.scss +303 -0
  137. data/client/lanes/vendor/commons.js +14990 -15847
  138. data/client/lanes/vendor/development.js +4912 -1952
  139. data/client/lanes/vendor/grid.js +14246 -5551
  140. data/client/lanes/vendor/grid.scss +876 -335
  141. data/client/lanes/vendor/index.js +1 -0
  142. data/client/lanes/vendor/message-bus-ajax.js +44 -0
  143. data/client/lanes/vendor/message-bus.js +414 -0
  144. data/client/lanes/vendor/rw-widgets.eot +0 -0
  145. data/client/lanes/vendor/rw-widgets.svg +18 -0
  146. data/client/lanes/vendor/rw-widgets.ttf +0 -0
  147. data/client/lanes/vendor/rw-widgets.woff +0 -0
  148. data/client/lanes/vendor/toggle.js +345 -0
  149. data/client/lanes/vendor/toggle.scss +138 -0
  150. data/client/lanes/vendor/widgets.js +21245 -6839
  151. data/client/lanes/vendor/widgets.scss +83 -67
  152. data/client/lanes/workspace/Layout.cjsx +18 -8
  153. data/client/lanes/workspace/Modal.cjsx +47 -0
  154. data/client/lanes/workspace/Navbar.cjsx +16 -2
  155. data/client/lanes/workspace/ScreenView.cjsx +10 -3
  156. data/client/lanes/workspace/ScreensMenu.cjsx +23 -7
  157. data/client/lanes/workspace/Tabs.cjsx +55 -0
  158. data/client/lanes/workspace/UIState.coffee +7 -8
  159. data/client/lanes/workspace/index.js +2 -1
  160. data/client/lanes/workspace/mixin.coffee +11 -0
  161. data/client/lanes/workspace/mixins/UIState.coffee +8 -0
  162. data/client/lanes/workspace/mixins/index.js +3 -0
  163. data/client/lanes/workspace/styles.scss +2 -1
  164. data/client/lanes/workspace/styles/header.scss +23 -1
  165. data/client/lanes/workspace/styles/layout.scss +26 -24
  166. data/client/lanes/workspace/styles/screens.scss +0 -4
  167. data/client/lanes/workspace/styles/tabs.scss +3 -10
  168. data/config/routes.rb +10 -4
  169. data/config/screens.rb +25 -0
  170. data/db/migrate/01_create_system_settings.rb +10 -0
  171. data/docs/todo-example-part-1.md +18 -20
  172. data/lanes.gemspec +15 -6
  173. data/lib/lanes.rb +4 -2
  174. data/lib/lanes/access/config/routes.rb +5 -3
  175. data/lib/lanes/access/config/screens.rb +1 -0
  176. data/lib/lanes/access/db/migrate/20140615031600_create_lanes_users.rb +1 -1
  177. data/lib/lanes/access/user.rb +1 -1
  178. data/lib/lanes/api.rb +2 -1
  179. data/lib/lanes/api/controller.rb +32 -71
  180. data/lib/lanes/api/default_routes.rb +10 -8
  181. data/lib/lanes/api/formatted_reply.rb +53 -0
  182. data/lib/lanes/api/handlers/file.rb +26 -0
  183. data/lib/lanes/api/helper_methods.rb +29 -5
  184. data/lib/lanes/api/javascript_processor.rb +36 -17
  185. data/lib/lanes/api/pub_sub.rb +6 -9
  186. data/lib/lanes/api/request_wrapper.rb +1 -2
  187. data/lib/lanes/api/root.rb +11 -43
  188. data/lib/lanes/api/routing.rb +63 -0
  189. data/lib/lanes/api/sprockets_extension.rb +15 -7
  190. data/lib/lanes/api/updates.rb +1 -2
  191. data/lib/lanes/command.rb +0 -1
  192. data/lib/lanes/command/app.rb +6 -5
  193. data/lib/lanes/command/console.rb +1 -0
  194. data/lib/lanes/command/generate.rb +3 -0
  195. data/lib/lanes/command/generate_migration.rb +33 -0
  196. data/lib/lanes/command/generate_model.rb +4 -26
  197. data/lib/lanes/command/migration_support.rb +29 -0
  198. data/lib/lanes/command/update_model.rb +14 -5
  199. data/lib/lanes/concerns/all.rb +2 -0
  200. data/lib/lanes/concerns/api_path.rb +4 -2
  201. data/lib/lanes/concerns/association_extensions.rb +1 -1
  202. data/lib/lanes/concerns/attr_accessor_with_default.rb +3 -1
  203. data/lib/lanes/concerns/code_identifier.rb +1 -1
  204. data/lib/lanes/concerns/image_uploader.rb +42 -0
  205. data/lib/lanes/concerns/pub_sub.rb +0 -1
  206. data/lib/lanes/concerns/queries.rb +2 -2
  207. data/lib/lanes/concerns/set_attribute_data.rb +4 -13
  208. data/lib/lanes/concerns/sorting_expressions.rb +34 -0
  209. data/lib/lanes/configuration.rb +48 -9
  210. data/lib/lanes/extension.rb +16 -7
  211. data/lib/lanes/extension/definition.rb +8 -2
  212. data/lib/lanes/job.rb +78 -0
  213. data/lib/lanes/job/failure_logger.rb +33 -0
  214. data/lib/lanes/model.rb +4 -0
  215. data/lib/lanes/rake_tasks.rb +6 -0
  216. data/lib/lanes/redis.rb +13 -0
  217. data/lib/lanes/screen.rb +34 -18
  218. data/lib/lanes/system_settings.rb +66 -0
  219. data/lib/lanes/version.rb +1 -1
  220. data/lib/lanes/workspace/extension.rb +1 -1
  221. data/npm-build/base.js +10 -3
  222. data/npm-build/calendar.js +6 -0
  223. data/npm-build/development.js +4 -5
  224. data/npm-build/grid.js +3 -5
  225. data/npm-build/package.json +40 -29
  226. data/npm-build/react-toggle.js +5 -0
  227. data/npm-build/react-widgets.js +6 -0
  228. data/npm-build/update-dayz +14 -0
  229. data/npm-build/webpack.config.js +5 -2
  230. data/spec/command-reference-files/initial/Gemfile +1 -1
  231. data/spec/command-reference-files/initial/config/routes.rb +2 -0
  232. data/spec/command-reference-files/initial/lib/appy-app.rb +4 -0
  233. data/spec/command-reference-files/initial/lib/appy-app/extension.rb +2 -0
  234. data/spec/command-reference-files/initial/spec/server/{spec_helpers.rb → spec_helper.rb} +0 -0
  235. data/spec/command-reference-files/model/config/routes.rb +2 -0
  236. data/spec/command-reference-files/model/spec/server/test_test_spec.rb +1 -1
  237. data/spec/command-reference-files/screen/client/appy-app/screens/ready-set-go/ReadySetGo.cjsx +6 -4
  238. data/spec/command-reference-files/screen/client/appy-app/screens/ready-set-go/index.scss +4 -3
  239. data/spec/command-reference-files/screen/config/screens.rb +4 -2
  240. data/spec/command-reference-files/screen/spec/appy-app/screens/ready-set-go/ReadySetGoSpec.coffee +1 -1
  241. data/spec/fixtures/system_settings.yml +1 -0
  242. data/spec/lanes/components/grid/GridSpec.coffee +56 -31
  243. data/spec/lanes/components/grid/RowEditorSpec.coffee +96 -0
  244. data/spec/lanes/components/select-field/SelectFieldSpec.coffee +99 -0
  245. data/spec/lanes/components/shared/NetworkActivityOverlaySpec.coffee +34 -0
  246. data/spec/lanes/models/AssociationMapSpec.coffee +36 -2
  247. data/spec/lanes/models/AssociationProxySpec.coffee +77 -0
  248. data/spec/lanes/models/BaseSpec.coffee +37 -4
  249. data/spec/lanes/models/CollectionSpec.coffee +11 -17
  250. data/spec/lanes/models/PubSubSpec.coffee +1 -1
  251. data/spec/lanes/models/ServerCacheSpec.coffee +65 -0
  252. data/spec/server/api/coffeescript_processor_spec.rb +1 -1
  253. data/spec/server/concerns/pub_sub_spec.rb +9 -10
  254. data/spec/server/concerns/sorting_expressions_spec.rb +34 -0
  255. data/spec/server/configuration_spec.rb +3 -3
  256. data/spec/server/job_spec.rb +54 -0
  257. data/spec/server/spec_helper.rb +0 -5
  258. data/spec/server/system_settings_spec.rb +23 -0
  259. data/templates/client/screens/Screen.cjsx +6 -4
  260. data/templates/client/screens/styles.scss +4 -3
  261. data/templates/config/routes.rb +2 -0
  262. data/templates/config/screen.rb +4 -2
  263. data/templates/lib/namespace.rb +4 -0
  264. data/templates/lib/namespace/extension.rb +2 -0
  265. data/templates/spec/client/Screen.coffee +1 -1
  266. data/templates/spec/server/model_spec.rb +1 -1
  267. data/templates/spec/server/{spec_helpers.rb → spec_helper.rb} +0 -0
  268. data/views/lanes_root_view.erb +70 -0
  269. data/views/specs.erb +2 -2
  270. metadata +207 -68
  271. data/client/images/lanes/dataTables/Sorting icons.psd +0 -0
  272. data/client/images/lanes/dataTables/back_disabled.png +0 -0
  273. data/client/images/lanes/dataTables/back_enabled.png +0 -0
  274. data/client/images/lanes/dataTables/back_enabled_hover.png +0 -0
  275. data/client/images/lanes/dataTables/favicon.ico +0 -0
  276. data/client/images/lanes/dataTables/forward_disabled.png +0 -0
  277. data/client/images/lanes/dataTables/forward_enabled.png +0 -0
  278. data/client/images/lanes/dataTables/forward_enabled_hover.png +0 -0
  279. data/client/images/lanes/dataTables/loading-background.png +0 -0
  280. data/client/images/lanes/dataTables/sort_asc.png +0 -0
  281. data/client/images/lanes/dataTables/sort_asc_disabled.png +0 -0
  282. data/client/images/lanes/dataTables/sort_both.png +0 -0
  283. data/client/images/lanes/dataTables/sort_desc.png +0 -0
  284. data/client/images/lanes/dataTables/sort_desc_disabled.png +0 -0
  285. data/client/lanes/components/shared/Resize.cjsx +0 -152
  286. data/client/lanes/components/shared/TextArea.cjsx +0 -19
  287. data/client/lanes/components/shared/TextField.cjsx +0 -25
  288. data/client/lanes/models/Bootstrap.coffee +0 -5
  289. data/client/lanes/models/QueryResults.coffee +0 -93
  290. data/client/lanes/react/FormBindings.coffee +0 -103
  291. data/client/lanes/react/Router.cjsx +0 -18
  292. data/client/lanes/styles/dataTables.scss +0 -4
  293. data/client/lanes/styles/plugins/all.scss +0 -2
  294. data/client/lanes/styles/plugins/resize-sensor.scss +0 -24
  295. data/client/lanes/vendor/jquery-2.js +0 -9190
  296. data/client/lanes/vendor/jquery.tap.js +0 -401
  297. data/client/lanes/vendor/magicsuggest.js +0 -1565
  298. data/client/lanes/vendor/message-bus.coffee +0 -264
  299. data/client/lanes/workspace/ActiveScreenSwitcher.cjsx +0 -38
  300. data/client/lanes/workspace/styles/toolbar.scss +0 -4
  301. data/lib/lanes/api/eco.js +0 -516
  302. data/lib/lanes/api/sprockets_compressor.rb +0 -39
  303. data/spec/command-reference-files/model/lib/appy-app.rb +0 -11
  304. data/views/index.erb +0 -19
@@ -1,264 +0,0 @@
1
- ###jshint bitwise: false###
2
-
3
- ###*
4
- Message Bus functionality.
5
-
6
- @class MessageBus
7
- @namespace Discourse
8
- @module Discourse
9
- *
10
- ###
11
-
12
- Lanes.Vendor.MessageBus = do ->
13
- # http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
14
- callbacks = undefined
15
- clientId = undefined
16
- failCount = undefined
17
- shouldLongPoll = undefined
18
- queue = undefined
19
- responseCallbacks = undefined
20
- uniqueId = undefined
21
- baseUrl = undefined
22
- me = undefined
23
- started = undefined
24
- stopped = undefined
25
- longPoller = undefined
26
- pollTimeout = undefined
27
-
28
- uniqueId = ->
29
- 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace /[xy]/g, (c) ->
30
- r = undefined
31
- v = undefined
32
- r = Math.random() * 16 | 0
33
- v = if c == 'x' then r else r & 0x3 | 0x8
34
- v.toString 16
35
-
36
- clientId = uniqueId()
37
- responseCallbacks = {}
38
- callbacks = []
39
- queue = []
40
- interval = null
41
- failCount = 0
42
- baseUrl = '/'
43
-
44
- ### TODO: The plan is to force a long poll as soon as page becomes visible
45
- // MIT based off https://github.com/mathiasbynens/jquery-visibility/blob/master/jquery-visibility.js
46
- initVisibilityTracking = function(window, document, $, undefined) {
47
- var prefix;
48
- var property;
49
- // In Opera, `'onfocusin' in document == true`, hence the extra `hasFocus` check to detect IE-like behavior
50
- var eventName = 'onfocusin' in document && 'hasFocus' in document ? 'focusin focusout' : 'focus blur';
51
- var prefixes = ['webkit', 'o', 'ms', 'moz', ''];
52
- var $event = $.event;
53
-
54
- while ((prefix = prefixes.pop()) !== undefined) {
55
- property = (prefix ? prefix + 'H': 'h') + 'idden';
56
- var supportsVisibility = typeof document[property] === 'boolean';
57
- if (supportsVisibility) {
58
- eventName = prefix + 'visibilitychange';
59
- break;
60
- }
61
- }
62
-
63
- $(/blur$/.test(eventName) ? window : document).on(eventName, function(event) {
64
- var type = event.type;
65
- var originalEvent = event.originalEvent;
66
-
67
- // Avoid errors from triggered native events for which `originalEvent` is
68
- // not available.
69
- if (!originalEvent) {
70
- return;
71
- }
72
-
73
- var toElement = originalEvent.toElement;
74
-
75
- // If it's a `{focusin,focusout}` event (IE), `fromElement` and `toElement`
76
- // should both be `null` or `undefined`; else, the page visibility hasn't
77
- // changed, but the user just clicked somewhere in the doc. In IE9, we need
78
- // to check the `relatedTarget` property instead.
79
- if (
80
- !/^focus./.test(type) || (
81
- toElement === undefined &&
82
- originalEvent.fromElement === undefined &&
83
- originalEvent.relatedTarget === undefined
84
- )
85
- ) {
86
- visibilityChanged(property && document[property] || /^(?:blur|focusout)$/.test(type) ? 'hide' : 'show');
87
- }
88
- });
89
-
90
- };
91
- ###
92
-
93
- hiddenProperty = undefined
94
- _.each ['', 'webkit', 'ms', 'moz', 'ms'], (index, prefix) ->
95
- check = prefix + (if prefix == '' then 'hidden' else 'Hidden')
96
- if document[check] != undefined
97
- hiddenProperty = check
98
- return
99
-
100
- isHidden = ->
101
- if hiddenProperty != undefined
102
- document[hiddenProperty]
103
- else
104
- !document.hasFocus
105
-
106
- shouldLongPoll = ->
107
- me.alwaysLongPoll or !isHidden()
108
-
109
- totalAjaxFailures = 0
110
- totalAjaxCalls = 0
111
- lastAjax = undefined
112
-
113
- longPoller = (poll, data) ->
114
- gotData = false
115
- aborted = false
116
- lastAjax = new Date
117
- totalAjaxCalls += 1
118
-
119
- error = (err, resp, body) ->
120
- if me.aborted
121
- aborted = true
122
- me.aborted = false
123
- else
124
- failCount += 1
125
- totalAjaxFailures += 1
126
-
127
- success = (body) ->
128
- messages = JSON.parse(body)
129
- failCount = 0
130
- if messages == null
131
- return
132
- # server unexpectedly closed connection
133
- _.each messages, (message) ->
134
- gotData = true
135
- _.each callbacks, (callback) ->
136
- if callback.channel == message.channel
137
- callback.last_id = message.message_id
138
- try
139
- callback.func message.data
140
- catch e
141
- if console.log
142
- console.log 'MESSAGE BUS FAIL: callback ' +
143
- callback.channel + ' caused exception ' +
144
- e.message
145
- if message.channel == '/__status'
146
- if message.data[callback.channel] != undefined
147
- callback.last_id = message.data[callback.channel]
148
- return
149
- return
150
-
151
- complete = ->
152
- interval = undefined
153
- try
154
- if gotData or aborted
155
- interval = 100
156
- else
157
- interval = me.callbackInterval
158
- if failCount > 2
159
- interval = interval * failCount
160
- else if !shouldLongPoll()
161
- # slowing down stuff a lot when hidden
162
- # we will need to fine tune this
163
- interval = interval * 4
164
- if interval > me.maxPollInterval
165
- interval = me.maxPollInterval
166
- interval -= new Date - lastAjax
167
- if interval < 100
168
- interval = 100
169
- catch e
170
- if console.log and e.message
171
- console.log 'MESSAGE BUS FAIL: ' + e.message
172
- _.delay(poll, interval)
173
- me.longPoll = null
174
-
175
- options = {
176
- url: me.baseUrl + 'message-bus/' + me.clientId + '/poll?'
177
- body: Lanes.lib.objToParam(data)
178
- timeout: pollTimeout
179
- method: 'POST'
180
- headers:
181
- 'Content-Type': 'multipart/form-data'
182
- 'X_CSRF_TOKEN': Lanes.config.csrf_token
183
- 'X-SILENCE-LOGGER': 'true'
184
- }
185
- if !shouldLongPoll() or !me.enableLongPolling
186
- options.url += 'dlp=t'
187
- Lanes.Vendor.xhr(options, (err, resp, body) ->
188
- if err then error(err, resp, body) else success(body)
189
- complete()
190
- )
191
-
192
- me =
193
- enableLongPolling: true
194
- callbackInterval: 15000
195
- maxPollInterval: 3 * 60 * 1000
196
- callbacks: callbacks
197
- clientId: clientId
198
- alwaysLongPoll: false
199
- baseUrl: baseUrl
200
- diagnostics: ->
201
- console.log 'Stopped: ' + stopped + ' Started: ' + started
202
- console.log 'Current callbacks'
203
- console.log callbacks
204
- console.log 'Total ajax calls: ' + totalAjaxCalls + ' Recent failure count: ' + failCount + ' Total failures: ' + totalAjaxFailures
205
- console.log 'Last ajax call: ' + (new Date - lastAjax) / 1000 + ' seconds ago'
206
- return
207
- stop: ->
208
- stopped = true
209
- started = false
210
- return
211
- start: (opts) ->
212
- poll = undefined
213
- if started
214
- return
215
- started = true
216
- stopped = false
217
- if !opts
218
- opts = {}
219
-
220
- poll = ->
221
- data = undefined
222
- if stopped
223
- return
224
- if callbacks.length == 0
225
- setTimeout poll, 500
226
- return
227
- data = {}
228
- _.each callbacks, (callback) ->
229
- data[callback.channel] = callback.last_id
230
- return
231
- me.longPoll = longPoller(poll, data)
232
- return
233
-
234
- poll()
235
- return
236
- subscribe: (channel, func, lastId) ->
237
- if !started and !stopped
238
- me.start()
239
- if typeof lastId != 'number' or lastId < -1
240
- lastId = -1
241
- callbacks.push
242
- channel: channel
243
- func: func
244
- last_id: lastId
245
- if me.longPoll
246
- me.aborted = true
247
- return me.longPoll.abort()
248
- return
249
- unsubscribe: (channel) ->
250
- # TODO proper globbing
251
- glob = undefined
252
- if channel.indexOf('*', channel.length - 1) != -1
253
- channel = channel.substr(0, channel.length - 1)
254
- glob = true
255
- _.remove(callbacks, (callback) ->
256
- if glob
257
- callback.channel.substr(0, channel.length) == channel
258
- else
259
- callback.channel == channel
260
- )
261
- if me.longPoll
262
- me.longPoll.abort()
263
- me.longPoll = false
264
- me
@@ -1,38 +0,0 @@
1
- class TabView extends Lanes.React.Component
2
-
3
- activate: ->
4
- @model.active = true
5
- null
6
-
7
- close: ->
8
- @model.remove()
9
-
10
- render: ->
11
- <li key={@model.cid} className={_.classnames(active: @model.active)}>
12
- <a onClick={@activate} className='tab'>{@model.screen.title}</a>
13
- <span onClick={@close} className='close'>×</span>
14
- </li>
15
-
16
-
17
- class Lanes.Workspace.ActiveScreenSwitcher extends Lanes.React.Component
18
-
19
- dataObjects:
20
- collection: -> Lanes.Screens.Definitions.displaying
21
-
22
- render: ->
23
- <div className="menu-container">
24
- <div className="active-screens">
25
- <div className="scroller scroller-left">
26
- <i className="glyphicon glyphicon-chevron-left"/>
27
- </div>
28
- <div className="scroller scroller-right">
29
- <i className="glyphicon glyphicon-chevron-right"/>
30
- </div>
31
- <div className="wrapper">
32
- <ul className="nav nav-tabs">
33
- { @collection.map (view) ->
34
- <TabView key={view.id} model=view /> }
35
- </ul>
36
- </div>
37
- </div>
38
- </div>
@@ -1,4 +0,0 @@
1
- .navbar-header {
2
- @include clearfix;
3
- float: left;
4
- }
data/lib/lanes/api/eco.js DELETED
@@ -1,516 +0,0 @@
1
- /**
2
- * Eco Compiler v1.1.0-rc-3
3
- * http://github.com/sstephenson/eco
4
- *
5
- * Copyright (c) 2011 Sam Stephenson
6
- * Released under the MIT License
7
- */
8
- this.eco = (function(modules) {
9
- return function require(name) {
10
- var fn, module = {id: name, exports: {}};
11
- if (fn = modules[name]) {
12
- fn(module, require, module.exports);
13
- return module.exports;
14
- } else {
15
- throw 'Cannot find module \'' + name + '\'';
16
- }
17
- };
18
- })({
19
- 'eco': function(module, require, exports) {
20
- // Generated by CoffeeScript 1.6.3
21
- (function() {
22
- var compile, eco, precompile, preprocess, _ref;
23
-
24
- _ref = require("./compiler"), compile = _ref.compile, precompile = _ref.precompile;
25
-
26
- preprocess = require("./preprocessor").preprocess;
27
-
28
- module.exports = eco = function(source) {
29
- var _base;
30
- if (eco.cache) {
31
- return (_base = eco.cache)[source] != null ? (_base = eco.cache)[source] : _base[source] = compile(source);
32
- } else {
33
- return compile(source);
34
- }
35
- };
36
-
37
- eco.cache = {};
38
-
39
- eco.preprocess = preprocess;
40
-
41
- eco.precompile = precompile;
42
-
43
- eco.compile = compile;
44
-
45
- eco.render = function(source, data) {
46
- return (eco(source))(data);
47
- };
48
-
49
- if (require.extensions) {
50
- require.extensions[".eco"] = function(module, filename) {
51
- var source;
52
- source = require("fs").readFileSync(filename, "utf-8");
53
- return module._compile("module.exports = " + (precompile(source)), filename);
54
- };
55
- }
56
-
57
- }).call(this);
58
-
59
- },
60
- './compiler': function(module, require, exports) {
61
- // Generated by CoffeeScript 1.6.3
62
- (function() {
63
- var CoffeeScript, indent, precompile, preprocess;
64
-
65
- CoffeeScript = require("coffee-script");
66
-
67
- preprocess = require("./preprocessor").preprocess;
68
-
69
- indent = require("./util").indent;
70
-
71
- exports.precompile = precompile = function(source, functions_ns, helpers) {
72
- var script;
73
- if (helpers == null) {
74
- helpers = "ECO";
75
- }
76
- script = CoffeeScript.compile(preprocess(source), {
77
- noWrap: true
78
- });
79
- return "function(__obj) {\n if (!__obj) __obj = {};\n var __out = [],\n __capture = " + functions_ns + ".capture(__out),__sanitize = " + functions_ns + ".sanitize,\n __safe, __objSafe = __obj.safe, __escape = __obj.escape,__safe = __obj.safe = " + functions_ns + ".safe,\n __escape = __obj.escape = " + functions_ns + ".escape, h = " + helpers + ";\n (function() {\n " + (indent(script, 4)) + "\n }).call(__obj);\n __obj.safe = __objSafe, __obj.escape = __escape;\n return __out.join('');\n}";
80
- };
81
-
82
- exports.compile = function(source) {
83
- return new Function("return " + (precompile(source)))();
84
- };
85
-
86
- }).call(this);
87
-
88
- },
89
- './preprocessor': function(module, require, exports) {
90
- // Generated by CoffeeScript 1.6.3
91
- (function() {
92
- var Preprocessor, Scanner, util;
93
-
94
- Scanner = require("./scanner");
95
-
96
- util = require("./util");
97
-
98
- module.exports = Preprocessor = (function() {
99
- Preprocessor.preprocess = function(source) {
100
- var preprocessor;
101
- preprocessor = new Preprocessor(source);
102
- return preprocessor.preprocess();
103
- };
104
-
105
- function Preprocessor(source) {
106
- this.scanner = new Scanner(source);
107
- this.output = "";
108
- this.level = 0;
109
- this.options = {};
110
- this.captures = [];
111
- }
112
-
113
- Preprocessor.prototype.preprocess = function() {
114
- var _this = this;
115
- while (!this.scanner.done) {
116
- this.scanner.scan(function(token) {
117
- return _this[token[0]].apply(_this, token.slice(1));
118
- });
119
- }
120
- return this.output;
121
- };
122
-
123
- Preprocessor.prototype.record = function(line) {
124
- this.output += util.repeat(" ", this.level);
125
- return this.output += line + "\n";
126
- };
127
-
128
- Preprocessor.prototype.printString = function(string) {
129
- if (string.length) {
130
- return this.record("__out.push " + (util.inspectString(string)));
131
- }
132
- };
133
-
134
- Preprocessor.prototype.beginCode = function(options) {
135
- return this.options = options;
136
- };
137
-
138
- Preprocessor.prototype.recordCode = function(code) {
139
- if (code !== "end") {
140
- if (this.options.print) {
141
- if (this.options.safe) {
142
- return this.record("__out.push " + code);
143
- } else {
144
- return this.record("__out.push __sanitize " + code);
145
- }
146
- } else {
147
- return this.record(code);
148
- }
149
- }
150
- };
151
-
152
- Preprocessor.prototype.indent = function(capture) {
153
- this.level++;
154
- if (capture) {
155
- this.record("__capture " + capture);
156
- this.captures.unshift(this.level);
157
- return this.indent();
158
- }
159
- };
160
-
161
- Preprocessor.prototype.dedent = function() {
162
- this.level--;
163
- if (this.level < 0) {
164
- this.fail("unexpected dedent");
165
- }
166
- if (this.captures[0] === this.level) {
167
- this.captures.shift();
168
- return this.dedent();
169
- }
170
- };
171
-
172
- Preprocessor.prototype.fail = function(message) {
173
- throw "Parse error on line " + this.scanner.lineNo + ": " + message;
174
- };
175
-
176
- return Preprocessor;
177
-
178
- })();
179
-
180
- }).call(this);
181
-
182
- },
183
- './scanner': function(module, require, exports) {
184
- // Generated by CoffeeScript 1.6.3
185
- (function() {
186
- var Scanner, StringScanner, trim;
187
-
188
- StringScanner = require("strscan").StringScanner;
189
-
190
- trim = require("./util").trim;
191
-
192
- module.exports = Scanner = (function() {
193
- Scanner.modePatterns = {
194
- data: /(.*?)(<%%|%%>|<%\s*(\#)|<%(([=-])?)|\n|$)/,
195
- code: /(.*?)((((:|(->|=>))\s*))?%>|\n|$)/,
196
- comment: /(.*?)(%>|\n|$)/
197
- };
198
-
199
- Scanner.dedentablePattern = /^(end|when|else|catch|finally)(?:\W|$)/;
200
-
201
- Scanner.scan = function(source) {
202
- var scanner, tokens;
203
- tokens = [];
204
- scanner = new Scanner(source);
205
- while (!scanner.done) {
206
- scanner.scan(function(token) {
207
- return tokens.push(token);
208
- });
209
- }
210
- return tokens;
211
- };
212
-
213
- function Scanner(source) {
214
- this.source = source.replace(/\r\n?/g, "\n");
215
- this.scanner = new StringScanner(this.source);
216
- this.mode = "data";
217
- this.buffer = "";
218
- this.lineNo = 1;
219
- this.done = false;
220
- }
221
-
222
- Scanner.prototype.scan = function(callback) {
223
- if (this.done) {
224
- return callback();
225
- } else if (this.scanner.hasTerminated()) {
226
- this.done = true;
227
- switch (this.mode) {
228
- case "data":
229
- return callback(["printString", this.flush()]);
230
- case "code":
231
- return callback(["fail", "unexpected end of template"]);
232
- }
233
- } else {
234
- this.advance();
235
- switch (this.mode) {
236
- case "data":
237
- return this.scanData(callback);
238
- case "code":
239
- return this.scanCode(callback);
240
- case "comment":
241
- return this.scanComment(callback);
242
- }
243
- }
244
- };
245
-
246
- Scanner.prototype.advance = function() {
247
- this.scanner.scanUntil(Scanner.modePatterns[this.mode]);
248
- this.buffer += this.scanner.getCapture(0);
249
- this.tail = this.scanner.getCapture(1);
250
- this.comment = this.scanner.getCapture(2);
251
- this.directive = this.scanner.getCapture(4);
252
- return this.arrow = this.scanner.getCapture(5);
253
- };
254
-
255
- Scanner.prototype.scanData = function(callback) {
256
- if (this.tail === "<%%") {
257
- this.buffer += "<%";
258
- return this.scan(callback);
259
- } else if (this.tail === "%%>") {
260
- this.buffer += "%>";
261
- return this.scan(callback);
262
- } else if (this.tail === "\n") {
263
- this.buffer += this.tail;
264
- this.lineNo++;
265
- return this.scan(callback);
266
- } else if (this.tail) {
267
- callback(["printString", this.flush()]);
268
- if (this.comment) {
269
- return this.mode = "comment";
270
- } else {
271
- this.mode = "code";
272
- return callback([
273
- "beginCode", {
274
- print: this.directive != null,
275
- safe: this.directive === "-"
276
- }
277
- ]);
278
- }
279
- }
280
- };
281
-
282
- Scanner.prototype.scanCode = function(callback) {
283
- var code;
284
- if (this.tail === "\n") {
285
- return callback(["fail", "unexpected newline in code block"]);
286
- } else if (this.tail) {
287
- this.mode = "data";
288
- code = trim(this.flush());
289
- if (this.arrow) {
290
- code += " " + this.arrow;
291
- }
292
- if (this.isDedentable(code)) {
293
- callback(["dedent"]);
294
- }
295
- callback(["recordCode", code]);
296
- if (this.directive) {
297
- return callback(["indent", this.arrow]);
298
- }
299
- }
300
- };
301
-
302
- Scanner.prototype.scanComment = function(callback) {
303
- if (this.tail === "\n") {
304
- return callback(["fail", "unexpected newline in code block"]);
305
- } else if (this.tail) {
306
- this.mode = "data";
307
- return this.buffer = "";
308
- }
309
- };
310
-
311
- Scanner.prototype.flush = function() {
312
- var buffer;
313
- buffer = this.buffer;
314
- this.buffer = "";
315
- return buffer;
316
- };
317
-
318
- Scanner.prototype.isDedentable = function(code) {
319
- return code.match(Scanner.dedentablePattern);
320
- };
321
-
322
- return Scanner;
323
-
324
- })();
325
-
326
- }).call(this);
327
-
328
- },
329
- './util': function(module, require, exports) {
330
- // Generated by CoffeeScript 1.6.3
331
- (function() {
332
- var repeat, specialCharacters;
333
-
334
- exports.repeat = repeat = function(string, count) {
335
- return Array(count + 1).join(string);
336
- };
337
-
338
- exports.indent = function(string, width) {
339
- var line, lines, space;
340
- space = repeat(" ", width);
341
- lines = (function() {
342
- var _i, _len, _ref, _results;
343
- _ref = string.split("\n");
344
- _results = [];
345
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
346
- line = _ref[_i];
347
- _results.push(space + line);
348
- }
349
- return _results;
350
- })();
351
- return lines.join("\n");
352
- };
353
-
354
- exports.trim = function(string) {
355
- return string.replace(/^\s+/, "").replace(/\s+$/, "");
356
- };
357
-
358
- specialCharacters = {
359
- '\\': '\\\\',
360
- '\b': '\\b',
361
- '\f': '\\f',
362
- '\n': '\\n',
363
- '\r': '\\r',
364
- '\t': '\\t'
365
- };
366
-
367
- exports.inspectString = function(string) {
368
- var contents;
369
- contents = string.replace(/[\x00-\x1f\\]/g, function(character) {
370
- var code;
371
- if (character in specialCharacters) {
372
- return specialCharacters[character];
373
- } else {
374
- code = character.charCodeAt(0).toString(16);
375
- if (code.length === 1) {
376
- code = "0" + code;
377
- }
378
- return "\\u00" + code;
379
- }
380
- });
381
- return "'" + contents.replace(/'/g, '\\\'') + "'";
382
- };
383
-
384
- }).call(this);
385
-
386
- },
387
- 'strscan': function(module, require, exports) {
388
- (function() {
389
- var StringScanner;
390
- ((typeof exports !== "undefined" && exports !== null) ? exports : this).StringScanner = (function() {
391
- StringScanner = function(source) {
392
- this.source = source.toString();
393
- this.reset();
394
- return this;
395
- };
396
- StringScanner.prototype.scan = function(regexp) {
397
- var matches;
398
- return (matches = regexp.exec(this.getRemainder())) && matches.index === 0 ? this.setState(matches, {
399
- head: this.head + matches[0].length,
400
- last: this.head
401
- }) : this.setState([]);
402
- };
403
- StringScanner.prototype.scanUntil = function(regexp) {
404
- var matches;
405
- if (matches = regexp.exec(this.getRemainder())) {
406
- this.setState(matches, {
407
- head: this.head + matches.index + matches[0].length,
408
- last: this.head
409
- });
410
- return this.source.slice(this.last, this.head);
411
- } else {
412
- return this.setState([]);
413
- }
414
- };
415
- StringScanner.prototype.scanChar = function() {
416
- return this.scan(/[\s\S]/);
417
- };
418
- StringScanner.prototype.skip = function(regexp) {
419
- if (this.scan(regexp)) {
420
- return this.match.length;
421
- }
422
- };
423
- StringScanner.prototype.skipUntil = function(regexp) {
424
- if (this.scanUntil(regexp)) {
425
- return this.head - this.last;
426
- }
427
- };
428
- StringScanner.prototype.check = function(regexp) {
429
- var matches;
430
- return (matches = regexp.exec(this.getRemainder())) && matches.index === 0 ? this.setState(matches) : this.setState([]);
431
- };
432
- StringScanner.prototype.checkUntil = function(regexp) {
433
- var matches;
434
- if (matches = regexp.exec(this.getRemainder())) {
435
- this.setState(matches);
436
- return this.source.slice(this.head, this.head + matches.index + matches[0].length);
437
- } else {
438
- return this.setState([]);
439
- }
440
- };
441
- StringScanner.prototype.peek = function(length) {
442
- return this.source.substr(this.head, (typeof length !== "undefined" && length !== null) ? length : 1);
443
- };
444
- StringScanner.prototype.getSource = function() {
445
- return this.source;
446
- };
447
- StringScanner.prototype.getRemainder = function() {
448
- return this.source.slice(this.head);
449
- };
450
- StringScanner.prototype.getPosition = function() {
451
- return this.head;
452
- };
453
- StringScanner.prototype.hasTerminated = function() {
454
- return this.head === this.source.length;
455
- };
456
- StringScanner.prototype.getPreMatch = function() {
457
- if (this.match) {
458
- return this.source.slice(0, this.head - this.match.length);
459
- }
460
- };
461
- StringScanner.prototype.getMatch = function() {
462
- return this.match;
463
- };
464
- StringScanner.prototype.getPostMatch = function() {
465
- if (this.match) {
466
- return this.source.slice(this.head);
467
- }
468
- };
469
- StringScanner.prototype.getCapture = function(index) {
470
- return this.captures[index];
471
- };
472
- StringScanner.prototype.reset = function() {
473
- return this.setState([], {
474
- head: 0,
475
- last: 0
476
- });
477
- };
478
- StringScanner.prototype.terminate = function() {
479
- return this.setState([], {
480
- head: this.source.length,
481
- last: this.head
482
- });
483
- };
484
- StringScanner.prototype.concat = function(string) {
485
- return this.source += string;
486
- };
487
- StringScanner.prototype.unscan = function() {
488
- if (this.match) {
489
- return this.setState([], {
490
- head: this.last,
491
- last: 0
492
- });
493
- } else {
494
- throw "nothing to unscan";
495
- }
496
- };
497
- StringScanner.prototype.setState = function(matches, values) {
498
- var _a, _b;
499
- this.head = (typeof (_a = ((typeof values === "undefined" || values === null) ? undefined : values.head)) !== "undefined" && _a !== null) ? _a : this.head;
500
- this.last = (typeof (_b = ((typeof values === "undefined" || values === null) ? undefined : values.last)) !== "undefined" && _b !== null) ? _b : this.last;
501
- this.captures = matches.slice(1);
502
- return (this.match = matches[0]);
503
- };
504
- return StringScanner;
505
- })();
506
- })();
507
-
508
- },
509
- 'coffee-script': function(module, require, exports) {
510
- if (typeof CoffeeScript !== 'undefined' && CoffeeScript != null) {
511
- module.exports = CoffeeScript;
512
- } else {
513
- throw 'Cannot require \'' + module.id + '\': CoffeeScript not found';
514
- }
515
- }
516
- })('eco');