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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9ee3d792d48f1c5052df8f8def69d9b41feb772
4
- data.tar.gz: 65421bc19936cb0890bf8309ca3496e9088a46c8
3
+ metadata.gz: 0bef7dd4d1ad62c9921002f1316cd341936b76fa
4
+ data.tar.gz: 5fbe57c48a6c3c55228985871247a840ab385b40
5
5
  SHA512:
6
- metadata.gz: 7af3b91f0c5a4a899ce73523d7723b1ae360de9550a0e6146207247545d2a2f4e6f011396d9ab4fd21b0632fde382445b284aba1f653656af8aa1b9144b9ab8f
7
- data.tar.gz: f7d0b171766d83f2b6253a4c702a9d4a9b1b66ec32bad409c2519f14230e832cc14a106c858a5ca517b56696ffe7e16181bd14bebe0d4cfc0ab1f055b0dfbd74
6
+ metadata.gz: a3ded106dcb9b1569a36f1d744194af7027d1a441e74292aaf41b726f361fd94651eda041b3de921b0ada3662e8287364dc467a1487fbc67088a4d7588343667
7
+ data.tar.gz: 24ac1aa4769187583415eeee331225480ce4315decaf080964d2b0d6c78809fb329e957ab4304afd31a387d6b922b05bb92c9da0f5ab044a4d143929fca8fcb9
data/Gemfile CHANGED
@@ -4,5 +4,6 @@ gem "yard-activerecord", github: 'nathanstitt/yard-activerecord', branch: 'd
4
4
  gem "active_record_mocks", github: 'nathanstitt/active_record_mocks', branch: 'develop'
5
5
 
6
6
  gem 'puma'
7
+ gem 'pry-byebug'
7
8
 
8
9
  gemspec
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'yard'
5
5
  require 'yard-activerecord'
6
6
  require_relative 'yard_ext/all'
7
7
  require 'guard'
8
-
8
+ require 'lanes/rake_tasks'
9
9
  Dir.glob('tasks/*.rake').each { |r| load r}
10
10
 
11
11
  Rake::TestTask.new do |t|
@@ -1,9 +1,9 @@
1
1
  Lanes.renderScreenTo = (selector, options) ->
2
- Lanes.config.set(options)
3
- Lanes.Models.Bootstrap.initialize(options)
2
+ Lanes.config.bootstrap(options)
4
3
  document.addEventListener "DOMContentLoaded", ->
5
4
  viewport = new Lanes.React.Viewport(selector: selector)
6
5
  Lanes.Models.PubSub.initialize()
7
6
  Lanes.Extensions.fireOnInitialized(viewport)
8
- Lanes.React.runRouter(viewport)
7
+ viewport.renderRoot()
9
8
  Lanes.Extensions.fireOnAvailable(viewport)
9
+ viewport.onBoot()
@@ -1,21 +1,56 @@
1
+ class SystemSettings extends Lanes.Models.Base
2
+
3
+ mixins: [ Lanes.Models.Mixins.FileSupport ]
4
+
5
+ props:
6
+ id: {type:"integer"}
7
+ logo: "file"
8
+ settings: "object"
9
+
10
+ modelTypeIdentifier: -> 'system-settings'
11
+ url: -> Lanes.config.api_path + 'system-settings'
12
+ initialize: ->
13
+ @on('change:settings', @setDefaultSettings)
14
+ @setDefaultSettings()
15
+
16
+ setDefaultSettings: ->
17
+ @settings ||= {}
18
+ @settings.lanes || = {}
19
+
20
+ forExtension: (ext) ->
21
+ @settings[ext] ||= {}
22
+
23
+ setValueForExtension: (ext, key, value) ->
24
+ @forExtension(ext)[key] = value
25
+
1
26
  class Config extends Lanes.Models.State
2
- constructor: -> super
3
27
 
4
28
  session:
5
29
  csrf_token: { type: 'string', setOnce: true }
6
- api_path: { type: 'string', default: '', setOnce: true }
30
+ root_path: { type: 'string', setOnce: true }
31
+ api_path: { type: 'string', setOnce: true }
7
32
  assets_path_prefix: { type: 'string', setOnce: true }
8
33
  environment: { type: 'string', setOnce: true }
9
34
  initial_workspace_screen_id: { type: 'string', setOnce: true }
35
+ system_settings: { type: 'state', required: true }
10
36
 
11
37
  derived:
12
38
  env:
13
39
  deps: ['environment'], fn: ->
14
40
  {
15
- test: this.environment == 'test',
41
+ test: this.environment == 'test',
16
42
  development: this.environment == 'development',
17
43
  production: this.environment == 'production'
18
44
  }
19
45
 
46
+ initialize: ->
47
+ @system_settings = new SystemSettings
48
+
49
+ bootstrap: (options) ->
50
+ if options.system_settings
51
+ @system_settings.set(options.system_settings)
52
+ delete options.system_settings
53
+ @set(options)
54
+ Lanes.Extensions.setBootstrapData(options) if _.isObject(options)
20
55
 
21
56
  Lanes.config = new Config
@@ -11,7 +11,7 @@ class Lanes.Access.Extension extends Lanes.Extensions.Base
11
11
  Lanes.current_user.access_data = data.access
12
12
 
13
13
  showLogin: ->
14
- Lanes.Workspace.Extension.uistate.modalDialog = Lanes.Access.LoginDialog.instance()
14
+ Lanes.Access.LoginDialog.instance().show(@viewport)
15
15
 
16
16
  hideLogin: ->
17
17
  Lanes.Workspace.Extension.uistate.modalDialog = null
@@ -1,5 +1,6 @@
1
1
  class Session extends Lanes.Models.Base
2
- api_path: 'user-session'
2
+ api_path: 'lanes-access/user-session'
3
+
3
4
  props:
4
5
  id: 'integer'
5
6
  login: 'string'
@@ -10,69 +11,78 @@ class Session extends Lanes.Models.Base
10
11
 
11
12
  class Lanes.Access.LoginDialog extends Lanes.React.Component
12
13
 
14
+ statics:
15
+ show: (viewport, props = {}) ->
16
+ session = new Session
17
+
18
+ attemptLogin = (dlg) ->
19
+ session.save(ignoreErrors: true).then ->
20
+ if session.user
21
+ Lanes.current_user.setLoginData(session.user, session.access)
22
+ dlg.hide()
23
+ _.extend(viewport.modalProps, {show: !session.user})
24
+
25
+ viewport.modalProps = _.extend({}, props,
26
+ title: 'Please Login'
27
+ onCancel: null, onOk: attemptLogin, show: true,
28
+ buttons: [{ title: 'Login', style: 'primary', eventKey: 'ok'}]
29
+ body: (props) ->
30
+ <Lanes.Access.LoginDialog
31
+ {...props}
32
+ model={session}
33
+ attemptLogin={attemptLogin} />
34
+ )
35
+
36
+
37
+
13
38
  mixins: [
14
39
  Lanes.React.Mixins.RelayEditingState
15
40
  ]
41
+ listenNetworkEvents: true
16
42
 
17
43
  getDefaultProps: ->
18
44
  writable: true, editOnly: true
19
45
 
20
46
  dataObjects: ->
21
- model: new Session
22
-
23
- login: ->
24
- @model.save().then =>
25
- Lanes.current_user.setLoginData(@model.user, @model.access) if @model.user
47
+ model: 'props'
26
48
 
27
49
  warning: ->
28
50
  <BS.Alert bsStyle='warning'>
29
- <strong>{@model.lastServerMessage}</strong>
51
+ <strong>{@model.lastServerMessage}</strong>
30
52
  </BS.Alert>
31
53
 
32
54
  render: ->
33
- <LC.Modal title='Please log in'
34
- backdrop={false}
35
- closeButton=false
36
- animation={false}>
37
-
38
- <div className='modal-body'>
39
-
40
- {@warning() if @state?.hasError}
41
-
42
- <BS.Row>
43
- <BS.Col mdOffset={2} xs={12} md={8}>
44
-
45
- <LC.TextField
46
- model={@model}
47
- autoFocus writable
48
- name="login"
49
- label='Username'
50
- placeholder='Enter Login'
51
- />
52
-
53
- <LC.TextField
54
- writable
55
- model={@model}
56
- name="password"
57
- type='password'
58
- label='Password'
59
- placeholder='Enter Password'
60
- />
61
-
62
- </BS.Col>
63
- </BS.Row>
64
- </div>
65
-
66
-
67
- <div className='modal-footer'>
68
- <BS.Button onClick={@login} bsStyle='primary'>Login</BS.Button>
69
- </div>
70
-
71
- </LC.Modal>
55
+ <div>
56
+ {@warning() if @state?.hasError}
57
+ <BS.Row>
58
+ <BS.Col mdOffset={2} xs={12} md={8}>
59
+
60
+ <LC.Input
61
+ model={@model}
62
+ onEnter={=> @props.attemptLogin(@props.modal)}
63
+ autoFocus writable
64
+ name="login"
65
+ label='Username'
66
+ placeholder='Enter Login'
67
+ />
68
+
69
+ <LC.Input
70
+ writable
71
+ model={@model}
72
+ onEnter={=> @props.attemptLogin(@props.modal)}
73
+ name="password"
74
+ type='password'
75
+ label='Password'
76
+ placeholder='Enter Password'
77
+ />
78
+
79
+ </BS.Col>
80
+ </BS.Row>
81
+ </div>
72
82
 
73
83
 
74
84
 
75
85
  # Function that returns a factory (or function) for the LoginDialog.
76
86
  # Intended as an extension point for other users to override if needed
77
87
  Lanes.Access.LoginDialog.instance = ->
78
- @cache ||= React.createFactory(Lanes.Access.LoginDialog)
88
+ Lanes.Access.LoginDialog
@@ -51,9 +51,9 @@ class Lanes.Models.UserRoleSet
51
51
  @locked_fields = role.decodeLockedFields(access.locked_fields, @locked_fields)
52
52
 
53
53
  can: (method, model, field) ->
54
- if model instanceof Lanes.Models.Base
54
+ return true unless model
55
+ if model.constructor and not model.prototype
55
56
  model = model.constructor
56
-
57
57
  if field && ( locks = @locked_fields[model::api_path()] ) && ( grants = locks[field] )
58
58
  for grant in grants
59
59
  if grant.only && grant.only != method
@@ -4,7 +4,7 @@ class Lanes.Models.User extends Lanes.Models.Base
4
4
  super
5
5
  this.access_data = access
6
6
 
7
- api_path: -> 'users'
7
+ api_path: -> 'lanes-access/users'
8
8
  derived:
9
9
  roles:
10
10
  deps: ['role_names', 'access_data']
@@ -25,7 +25,7 @@ class Lanes.Models.User extends Lanes.Models.Base
25
25
  access_data: 'object'
26
26
 
27
27
  props:
28
- id: { type: "integer", required:true }
28
+ id: 'integer'
29
29
  login: 'string'
30
30
  name: 'string'
31
31
  email: 'string'
@@ -33,6 +33,7 @@ class Lanes.Models.User extends Lanes.Models.Base
33
33
  options: 'object'
34
34
  password: 'string'
35
35
 
36
+ hasAccess: (access, model, field) -> this.roles.can(access, model, field)
36
37
  canRead: (model, field) -> this.roles.canRead(model, field)
37
38
  canWrite: (model, field) -> this.roles.canWrite(model, field)
38
39
  canDelete: (model) -> this.roles.canDelete(model)
@@ -63,7 +64,7 @@ class Lanes.Models.User extends Lanes.Models.Base
63
64
 
64
65
 
65
66
  class Session extends Lanes.Models.Base
66
- api_path: 'user-session'
67
+ api_path: 'lanes-access/user-session'
67
68
  props:
68
69
  id: 'integer'
69
70
  login: 'string'
@@ -5,37 +5,38 @@ class Lanes.Access.Screens.UserManagement extends Lanes.React.Screen
5
5
  {id:'id', visible: false}
6
6
  'login', 'name', 'email', {id:'role_names', title:'Role Names'}
7
7
  ]
8
- query: new Lanes.Models.Query({
9
- fields: fields, modelClass: Lanes.Models.User
10
- })
8
+ query: new Lanes.Models.Query(fields: fields, src: Lanes.Models.User)
11
9
 
12
10
  rolesForUser: (user) ->
13
- {value: user.role_names, roles: _.map(user.role_names, _.field2title)}
11
+ _.map user.role_names, (rn) -> {id: rn, name: _.titleize(rn) }
14
12
 
15
- setRolesForUser: (model, roles) ->
16
- model.role_names = _.pluck(roles, 'id')
13
+ setRolesForUser: (roles, options) ->
14
+ options.model.role_names = _.pluck(roles, 'id')
17
15
 
18
16
  editors: (props) ->
19
17
  role_names: ({model}) =>
20
18
  <LC.SelectField
21
19
  id="role_names"
22
20
  key="row-select"
23
- editOnly multi writable unstyled
21
+ queryModel={Lanes.Models.User}
22
+ editOnly multiSelect writable unstyled
24
23
  model={model}
25
- name="roles"
24
+ labelField='name'
26
25
  getSelection={@rolesForUser}
27
26
  setSelection={@setRolesForUser}
28
- collection={Lanes.Models.Role.all}
27
+ choices={Lanes.Models.Role.all.models}
28
+ fetchWhenOpen={false}
29
29
  name="role_names"
30
30
  />
31
31
 
32
32
  render: ->
33
- <div>
33
+ <LC.ScreenWrapper identifier="user-management" flexVertical>
34
34
  <h1>Users Management</h1>
35
35
  <LC.Grid
36
+ editorProps={height: 400, syncImmediatly: true}
36
37
  query={@state.query}
37
38
  allowCreate
38
39
  editor={Lanes.Access.Screens.UserManagement.Editor}
39
40
  columEditors={@editors()}
40
41
  ref="grid"/>
41
- </div>
42
+ </LC.ScreenWrapper>
@@ -0,0 +1,16 @@
1
+ class Lanes.Components.Calendar extends Lanes.React.Component
2
+
3
+ statics:
4
+ Events: Lanes.Vendor.Dayz.EventsCollection
5
+
6
+ propTypes:
7
+ display: React.PropTypes.oneOf(['month', 'week', 'day']),
8
+ date: React.PropTypes.object.isRequired,
9
+ dayComponent: React.PropTypes.func,
10
+ events: React.PropTypes.instanceOf(Lanes.Vendor.Dayz.EventsCollection),
11
+ dayLabelComponent: React.PropTypes.func,
12
+ onDayClick: React.PropTypes.func,
13
+ onEventClick: React.PropTypes.func
14
+
15
+ render: ->
16
+ <Lanes.Vendor.Dayz {...@props}>{@props.children}</Lanes.Vendor.Dayz>
@@ -0,0 +1,3 @@
1
+ //= require 'lanes/vendor/calendar'
2
+ //= require ./Calendar
3
+ //= require_tree .
@@ -0,0 +1,3 @@
1
+ $dayz-event-colors: $lanes-color-selections;
2
+ $dayz-event-text-colors: $lanes-text-color-selections;
3
+ @import "lanes/vendor/calendar";
@@ -0,0 +1,86 @@
1
+ class Lanes.Components.Grid.Body extends Lanes.React.BaseComponent
2
+
3
+ propTypes:
4
+ query: React.PropTypes.instanceOf(Lanes.Models.Query).isRequired
5
+ cellStyles: React.PropTypes.object.isRequired
6
+
7
+ fieldConvertors:
8
+ bigdec: (v) -> _.bigDecimal(v).toFixed(2)
9
+
10
+ onRowClick: (ev, row, index) ->
11
+ ourBounds = _.dom(@).el.getBoundingClientRect()
12
+ clickBounds = _.dom(ev.target).el.getBoundingClientRect()
13
+ top = this.refs.list.getScroll() + (
14
+ clickBounds.top - ourBounds.top
15
+ )
16
+ left = ev.clientX - ourBounds.left
17
+ selectedIndex = (if @props.selectedIndex == index then null else index)
18
+ selectedModel = if selectedIndex? then @props.query.results.modelAt(selectedIndex)?.clone() else null
19
+ @props.onRowClick(selectedModel, selectedIndex,
20
+ {top, left, container: ourBounds, rowHeight: clickBounds.height}
21
+ )
22
+
23
+ convertValue: (value, field) ->
24
+ if @fieldConvertors[field.type] then @fieldConvertors[field.type](value) else value
25
+
26
+ renderColumn: (rowNum, index, field, results, row) ->
27
+ value = results.valueForField(rowNum, field)
28
+
29
+ onColClick = if field.onColumnClick
30
+ _.partial(field.onColumnClick, _,
31
+ {value, field, index, rowNum, row, query: @props.query }
32
+ )
33
+ else
34
+ null
35
+
36
+ value = if field.format
37
+ field.format(value, row, @props.query)
38
+ else
39
+ @convertValue(value, field)
40
+
41
+ value = React.createElement( field.component,
42
+ {value: value, query: @props.query, row}
43
+ ) if field.component
44
+
45
+ <div key={field.id}
46
+ onClick={onColClick}
47
+ {...@props.cellStyles.props[index]}
48
+ >
49
+ {value}
50
+ </div>
51
+
52
+ renderRow: (rowNum, ref) ->
53
+ fields = []
54
+ results = @props.query.results
55
+ row = results.rowRepresentation(rowNum)
56
+ for field, index in @props.query.fields.models when field.visible
57
+ fields.push @renderColumn(rowNum, index, field, results, row)
58
+
59
+ if @props.onRowClick
60
+ onClick = _.partial(@onRowClick, _, row, rowNum)
61
+ <div key={rowNum} ref={ref} className="r" onClick={onClick} >
62
+ {fields}
63
+ </div>
64
+
65
+ render: ->
66
+ <div className={_.classnames('grid-body', 'is-editing': @props.editing)}>
67
+
68
+ <LC.NetworkActivityOverlay model={@props.query} />
69
+
70
+ <Lanes.Components.Grid.Editor
71
+ {...@props}
72
+
73
+ cellStyles={@props.cellStyles}
74
+ onCancel={@props.onEditCancel}
75
+ editing={@props.editing} />
76
+
77
+ <Lanes.Vendor.List
78
+ useTranslate3d
79
+ isEditing={!!@props.editing}
80
+ itemRenderer={@renderRow}
81
+ length={@props.query.results.length}
82
+ forceUpdateProp={@props.query.changeCount}
83
+ type='variable'
84
+ ref="list"
85
+ />
86
+ </div>