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
@@ -3,9 +3,15 @@ Lanes.React.Mixins.Viewport = {
3
3
  contextTypes:
4
4
  viewport: Lanes.PropTypes.State
5
5
 
6
- }
6
+ showDialog: (props) ->
7
+ new Promise( (onOk, onCancel) =>
8
+ @context.viewport.modalProps = _.extend({}, props, {show: true, onOk, onCancel})
9
+ )
10
+
11
+ hideDialog: ->
12
+ @context.viewport.modal = {show: false}
7
13
 
14
+ }
8
15
 
9
16
  Object.defineProperty Lanes.React.Mixins.Viewport, 'viewport',
10
- get: ->
11
- @context.viewport
17
+ get: -> @context.viewport
@@ -11,8 +11,8 @@ Lanes.Screens.ChangeListener = {
11
11
 
12
12
  derived:
13
13
  changes: deps:[], fn: ->
14
- new Lanes.Models.ChangeSetCollection([],{ parent: this })
15
- changes_visible: { deps: ['change_count'], fn:-> @change_count > 0 }
14
+ new Lanes.Models.ChangeSetCollection([], { parent: this })
15
+ changes_visible: { deps: ['change_count'], fn: -> @change_count > 0 }
16
16
 
17
17
  bindings:
18
18
  'changes_visible': { selector: '.changes-notification', type: 'toggle' }
@@ -27,7 +27,7 @@ Lanes.Screens.ChangeListener = {
27
27
  view: 'Lanes.Views.ModelUpdate'
28
28
  collection: 'changes'
29
29
 
30
- onChange: (model,change) ->
30
+ onChange: (model, change) ->
31
31
  @changes.add(change)
32
32
  @change_count += 1
33
33
 
@@ -1,9 +1,7 @@
1
- class Lanes.Screens.Commands
1
+ class Lanes.Screens.Commands extends Lanes.Models.State
2
2
 
3
3
  constructor: (@screen, @options = {}) ->
4
- _.defaults(@options,
5
- modelName: 'model'
6
- )
4
+ _.defaults(@options, modelName: 'model')
7
5
  _.bindAll(this, _.functions(this))
8
6
 
9
7
  resetModel: ->
@@ -11,14 +9,23 @@ class Lanes.Screens.Commands
11
9
  @setModel( new model.constructor )
12
10
  undefined
13
11
 
14
- getModel: ->
15
- @screen[@options.modelName]
12
+ getModel: -> @screen[@options.modelName]
16
13
 
17
14
  setModel: (model) ->
15
+ @options.modelWillRebind?(model)
18
16
  @screen.data.rebind("#{@options.modelName}": model)
17
+ @screen.setModelUrl?(model)
18
+ @options.modelDidRebind?(model)
19
+
20
+ canEditModel: ->
21
+
22
+ @screen.hasWriteAccess?()
23
+
24
+ getSyncOptions: ->
25
+ _.result(@screen, 'syncOptions') || {}
19
26
 
20
27
  saveModel: ->
21
- @getModel().save()
28
+ @getModel().save(@getSyncOptions())
22
29
 
23
30
  toggleEdit: ->
24
31
  @screen.setState(isEditing: !@isEditing())
@@ -0,0 +1,20 @@
1
+ class Lanes.Screens.CommonComponents extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ commands: React.PropTypes.instanceOf(Lanes.Screens.Commands).isRequired
5
+ errors: React.PropTypes.bool
6
+ networkActivity: React.PropTypes.bool
7
+ toolbarProps: React.PropTypes.object
8
+
9
+
10
+
11
+ render: ->
12
+ model = @props.commands.getModel()
13
+ <div>
14
+ {unless @networkActivity is false
15
+ <LC.NetworkActivityOverlay model={model} {...@props} /> }
16
+ <LC.Toolbar {...@props} {...@props.toolbarProps}>
17
+ {@props.children}
18
+ </LC.Toolbar>
19
+ {<LC.ErrorDisplay model={model} {...@props} /> unless @errors is false}
20
+ </div>
@@ -1,20 +1,34 @@
1
1
  class ScreenView extends Lanes.Models.BasicModel
2
2
 
3
3
  session:
4
+ props: 'object'
4
5
  screen: 'object'
5
- active: ['boolean', true, true]
6
- id: type: 'number', setOnce: true, required: true, default: ->
7
- _.uniqueId('screen')
6
+ model: 'state'
7
+ active: 'boolean' #, true, true]
8
+ id: type: 'string', setOnce: true, required: true, default: ->
9
+ Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 3)
8
10
 
9
11
  component: ->
10
12
  @screen.getScreen()
11
13
 
14
+ title: ->
15
+ code = @model?.visibleIdentifier?() or ''
16
+ code = "::#{code}" if code
17
+ title = @screen.title
18
+ title = title[0...10] + '…' if title.length > 12
19
+ title + code
20
+
12
21
  initialize: (options) ->
22
+ this.props ||= {}
23
+ this.props.screen = this
13
24
  Lanes.Screens.Definitions.displaying.add( this )
14
25
 
15
26
  remove: ->
16
27
  Lanes.Screens.Definitions.displaying.remove( this )
17
28
 
29
+ historyUrl: ->
30
+ code = @model?.visibleIdentifier?() or ''
31
+ pathname: "/#{@id}/#{@screen.id}/#{code}"
18
32
 
19
33
 
20
34
  class ScreenDefinition extends Lanes.Models.BasicModel
@@ -27,6 +41,7 @@ class ScreenDefinition extends Lanes.Models.BasicModel
27
41
  view: 'string'
28
42
  icon: 'string'
29
43
  group_id: 'string'
44
+ access: 'string'
30
45
  loading: 'boolean'
31
46
  extension: 'string'
32
47
  model: 'string'
@@ -55,6 +70,10 @@ class ScreenDefinition extends Lanes.Models.BasicModel
55
70
  deps: ['extension', 'model'], fn: ->
56
71
  _.classify(@extension) + ".Screens." + @view
57
72
 
73
+ label:
74
+ deps: ['id', 'title'], fn: ->
75
+ @title || _.field2title(@id)
76
+
58
77
  getScreen: ->
59
78
  Lanes.u.getPath(@extension_path)
60
79
 
@@ -68,22 +87,31 @@ class ScreenDefinition extends Lanes.Models.BasicModel
68
87
  me = this
69
88
  return new _.Promise( (resolve, reject) ->
70
89
  me.loading = true
71
- Lanes.lib.RequestAssets(me.asset_paths...)
72
- .then ->
73
- me.loading = false
74
- viewModel = me.getScreen()
75
- if viewModel then resolve(me)
76
- else reject("Screen #{me.view} not definied after file retrieval")
77
- , (msg) ->
78
- Lanes.warn(msg)
79
- me.loading = false
80
- reject(msg)
90
+ attempt = 0
91
+ done = ->
92
+ me.loading = false
93
+ viewModel = me.getScreen()
94
+ if viewModel
95
+ resolve(me)
96
+ else if attempt < 3
97
+ attempt += 1
98
+ _.delay(done, 500)
99
+ else
100
+ reject("Screen #{me.view} not definied after file retrieval")
101
+ err = (msg) ->
102
+ Lanes.warn(msg)
103
+ me.loading = false
104
+ reject(msg)
105
+ Lanes.lib.RequestAssets(me.asset_paths...).then(done, err)
81
106
  )
82
107
 
83
108
 
84
- display: ->
85
- this.ensureLoaded().then =>
86
- new ScreenView( screen: @ )
109
+ display: (props) ->
110
+ props = _.extend({}, props, screen: this)
111
+ this.ensureLoaded().then ->
112
+ sv = new ScreenView(props)
113
+ sv.active = true
114
+ sv
87
115
 
88
116
 
89
117
  class ScreenViewSet extends Lanes.Models.BasicCollection
@@ -94,6 +122,12 @@ class ScreenViewSet extends Lanes.Models.BasicCollection
94
122
  @findWhere( active: true )
95
123
 
96
124
  initialize: (models, options = {}) ->
125
+ Lanes.current_user.on "change:isLoggedIn", (user) =>
126
+ if user.isLoggedIn
127
+ for screen_id in Lanes.current_user.options?.initial_screens || []
128
+ Lanes.Screens.Definitions.all.get(screen_id)?.display()
129
+ else
130
+ @reset()
97
131
  this.on( 'change:active add', this.onActiveChange )
98
132
 
99
133
  remove: (model) ->
@@ -122,19 +156,21 @@ class ScreenViewSet extends Lanes.Models.BasicCollection
122
156
  current = this.length
123
157
  this.at(current + inc).active = true
124
158
 
125
-
159
+ findInstance: (screenId, instanceId) ->
160
+ this.find (instance) ->
161
+ instance.screen.id is screenId and instance.id is instanceId
126
162
 
127
163
  class ScreenSet extends Lanes.Models.BasicCollection
128
164
 
129
165
  model: ScreenDefinition
130
-
131
166
  register: Lanes.emptyFn
132
167
 
133
168
  addScreen: (screen) ->
134
169
  screen = this.add( screen )
135
170
  screen.set(active:true)
136
171
 
137
-
172
+ isLoading: ->
173
+ !!Lanes.Screens.Definitions.all.findWhere({loading: true})
138
174
 
139
175
  class MenuGroup extends Lanes.Models.BasicModel
140
176
 
@@ -153,7 +189,7 @@ class MenuGroup extends Lanes.Models.BasicModel
153
189
  @cache ||= new Lanes.Models.SubCollection( Lanes.Screens.Definitions.all, {
154
190
  filter: (screen) =>
155
191
  screen.group_id == @id &&
156
- (!screen.model_type || Lanes.current_user.canRead(screen.model_type))
192
+ (!screen.model_type || Lanes.current_user.hasAccess(screen.access, screen.model_type))
157
193
  watched: ['group_id']
158
194
  })
159
195
 
@@ -187,4 +223,12 @@ Lanes.Screens.Definitions = {
187
223
  groups: new MenuGroupSet
188
224
  register: (spec) ->
189
225
  this.all.add( spec )
226
+ setBrowserLocation: (location) ->
227
+ [instanceId, screenId, args...] = _.compact(location.pathname.split('/'))
228
+ return unless screenId
229
+ if instanceId and ( instance = @displaying.findInstance(screenId, instanceId) )
230
+ instance.active = true
231
+ else
232
+ @all.get(screenId)?.display(id: instanceId, props: {args: args})
233
+
190
234
  }
@@ -0,0 +1,56 @@
1
+ class Lanes.Screens.SystemSettings extends Lanes.React.Screen
2
+
3
+ dataObjects:
4
+ config: -> Lanes.config.system_settings
5
+
6
+ getInitialState: ->
7
+ isEditing: true
8
+ commands: new Lanes.Screens.Commands(this, modelName: 'config')
9
+
10
+ onChange: (path, ev) ->
11
+ @config.settings.lanes[path] = if ev.target then ev.target.value else ev
12
+ @forceUpdate()
13
+
14
+ renderFileOptions: ->
15
+ dir = @config.settings.lanes.storage_dir
16
+ <LC.FieldWrapper label='Store Directory' sm=9 {...@props} value={dir}>
17
+ <input type="text" className='value form-control'
18
+ placeholder="Directory to store files" value={dir}
19
+ onChange={_.partial(@onChange, 'storage_dir')} />
20
+ </LC.FieldWrapper>
21
+
22
+ renderFogOptions: ->
23
+ value = JSON.stringify(@config.settings.lanes.fog_credentials, null, 2)
24
+ <LC.FieldWrapper label='Fog Options' sm=9 {...@props} value={value}>
25
+ <BS.Input type="textarea" placeholder="FOG options (as JSON)" value={value}
26
+ onChange={_.partial(@onChange, 'fog_credentials')} />
27
+ </LC.FieldWrapper>
28
+
29
+ saveConfig: ->
30
+ @config.save(saveAll: true)
31
+
32
+ render: ->
33
+ choices = ['file', 'fog']
34
+ storage = @config.settings.lanes?.storage || 'file'
35
+
36
+ <LC.ScreenWrapper identifier="user-preferences">
37
+ <BS.Nav bsStyle="pills" className="lanes-toolbar">
38
+ <BS.Button navItem componentClass="button"
39
+ onClick={@saveConfig} className="save navbar-btn control">
40
+ <LC.Icon type="cloud-upload" />Save
41
+ </BS.Button>
42
+ </BS.Nav>
43
+
44
+ <BS.Row>
45
+ <LC.FieldWrapper label='File Storage' sm=3 {...@props} value={storage}>
46
+ <Lanes.Vendor.ReactWidgets.DropdownList
47
+ data={choices} value={storage} onChange={_.partial(@onChange, 'storage')} />
48
+ </LC.FieldWrapper>
49
+ {if storage is 'file' then @renderFileOptions() else @renderFogOptions()}
50
+ </BS.Row>
51
+ <BS.Row>
52
+ <LC.ImageSaver label='Logo' sm=4 model={@config} name='logo' />
53
+ </BS.Row>
54
+ {for id, Ext of Lanes.Extensions.instances when Ext.settingsElement
55
+ <Ext.settingsElement settings={@config.settings[id]} key={id} /> }
56
+ </LC.ScreenWrapper>
@@ -0,0 +1,38 @@
1
+ class Lanes.Screens.UserPreferences extends Lanes.React.Screen
2
+
3
+ dataObjects:
4
+ user: -> Lanes.current_user
5
+
6
+ getInitialState: ->
7
+ isEditing: true
8
+ commands: new Lanes.Screens.Commands(this, modelName: 'user')
9
+
10
+ setScreens: (screens) ->
11
+ @user.options = _.extend({}, @user.options, {initial_screens: _.pluck(screens, 'id')})
12
+
13
+ getScreens: ->
14
+ _.map(@user.options?.initial_screens || [], (id) ->
15
+ screen = Lanes.Screens.Definitions.all.get(id)
16
+ {id, label: screen.label}
17
+ )
18
+
19
+ render: ->
20
+ <LC.ScreenWrapper identifier="user-preferences">
21
+ <Lanes.Screens.CommonComponents commands={@state.commands} />
22
+ <BS.Row>
23
+ <LC.SelectField xs=12
24
+ multiSelect
25
+ fetchWhenOpen={false}
26
+ label='Initial Screens'
27
+ labelField='label'
28
+ name='options'
29
+ model={@user}
30
+ choices={Lanes.Screens.Definitions.all.models}
31
+ queryModel={Lanes.Screens.Definitions.all}
32
+ setSelection={@setScreens}
33
+ getSelection={@getScreens}
34
+ />
35
+ </BS.Row>
36
+ {for id, Ext of Lanes.Extensions.instances when Ext.preferenceElement
37
+ <Ext.preferenceElement key={id} /> }
38
+ </LC.ScreenWrapper>
@@ -2,4 +2,7 @@
2
2
  //= require ./Definitions
3
3
  //= require ./register
4
4
  //= require ./Commands
5
+ //= require ./CommonComponents
5
6
  //= require ./mixins
7
+ //= require ./UserPreferences
8
+ //= require ./SystemSettings
@@ -4,4 +4,5 @@
4
4
  */
5
5
  @import "lanes/styles/bootstrap/variables";
6
6
  @import "lanes/styles/bootstrap/mixins";
7
- @import "lanes/styles/fonts";
7
+ @import "lanes/styles/variables";
8
+ @import "lanes/styles/mixins/all";
@@ -7,6 +7,7 @@ $lanes-icon-font: 'FontAwesome';
7
7
  button, a.btn {
8
8
  .icon {
9
9
  margin-right: 0.5em;
10
+ &.flush { margin-right: 0; }
10
11
  }
11
12
  &.icon:before{
12
13
  font-family: $lanes-icon-font;
@@ -1,2 +1,3 @@
1
1
  @import "global/fancy-header";
2
-
2
+ @import "global/flexbox";
3
+ @import "global/styles";
@@ -0,0 +1,16 @@
1
+ .flex-vertically {
2
+ @include flexbox();
3
+ @include flex-direction(column);
4
+ }
5
+
6
+ .row.flex-expand {
7
+ @include flexbox();
8
+ @include flex-grow(1);
9
+ @include flex-direction(column);
10
+ }
11
+
12
+ .flex-row-expand {
13
+ @include flexbox();
14
+ @include flex-grow(1);
15
+ @include flex-direction(column);
16
+ }
@@ -0,0 +1 @@
1
+ .cursor-pointer { cursor: pointer; }
@@ -0,0 +1,21 @@
1
+ @mixin lanes-unpadded-dropdown() {
2
+ .rw-input {
3
+ padding: 0;
4
+ > div {
5
+ padding-left: 0.5rem;
6
+ }
7
+ }
8
+ ul.rw-list {
9
+ li.rw-list-option {
10
+ padding-left: 0;
11
+ padding-right: 0;
12
+ &:hover {
13
+ box-shadow: 0 0 5px rgba(0,0,0,0.5);
14
+ }
15
+ > div {
16
+ border-radius: 4px;
17
+ padding: 5px;
18
+ }
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,394 @@
1
+ // Flexbox Mixins
2
+ // http://philipwalton.github.io/solved-by-flexbox/
3
+ // https://github.com/philipwalton/solved-by-flexbox
4
+ //
5
+ // Copyright (c) 2013 Brian Franco
6
+ //
7
+ // Permission is hereby granted, free of charge, to any person obtaining a
8
+ // copy of this software and associated documentation files (the
9
+ // "Software"), to deal in the Software without restriction, including
10
+ // without limitation the rights to use, copy, modify, merge, publish,
11
+ // distribute, sublicense, and/or sell copies of the Software, and to
12
+ // permit persons to whom the Software is furnished to do so, subject to
13
+ // the following conditions:
14
+ // The above copyright notice and this permission notice shall be included
15
+ // in all copies or substantial portions of the Software.
16
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ //
24
+ // This is a set of mixins for those who want to mess around with flexbox
25
+ // using the native support of current browsers. For full support table
26
+ // check: http://caniuse.com/flexbox
27
+ //
28
+ // Basically this will use:
29
+ //
30
+ // * Fallback, old syntax (IE10, mobile webkit browsers - no wrapping)
31
+ // * Final standards syntax (FF, Safari, Chrome, IE11, Opera)
32
+ //
33
+ // This was inspired by:
34
+ //
35
+ // * http://dev.opera.com/articles/view/advanced-cross-browser-flexbox/
36
+ //
37
+ // With help from:
38
+ //
39
+ // * http://w3.org/tr/css3-flexbox/
40
+ // * http://the-echoplex.net/flexyboxes/
41
+ // * http://msdn.microsoft.com/en-us/library/ie/hh772069(v=vs.85).aspx
42
+ // * http://css-tricks.com/using-flexbox/
43
+ // * http://dev.opera.com/articles/view/advanced-cross-browser-flexbox/
44
+ // * https://developer.mozilla.org/en-us/docs/web/guide/css/flexible_boxes
45
+
46
+ //----------------------------------------------------------------------
47
+
48
+ // Flexbox Containers
49
+ //
50
+ // The 'flex' value causes an element to generate a block-level flex
51
+ // container box.
52
+ //
53
+ // The 'inline-flex' value causes an element to generate a inline-level
54
+ // flex container box.
55
+ //
56
+ // display: flex | inline-flex
57
+ //
58
+ // http://w3.org/tr/css3-flexbox/#flex-containers
59
+ //
60
+ // (Placeholder selectors for each type, for those who rather @extend)
61
+
62
+ @mixin flexbox {
63
+ display: -webkit-box;
64
+ display: -webkit-flex;
65
+ display: -moz-flex;
66
+ display: -ms-flexbox;
67
+ display: flex;
68
+ }
69
+
70
+ %flexbox { @include flexbox; }
71
+
72
+ //----------------------------------
73
+
74
+ @mixin inline-flex {
75
+ display: -webkit-inline-box;
76
+ display: -webkit-inline-flex;
77
+ display: -moz-inline-flex;
78
+ display: -ms-inline-flexbox;
79
+ display: inline-flex;
80
+ }
81
+
82
+ %inline-flex { @include inline-flex; }
83
+
84
+ //----------------------------------------------------------------------
85
+
86
+ // Flexbox Direction
87
+ //
88
+ // The 'flex-direction' property specifies how flex items are placed in
89
+ // the flex container, by setting the direction of the flex container's
90
+ // main axis. This determines the direction that flex items are laid out in.
91
+ //
92
+ // Values: row | row-reverse | column | column-reverse
93
+ // Default: row
94
+ //
95
+ // http://w3.org/tr/css3-flexbox/#flex-direction-property
96
+
97
+ @mixin flex-direction($value: row) {
98
+ @if $value == row-reverse {
99
+ -webkit-box-direction: reverse;
100
+ -webkit-box-orient: horizontal;
101
+ } @else if $value == column {
102
+ -webkit-box-direction: normal;
103
+ -webkit-box-orient: vertical;
104
+ } @else if $value == column-reverse {
105
+ -webkit-box-direction: reverse;
106
+ -webkit-box-orient: vertical;
107
+ } @else {
108
+ -webkit-box-direction: normal;
109
+ -webkit-box-orient: horizontal;
110
+ }
111
+ -webkit-flex-direction: $value;
112
+ -moz-flex-direction: $value;
113
+ -ms-flex-direction: $value;
114
+ flex-direction: $value;
115
+ }
116
+ // Shorter version:
117
+ @mixin flex-dir($args...) { @include flex-direction($args...); }
118
+
119
+ //----------------------------------------------------------------------
120
+
121
+ // Flexbox Wrap
122
+ //
123
+ // The 'flex-wrap' property controls whether the flex container is single-line
124
+ // or multi-line, and the direction of the cross-axis, which determines
125
+ // the direction new lines are stacked in.
126
+ //
127
+ // Values: nowrap | wrap | wrap-reverse
128
+ // Default: nowrap
129
+ //
130
+ // http://w3.org/tr/css3-flexbox/#flex-wrap-property
131
+
132
+ @mixin flex-wrap($value: nowrap) {
133
+ // No Webkit Box fallback.
134
+ -webkit-flex-wrap: $value;
135
+ -moz-flex-wrap: $value;
136
+ @if $value == nowrap {
137
+ -ms-flex-wrap: none;
138
+ } @else {
139
+ -ms-flex-wrap: $value;
140
+ }
141
+ flex-wrap: $value;
142
+ }
143
+
144
+ //----------------------------------------------------------------------
145
+
146
+ // Flexbox Flow (shorthand)
147
+ //
148
+ // The 'flex-flow' property is a shorthand for setting the 'flex-direction'
149
+ // and 'flex-wrap' properties, which together define the flex container's
150
+ // main and cross axes.
151
+ //
152
+ // Values: <flex-direction> | <flex-wrap>
153
+ // Default: row nowrap
154
+ //
155
+ // http://w3.org/tr/css3-flexbox/#flex-flow-property
156
+
157
+ @mixin flex-flow($values: (row nowrap)) {
158
+ // No Webkit Box fallback.
159
+ -webkit-flex-flow: $values;
160
+ -moz-flex-flow: $values;
161
+ -ms-flex-flow: $values;
162
+ flex-flow: $values;
163
+ }
164
+
165
+ //----------------------------------------------------------------------
166
+
167
+ // Flexbox Order
168
+ //
169
+ // The 'order' property controls the order in which flex items appear within
170
+ // their flex container, by assigning them to ordinal groups.
171
+ //
172
+ // Default: 0
173
+ //
174
+ // http://w3.org/tr/css3-flexbox/#order-property
175
+
176
+ @mixin order($int: 0) {
177
+ -webkit-box-ordinal-group: $int + 1;
178
+ -webkit-order: $int;
179
+ -moz-order: $int;
180
+ -ms-flex-order: $int;
181
+ order: $int;
182
+ }
183
+
184
+ //----------------------------------------------------------------------
185
+
186
+ // Flexbox Grow
187
+ //
188
+ // The 'flex-grow' property sets the flex grow factor. Negative numbers
189
+ // are invalid.
190
+ //
191
+ // Default: 0
192
+ //
193
+ // http://w3.org/tr/css3-flexbox/#flex-grow-property
194
+
195
+ @mixin flex-grow($int: 0) {
196
+ -webkit-box-flex: $int;
197
+ -webkit-flex-grow: $int;
198
+ -moz-flex-grow: $int;
199
+ -ms-flex-positive: $int;
200
+ flex-grow: $int;
201
+ }
202
+
203
+ //----------------------------------------------------------------------
204
+
205
+ // Flexbox Shrink
206
+ //
207
+ // The 'flex-shrink' property sets the flex shrink factor. Negative numbers
208
+ // are invalid.
209
+ //
210
+ // Default: 1
211
+ //
212
+ // http://w3.org/tr/css3-flexbox/#flex-shrink-property
213
+
214
+ @mixin flex-shrink($int: 1) {
215
+ -webkit-flex-shrink: $int;
216
+ -moz-flex-shrink: $int;
217
+ -ms-flex-negative: $int;
218
+ flex-shrink: $int;
219
+ }
220
+
221
+ //----------------------------------------------------------------------
222
+
223
+ // Flexbox Basis
224
+ //
225
+ // The 'flex-basis' property sets the flex basis. Negative lengths are invalid.
226
+ //
227
+ // Values: Like "width"
228
+ // Default: auto
229
+ //
230
+ // http://www.w3.org/TR/css3-flexbox/#flex-basis-property
231
+
232
+ @mixin flex-basis($value: auto) {
233
+ -webkit-flex-basis: $value;
234
+ -moz-flex-basis: $value;
235
+ -ms-flex-preferred-size: $value;
236
+ flex-basis: $value;
237
+ }
238
+
239
+ //----------------------------------------------------------------------
240
+
241
+ // Flexbox "Flex" (shorthand)
242
+ //
243
+ // The 'flex' property specifies the components of a flexible length: the
244
+ // flex grow factor and flex shrink factor, and the flex basis. When an
245
+ // element is a flex item, 'flex' is consulted instead of the main size
246
+ // property to determine the main size of the element. If an element is
247
+ // not a flex item, 'flex' has no effect.
248
+ //
249
+ // Values: none | <flex-grow> <flex-shrink> || <flex-basis>
250
+ // Default: See individual properties (1 1 0).
251
+ //
252
+ // http://w3.org/tr/css3-flexbox/#flex-property
253
+
254
+ @mixin flex($fg: 1, $fs: null, $fb: null) {
255
+
256
+ // Set a variable to be used by box-flex properties
257
+ $fg-boxflex: $fg;
258
+
259
+ // Box-Flex only supports a flex-grow value so let's grab the
260
+ // first item in the list and just return that.
261
+ @if type-of($fg) == 'list' {
262
+ $fg-boxflex: nth($fg, 1);
263
+ }
264
+
265
+ -webkit-box-flex: $fg-boxflex;
266
+ -webkit-flex: $fg $fs $fb;
267
+ -moz-box-flex: $fg-boxflex;
268
+ -moz-flex: $fg $fs $fb;
269
+ -ms-flex: $fg $fs $fb;
270
+ flex: $fg $fs $fb;
271
+ }
272
+
273
+ //----------------------------------------------------------------------
274
+
275
+ // Flexbox Justify Content
276
+ //
277
+ // The 'justify-content' property aligns flex items along the main axis
278
+ // of the current line of the flex container. This is done after any flexible
279
+ // lengths and any auto margins have been resolved. Typically it helps distribute
280
+ // extra free space leftover when either all the flex items on a line are
281
+ // inflexible, or are flexible but have reached their maximum size. It also
282
+ // exerts some control over the alignment of items when they overflow the line.
283
+ //
284
+ // Note: 'space-*' values not supported in older syntaxes.
285
+ //
286
+ // Values: flex-start | flex-end | center | space-between | space-around
287
+ // Default: flex-start
288
+ //
289
+ // http://w3.org/tr/css3-flexbox/#justify-content-property
290
+
291
+ @mixin justify-content($value: flex-start) {
292
+ @if $value == flex-start {
293
+ -webkit-box-pack: start;
294
+ -ms-flex-pack: start;
295
+ } @else if $value == flex-end {
296
+ -webkit-box-pack: end;
297
+ -ms-flex-pack: end;
298
+ } @else if $value == space-between {
299
+ -webkit-box-pack: justify;
300
+ -ms-flex-pack: justify;
301
+ } @else if $value == space-around {
302
+ -ms-flex-pack: distribute;
303
+ } @else {
304
+ -webkit-box-pack: $value;
305
+ -ms-flex-pack: $value;
306
+ }
307
+ -webkit-justify-content: $value;
308
+ -moz-justify-content: $value;
309
+ justify-content: $value;
310
+ }
311
+ // Shorter version:
312
+ @mixin flex-just($args...) { @include justify-content($args...); }
313
+
314
+ //----------------------------------------------------------------------
315
+
316
+ // Flexbox Align Items
317
+ //
318
+ // Flex items can be aligned in the cross axis of the current line of the
319
+ // flex container, similar to 'justify-content' but in the perpendicular
320
+ // direction. 'align-items' sets the default alignment for all of the flex
321
+ // container's items, including anonymous flex items. 'align-self' allows
322
+ // this default alignment to be overridden for individual flex items. (For
323
+ // anonymous flex items, 'align-self' always matches the value of 'align-items'
324
+ // on their associated flex container.)
325
+ //
326
+ // Values: flex-start | flex-end | center | baseline | stretch
327
+ // Default: stretch
328
+ //
329
+ // http://w3.org/tr/css3-flexbox/#align-items-property
330
+
331
+ @mixin align-items($value: stretch) {
332
+ @if $value == flex-start {
333
+ -webkit-box-align: start;
334
+ -ms-flex-align: start;
335
+ } @else if $value == flex-end {
336
+ -webkit-box-align: end;
337
+ -ms-flex-align: end;
338
+ } @else {
339
+ -webkit-box-align: $value;
340
+ -ms-flex-align: $value;
341
+ }
342
+ -webkit-align-items: $value;
343
+ -moz-align-items: $value;
344
+ align-items: $value;
345
+ }
346
+
347
+ //----------------------------------
348
+
349
+ // Flexbox Align Self
350
+ //
351
+ // Values: auto | flex-start | flex-end | center | baseline | stretch
352
+ // Default: auto
353
+
354
+ @mixin align-self($value: auto) {
355
+ // No Webkit Box Fallback.
356
+ -webkit-align-self: $value;
357
+ -moz-align-self: $value;
358
+ @if $value == flex-start {
359
+ -ms-flex-item-align: start;
360
+ } @else if $value == flex-end {
361
+ -ms-flex-item-align: end;
362
+ } @else {
363
+ -ms-flex-item-align: $value;
364
+ }
365
+ align-self: $value;
366
+ }
367
+
368
+ //----------------------------------------------------------------------
369
+
370
+ // Flexbox Align Content
371
+ //
372
+ // The 'align-content' property aligns a flex container's lines within the
373
+ // flex container when there is extra space in the cross-axis, similar to
374
+ // how 'justify-content' aligns individual items within the main-axis. Note,
375
+ // this property has no effect when the flexbox has only a single line.
376
+ //
377
+ // Values: flex-start | flex-end | center | space-between | space-around | stretch
378
+ // Default: stretch
379
+ //
380
+ // http://w3.org/tr/css3-flexbox/#align-content-property
381
+
382
+ @mixin align-content($value: stretch) {
383
+ // No Webkit Box Fallback.
384
+ -webkit-align-content: $value;
385
+ -moz-align-content: $value;
386
+ @if $value == flex-start {
387
+ -ms-flex-line-pack: start;
388
+ } @else if $value == flex-end {
389
+ -ms-flex-line-pack: end;
390
+ } @else {
391
+ -ms-flex-line-pack: $value;
392
+ }
393
+ align-content: $value;
394
+ }