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.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Rakefile +1 -1
- data/client/lanes/Boot.cjsx +3 -3
- data/client/lanes/Config.coffee +38 -3
- data/client/lanes/access/Extension.coffee +1 -1
- data/client/lanes/access/LoginDialog.cjsx +57 -47
- data/client/lanes/access/Roles.coffee +2 -2
- data/client/lanes/access/User.coffee +4 -3
- data/client/lanes/access/screens/user-management/UserManagement.cjsx +12 -11
- data/client/lanes/components/calendar/Calendar.cjsx +16 -0
- data/client/lanes/components/calendar/index.js +3 -0
- data/client/lanes/components/calendar/styles.scss +3 -0
- data/client/lanes/components/grid/Body.cjsx +86 -0
- data/client/lanes/components/grid/CellStyles.coffee +20 -0
- data/client/lanes/components/grid/EditingMixin.cjsx +84 -24
- data/client/lanes/components/grid/Editor.cjsx +45 -0
- data/client/lanes/components/grid/Grid.cjsx +62 -104
- data/client/lanes/components/grid/Header.cjsx +35 -0
- data/client/lanes/components/grid/PopOverMixin.cjsx +19 -9
- data/client/lanes/components/grid/PopoverEditor.cjsx +7 -1
- data/client/lanes/components/grid/RowEditor.cjsx +1 -1
- data/client/lanes/components/grid/Selections.cjsx +39 -0
- data/client/lanes/components/grid/Toolbar.cjsx +24 -5
- data/client/lanes/components/grid/editors.scss +22 -50
- data/client/lanes/components/grid/index.js +0 -1
- data/client/lanes/components/grid/row-editor.scss +68 -0
- data/client/lanes/components/grid/styles.scss +79 -3
- data/client/lanes/components/modal/Modal.cjsx +64 -24
- data/client/lanes/components/modal/styles.scss +12 -0
- data/client/lanes/components/record-finder/Clause.cjsx +11 -4
- data/client/lanes/components/record-finder/Dialog.cjsx +23 -24
- data/client/lanes/components/record-finder/RecordFinder.cjsx +45 -14
- data/client/lanes/components/record-finder/styles.scss +9 -6
- data/client/lanes/components/select-field/SelectField.cjsx +108 -53
- data/client/lanes/components/select-field/styles.scss +19 -0
- data/client/lanes/components/shared/ControlLabel.cjsx +45 -0
- data/client/lanes/components/shared/DateTime.cjsx +48 -0
- data/client/lanes/components/shared/DisplayValue.cjsx +16 -0
- data/client/lanes/components/shared/FieldMixin.cjsx +54 -23
- data/client/lanes/components/shared/FieldSet.cjsx +12 -35
- data/client/lanes/components/shared/FieldWrapper.cjsx +13 -0
- data/client/lanes/components/shared/FormGroup.cjsx +37 -0
- data/client/lanes/components/shared/Icon.cjsx +20 -0
- data/client/lanes/components/shared/ImageSaver.cjsx +33 -0
- data/client/lanes/components/shared/Input.cjsx +19 -0
- data/client/lanes/components/shared/InputFieldMixin.cjsx +48 -0
- data/client/lanes/components/shared/JobProgress.cjsx +27 -0
- data/client/lanes/components/shared/NetworkActivityOverlay.cjsx +58 -0
- data/client/lanes/components/shared/NumberInput.cjsx +29 -0
- data/client/lanes/components/shared/ResizeSensor.cjsx +11 -0
- data/client/lanes/components/shared/ScreenWrapper.cjsx +13 -0
- data/client/lanes/components/shared/Throbber.cjsx +3 -0
- data/client/lanes/components/shared/ToggleField.cjsx +33 -0
- data/client/lanes/components/shared/Tooltip.cjsx +2 -2
- data/client/lanes/components/shared/fields.scss +75 -13
- data/client/lanes/components/shared/fieldset.scss +3 -5
- data/client/lanes/components/shared/image-saver.scss +38 -0
- data/client/lanes/components/shared/index.js +2 -0
- data/client/lanes/{styles/plugins → components/shared}/overlay.scss +17 -4
- data/client/lanes/components/shared/resize-sensor.scss +30 -0
- data/client/lanes/components/shared/styles.scss +13 -0
- data/client/lanes/components/shared/throbber.scss +53 -0
- data/client/lanes/components/toolbar/RemoteChangeSets.cjsx +21 -48
- data/client/lanes/components/toolbar/SaveButton.cjsx +24 -0
- data/client/lanes/components/toolbar/Toolbar.cjsx +24 -37
- data/client/lanes/components/toolbar/changes-notification.scss +10 -6
- data/client/lanes/components/toolbar/styles.scss +29 -9
- data/client/lanes/extension/Base.coffee +4 -5
- data/client/lanes/index.js +0 -1
- data/client/lanes/index.scss.erb +10 -1
- data/client/lanes/lib/HotReload.coffee +13 -15
- data/client/lanes/lib/MakeBaseClass.coffee +6 -1
- data/client/lanes/lib/development.coffee +2 -0
- data/client/lanes/lib/dom-polyfills.coffee +5 -0
- data/client/lanes/lib/dom.coffee +38 -9
- data/client/lanes/lib/format.coffee +11 -0
- data/client/lanes/lib/index.js.erb +2 -0
- data/client/lanes/lib/production.coffee +6 -0
- data/client/lanes/lib/utilFunctions.coffee +50 -15
- data/client/lanes/models/AssociationMap.coffee +122 -46
- data/client/lanes/models/AssociationProxy.coffee +147 -0
- data/client/lanes/models/Base.coffee +97 -85
- data/client/lanes/models/ChangeMonitor.coffee +7 -3
- data/client/lanes/models/ChangeSet.coffee +2 -2
- data/client/lanes/models/Collection.coffee +49 -6
- data/client/lanes/models/JobStatus.coffee +32 -0
- data/client/lanes/models/PubSub.coffee +7 -5
- data/client/lanes/models/Query.coffee +115 -34
- data/client/lanes/models/ServerCache.coffee +67 -52
- data/client/lanes/models/State.coffee +97 -0
- data/client/lanes/models/Sync.coffee +18 -13
- data/client/lanes/models/SystemSettings.coffee +0 -0
- data/client/lanes/models/index.js +1 -0
- data/client/lanes/models/mixins/FileSupport.coffee +60 -0
- data/client/lanes/models/mixins/HasCodeField.coffee +13 -6
- data/client/lanes/models/query/ArrayResult.coffee +188 -0
- data/client/lanes/models/query/CollectionResult.coffee +71 -0
- data/client/lanes/models/query/Result.coffee +9 -0
- data/client/lanes/react/Component.coffee +7 -3
- data/client/lanes/react/PubSub.coffee +7 -7
- data/client/lanes/react/Root.cjsx +1 -4
- data/client/lanes/react/Screen.coffee +1 -0
- data/client/lanes/react/TypeValidators.coffee +3 -3
- data/client/lanes/react/Viewport.coffee +41 -7
- data/client/lanes/react/index.js +0 -1
- data/client/lanes/react/mixins/Access.coffee +4 -1
- data/client/lanes/react/mixins/Data.coffee +40 -25
- data/client/lanes/react/mixins/FieldErrors.coffee +27 -0
- data/client/lanes/react/mixins/RelayEditingState.coffee +4 -0
- data/client/lanes/react/mixins/Screen.coffee +14 -0
- data/client/lanes/react/mixins/Viewport.coffee +9 -3
- data/client/lanes/screens/ChangeListener.coffee +3 -3
- data/client/lanes/screens/Commands.coffee +14 -7
- data/client/lanes/screens/CommonComponents.cjsx +20 -0
- data/client/lanes/screens/Definitions.coffee +64 -20
- data/client/lanes/screens/SystemSettings.cjsx +56 -0
- data/client/lanes/screens/UserPreferences.cjsx +38 -0
- data/client/lanes/screens/index.js +3 -0
- data/client/lanes/screens/styles.scss +2 -1
- data/client/lanes/styles/fonts.scss +1 -0
- data/client/lanes/styles/global.scss +2 -1
- data/client/lanes/styles/global/flexbox.scss +16 -0
- data/client/lanes/styles/global/styles.scss +1 -0
- data/client/lanes/styles/mixins/_dropdown.scss +21 -0
- data/client/lanes/styles/mixins/_flexbox.scss +394 -0
- data/client/lanes/styles/mixins/all.scss +2 -0
- data/client/lanes/styles/variables.scss +28 -0
- data/client/lanes/testing/BeforeEach.coffee +15 -14
- data/client/lanes/testing/Helpers.coffee +14 -5
- data/client/lanes/testing/TestObjects.coffee +10 -2
- data/client/lanes/testing/index.js +1 -0
- data/client/lanes/testing/jasmine-react.js +125 -0
- data/client/lanes/vendor/base.js +56049 -74987
- data/client/lanes/vendor/calendar.js +17301 -0
- data/client/lanes/vendor/calendar.scss +303 -0
- data/client/lanes/vendor/commons.js +14990 -15847
- data/client/lanes/vendor/development.js +4912 -1952
- data/client/lanes/vendor/grid.js +14246 -5551
- data/client/lanes/vendor/grid.scss +876 -335
- data/client/lanes/vendor/index.js +1 -0
- data/client/lanes/vendor/message-bus-ajax.js +44 -0
- data/client/lanes/vendor/message-bus.js +414 -0
- data/client/lanes/vendor/rw-widgets.eot +0 -0
- data/client/lanes/vendor/rw-widgets.svg +18 -0
- data/client/lanes/vendor/rw-widgets.ttf +0 -0
- data/client/lanes/vendor/rw-widgets.woff +0 -0
- data/client/lanes/vendor/toggle.js +345 -0
- data/client/lanes/vendor/toggle.scss +138 -0
- data/client/lanes/vendor/widgets.js +21245 -6839
- data/client/lanes/vendor/widgets.scss +83 -67
- data/client/lanes/workspace/Layout.cjsx +18 -8
- data/client/lanes/workspace/Modal.cjsx +47 -0
- data/client/lanes/workspace/Navbar.cjsx +16 -2
- data/client/lanes/workspace/ScreenView.cjsx +10 -3
- data/client/lanes/workspace/ScreensMenu.cjsx +23 -7
- data/client/lanes/workspace/Tabs.cjsx +55 -0
- data/client/lanes/workspace/UIState.coffee +7 -8
- data/client/lanes/workspace/index.js +2 -1
- data/client/lanes/workspace/mixin.coffee +11 -0
- data/client/lanes/workspace/mixins/UIState.coffee +8 -0
- data/client/lanes/workspace/mixins/index.js +3 -0
- data/client/lanes/workspace/styles.scss +2 -1
- data/client/lanes/workspace/styles/header.scss +23 -1
- data/client/lanes/workspace/styles/layout.scss +26 -24
- data/client/lanes/workspace/styles/screens.scss +0 -4
- data/client/lanes/workspace/styles/tabs.scss +3 -10
- data/config/routes.rb +10 -4
- data/config/screens.rb +25 -0
- data/db/migrate/01_create_system_settings.rb +10 -0
- data/docs/todo-example-part-1.md +18 -20
- data/lanes.gemspec +15 -6
- data/lib/lanes.rb +4 -2
- data/lib/lanes/access/config/routes.rb +5 -3
- data/lib/lanes/access/config/screens.rb +1 -0
- data/lib/lanes/access/db/migrate/20140615031600_create_lanes_users.rb +1 -1
- data/lib/lanes/access/user.rb +1 -1
- data/lib/lanes/api.rb +2 -1
- data/lib/lanes/api/controller.rb +32 -71
- data/lib/lanes/api/default_routes.rb +10 -8
- data/lib/lanes/api/formatted_reply.rb +53 -0
- data/lib/lanes/api/handlers/file.rb +26 -0
- data/lib/lanes/api/helper_methods.rb +29 -5
- data/lib/lanes/api/javascript_processor.rb +36 -17
- data/lib/lanes/api/pub_sub.rb +6 -9
- data/lib/lanes/api/request_wrapper.rb +1 -2
- data/lib/lanes/api/root.rb +11 -43
- data/lib/lanes/api/routing.rb +63 -0
- data/lib/lanes/api/sprockets_extension.rb +15 -7
- data/lib/lanes/api/updates.rb +1 -2
- data/lib/lanes/command.rb +0 -1
- data/lib/lanes/command/app.rb +6 -5
- data/lib/lanes/command/console.rb +1 -0
- data/lib/lanes/command/generate.rb +3 -0
- data/lib/lanes/command/generate_migration.rb +33 -0
- data/lib/lanes/command/generate_model.rb +4 -26
- data/lib/lanes/command/migration_support.rb +29 -0
- data/lib/lanes/command/update_model.rb +14 -5
- data/lib/lanes/concerns/all.rb +2 -0
- data/lib/lanes/concerns/api_path.rb +4 -2
- data/lib/lanes/concerns/association_extensions.rb +1 -1
- data/lib/lanes/concerns/attr_accessor_with_default.rb +3 -1
- data/lib/lanes/concerns/code_identifier.rb +1 -1
- data/lib/lanes/concerns/image_uploader.rb +42 -0
- data/lib/lanes/concerns/pub_sub.rb +0 -1
- data/lib/lanes/concerns/queries.rb +2 -2
- data/lib/lanes/concerns/set_attribute_data.rb +4 -13
- data/lib/lanes/concerns/sorting_expressions.rb +34 -0
- data/lib/lanes/configuration.rb +48 -9
- data/lib/lanes/extension.rb +16 -7
- data/lib/lanes/extension/definition.rb +8 -2
- data/lib/lanes/job.rb +78 -0
- data/lib/lanes/job/failure_logger.rb +33 -0
- data/lib/lanes/model.rb +4 -0
- data/lib/lanes/rake_tasks.rb +6 -0
- data/lib/lanes/redis.rb +13 -0
- data/lib/lanes/screen.rb +34 -18
- data/lib/lanes/system_settings.rb +66 -0
- data/lib/lanes/version.rb +1 -1
- data/lib/lanes/workspace/extension.rb +1 -1
- data/npm-build/base.js +10 -3
- data/npm-build/calendar.js +6 -0
- data/npm-build/development.js +4 -5
- data/npm-build/grid.js +3 -5
- data/npm-build/package.json +40 -29
- data/npm-build/react-toggle.js +5 -0
- data/npm-build/react-widgets.js +6 -0
- data/npm-build/update-dayz +14 -0
- data/npm-build/webpack.config.js +5 -2
- data/spec/command-reference-files/initial/Gemfile +1 -1
- data/spec/command-reference-files/initial/config/routes.rb +2 -0
- data/spec/command-reference-files/initial/lib/appy-app.rb +4 -0
- data/spec/command-reference-files/initial/lib/appy-app/extension.rb +2 -0
- data/spec/command-reference-files/initial/spec/server/{spec_helpers.rb → spec_helper.rb} +0 -0
- data/spec/command-reference-files/model/config/routes.rb +2 -0
- data/spec/command-reference-files/model/spec/server/test_test_spec.rb +1 -1
- data/spec/command-reference-files/screen/client/appy-app/screens/ready-set-go/ReadySetGo.cjsx +6 -4
- data/spec/command-reference-files/screen/client/appy-app/screens/ready-set-go/index.scss +4 -3
- data/spec/command-reference-files/screen/config/screens.rb +4 -2
- data/spec/command-reference-files/screen/spec/appy-app/screens/ready-set-go/ReadySetGoSpec.coffee +1 -1
- data/spec/fixtures/system_settings.yml +1 -0
- data/spec/lanes/components/grid/GridSpec.coffee +56 -31
- data/spec/lanes/components/grid/RowEditorSpec.coffee +96 -0
- data/spec/lanes/components/select-field/SelectFieldSpec.coffee +99 -0
- data/spec/lanes/components/shared/NetworkActivityOverlaySpec.coffee +34 -0
- data/spec/lanes/models/AssociationMapSpec.coffee +36 -2
- data/spec/lanes/models/AssociationProxySpec.coffee +77 -0
- data/spec/lanes/models/BaseSpec.coffee +37 -4
- data/spec/lanes/models/CollectionSpec.coffee +11 -17
- data/spec/lanes/models/PubSubSpec.coffee +1 -1
- data/spec/lanes/models/ServerCacheSpec.coffee +65 -0
- data/spec/server/api/coffeescript_processor_spec.rb +1 -1
- data/spec/server/concerns/pub_sub_spec.rb +9 -10
- data/spec/server/concerns/sorting_expressions_spec.rb +34 -0
- data/spec/server/configuration_spec.rb +3 -3
- data/spec/server/job_spec.rb +54 -0
- data/spec/server/spec_helper.rb +0 -5
- data/spec/server/system_settings_spec.rb +23 -0
- data/templates/client/screens/Screen.cjsx +6 -4
- data/templates/client/screens/styles.scss +4 -3
- data/templates/config/routes.rb +2 -0
- data/templates/config/screen.rb +4 -2
- data/templates/lib/namespace.rb +4 -0
- data/templates/lib/namespace/extension.rb +2 -0
- data/templates/spec/client/Screen.coffee +1 -1
- data/templates/spec/server/model_spec.rb +1 -1
- data/templates/spec/server/{spec_helpers.rb → spec_helper.rb} +0 -0
- data/views/lanes_root_view.erb +70 -0
- data/views/specs.erb +2 -2
- metadata +207 -68
- data/client/images/lanes/dataTables/Sorting icons.psd +0 -0
- data/client/images/lanes/dataTables/back_disabled.png +0 -0
- data/client/images/lanes/dataTables/back_enabled.png +0 -0
- data/client/images/lanes/dataTables/back_enabled_hover.png +0 -0
- data/client/images/lanes/dataTables/favicon.ico +0 -0
- data/client/images/lanes/dataTables/forward_disabled.png +0 -0
- data/client/images/lanes/dataTables/forward_enabled.png +0 -0
- data/client/images/lanes/dataTables/forward_enabled_hover.png +0 -0
- data/client/images/lanes/dataTables/loading-background.png +0 -0
- data/client/images/lanes/dataTables/sort_asc.png +0 -0
- data/client/images/lanes/dataTables/sort_asc_disabled.png +0 -0
- data/client/images/lanes/dataTables/sort_both.png +0 -0
- data/client/images/lanes/dataTables/sort_desc.png +0 -0
- data/client/images/lanes/dataTables/sort_desc_disabled.png +0 -0
- data/client/lanes/components/shared/Resize.cjsx +0 -152
- data/client/lanes/components/shared/TextArea.cjsx +0 -19
- data/client/lanes/components/shared/TextField.cjsx +0 -25
- data/client/lanes/models/Bootstrap.coffee +0 -5
- data/client/lanes/models/QueryResults.coffee +0 -93
- data/client/lanes/react/FormBindings.coffee +0 -103
- data/client/lanes/react/Router.cjsx +0 -18
- data/client/lanes/styles/dataTables.scss +0 -4
- data/client/lanes/styles/plugins/all.scss +0 -2
- data/client/lanes/styles/plugins/resize-sensor.scss +0 -24
- data/client/lanes/vendor/jquery-2.js +0 -9190
- data/client/lanes/vendor/jquery.tap.js +0 -401
- data/client/lanes/vendor/magicsuggest.js +0 -1565
- data/client/lanes/vendor/message-bus.coffee +0 -264
- data/client/lanes/workspace/ActiveScreenSwitcher.cjsx +0 -38
- data/client/lanes/workspace/styles/toolbar.scss +0 -4
- data/lib/lanes/api/eco.js +0 -516
- data/lib/lanes/api/sprockets_compressor.rb +0 -39
- data/spec/command-reference-files/model/lib/appy-app.rb +0 -11
- 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
|
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
|
-
|
6
|
-
|
7
|
-
|
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
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
-
|
86
|
-
|
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.
|
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>
|
@@ -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
|
+
}
|