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
@@ -1 +1,20 @@
|
|
1
1
|
@import "lanes/vendor/widgets";
|
2
|
+
|
3
|
+
.rw-combobox, .rw-datetimepicker, .rw-numberpicker, .rw-dropdownlist {
|
4
|
+
padding-bottom: 1px; // push down so border isn't covered
|
5
|
+
input { height: 32px; padding: 6px 12px; }
|
6
|
+
}
|
7
|
+
|
8
|
+
.rw-multiselect-taglist > li {
|
9
|
+
margin: 2px;
|
10
|
+
.rw-tag-btn {
|
11
|
+
margin: 0 3px;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
.rw-dropdownlist {
|
16
|
+
height: 35px;
|
17
|
+
.rw-input{
|
18
|
+
line-height: 34px;
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class InvalidTag extends Lanes.React.BaseComponent
|
2
|
+
|
3
|
+
mixins: [
|
4
|
+
Lanes.React.Mixins.ReadEditingState
|
5
|
+
Lanes.React.Mixins.FieldErrors
|
6
|
+
Lanes.React.Mixins.Viewport
|
7
|
+
]
|
8
|
+
|
9
|
+
render: ->
|
10
|
+
return null unless (invalidMsg = @fieldInvalidValueMessage())
|
11
|
+
tooltip =
|
12
|
+
<BS.Tooltip id="error-tooltip">{invalidMsg}</BS.Tooltip>
|
13
|
+
<BS.OverlayTrigger
|
14
|
+
delayShow={300} delayHide={150} container={@context.viewport.lanes}
|
15
|
+
placement="top" overlay={tooltip}
|
16
|
+
>
|
17
|
+
<span ref='target'>
|
18
|
+
<LC.Icon ref='target' type='exclamation-triangle' className='error' />
|
19
|
+
</span>
|
20
|
+
</BS.OverlayTrigger>
|
21
|
+
|
22
|
+
class Lanes.Components.ControlLabel extends Lanes.React.Component
|
23
|
+
|
24
|
+
mixins: [
|
25
|
+
Lanes.React.Mixins.ReadEditingState
|
26
|
+
Lanes.React.Mixins.FieldErrors
|
27
|
+
]
|
28
|
+
|
29
|
+
propTypes:
|
30
|
+
model: Lanes.PropTypes.State
|
31
|
+
invalidMsg: React.PropTypes.string
|
32
|
+
focusInput: (ev) ->
|
33
|
+
_.dom(ev.target).closest('.form-group')
|
34
|
+
.qs('input', raise: false).focusAndSelect()
|
35
|
+
render: ->
|
36
|
+
if @props.titleOnly
|
37
|
+
<span className="label-title-only">
|
38
|
+
{@props.label}
|
39
|
+
<InvalidTag {...@props} />
|
40
|
+
</span>
|
41
|
+
else
|
42
|
+
<label className="control-label" onClick={@focusInput}>
|
43
|
+
<span className="label-title">{@props.label}</span>
|
44
|
+
<InvalidTag {...@props} />
|
45
|
+
</label>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class Lanes.Components.DateTime extends Lanes.React.Component
|
2
|
+
|
3
|
+
mixins: [
|
4
|
+
Lanes.Components.Form.FieldMixin
|
5
|
+
]
|
6
|
+
formGroupClass: 'date-time'
|
7
|
+
|
8
|
+
getDefaultProps: ->
|
9
|
+
format: 'ddd, MMM Do YYYY, h:mm a'
|
10
|
+
|
11
|
+
propTypes:
|
12
|
+
unlabled: React.PropTypes.bool
|
13
|
+
format: React.PropTypes.string
|
14
|
+
|
15
|
+
renderDisplayValue: ->
|
16
|
+
<span>{_.moment(@model[@props.name]).format(@props.format)}</span>
|
17
|
+
|
18
|
+
getValue: ->
|
19
|
+
@refs.input.getValue()
|
20
|
+
|
21
|
+
handleKeyDown: (ev) ->
|
22
|
+
@props.onEnter() if ev.key is 'Enter'
|
23
|
+
|
24
|
+
handleDateTimeChange: (val) ->
|
25
|
+
@handleChange({target: {value: val}})
|
26
|
+
|
27
|
+
renderEdit: (label) ->
|
28
|
+
value = @_getValue() or ''
|
29
|
+
props = _.extend({
|
30
|
+
ref: 'control'
|
31
|
+
className: _.classnames('value', changeset: @state.changeset)
|
32
|
+
label: if @props.unlabeled then false else label
|
33
|
+
value: value
|
34
|
+
onChange: @handleDateTimeChange
|
35
|
+
}, @props)
|
36
|
+
if @props.inputOnly then @renderPlain(props) else @renderStyled(props, label)
|
37
|
+
|
38
|
+
renderPlain: (props) ->
|
39
|
+
<Lanes.Vendor.ReactWidgets.DateTimePicker {...props} />
|
40
|
+
|
41
|
+
renderStyled: (props, label) ->
|
42
|
+
<LC.FormGroup
|
43
|
+
{...props}
|
44
|
+
className={@formGroupClassNames()}
|
45
|
+
label={label}
|
46
|
+
>
|
47
|
+
<Lanes.Vendor.ReactWidgets.DateTimePicker {...props} />
|
48
|
+
</LC.FormGroup>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Lanes.Components.DisplayValue extends Lanes.React.Component
|
2
|
+
|
3
|
+
mixins: [
|
4
|
+
Lanes.Components.Form.FieldMixin
|
5
|
+
]
|
6
|
+
formGroupClass: 'display'
|
7
|
+
|
8
|
+
renderEdit: (label) ->
|
9
|
+
value = @_getValue()
|
10
|
+
<LC.FormGroup
|
11
|
+
{...@props}
|
12
|
+
className={@formGroupClassNames()}
|
13
|
+
label={@getLabelValue()}
|
14
|
+
>
|
15
|
+
{value}
|
16
|
+
</LC.FormGroup>
|
@@ -2,10 +2,11 @@ Lanes.Components.Form || = {}
|
|
2
2
|
|
3
3
|
Lanes.Components.Form.FieldMixin = {
|
4
4
|
bindDataEvents: ->
|
5
|
-
model: "change:#{@props.name} remote-update:#{@props.name}"
|
5
|
+
model: "change:#{@props.name} remote-update:#{@props.name} invalid-fields invalid-field:#{@getInvalidFieldName()}"
|
6
6
|
|
7
7
|
mixins: [
|
8
8
|
Lanes.React.Mixins.Access
|
9
|
+
Lanes.React.Mixins.FieldErrors
|
9
10
|
Lanes.React.Mixins.ReadEditingState
|
10
11
|
]
|
11
12
|
|
@@ -13,48 +14,78 @@ Lanes.Components.Form.FieldMixin = {
|
|
13
14
|
propTypes:
|
14
15
|
model: Lanes.PropTypes.State.isRequired
|
15
16
|
name: React.PropTypes.string.isRequired
|
16
|
-
|
17
|
+
align: React.PropTypes.oneOf([
|
18
|
+
'right', 'left', 'center'
|
19
|
+
])
|
20
|
+
label: React.PropTypes.oneOfType([
|
21
|
+
React.PropTypes.string, React.PropTypes.element
|
22
|
+
])
|
23
|
+
onChange: React.PropTypes.func
|
17
24
|
unstyled: React.PropTypes.bool
|
25
|
+
getValue: React.PropTypes.func
|
26
|
+
setValue: React.PropTypes.func
|
18
27
|
|
19
|
-
|
20
|
-
|
28
|
+
_getValue: ->
|
29
|
+
if @props.getValue
|
30
|
+
@props.getValue.call(@model, @props)
|
31
|
+
else
|
32
|
+
@model[@props.name]
|
21
33
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
@
|
34
|
+
_setValue: (value) ->
|
35
|
+
if @props.setValue then @props.setValue(value) else @model[@props.name] = value
|
36
|
+
|
37
|
+
componentWillUnmount: ->
|
38
|
+
clearTimeout(@state.pendingChangeSetDelay) if @state.pendingChangeSetDelay
|
27
39
|
|
40
|
+
_unsetChangeSet: ->
|
41
|
+
@setState(displayChangeset: false, pendingChangeSetDelay: null)
|
42
|
+
|
43
|
+
setDataState: (state, evname) ->
|
44
|
+
displayChangeset = @model.updatingFromChangeset and @model.changedAttributes()[@props.name]
|
45
|
+
if displayChangeset
|
46
|
+
pendingChangeSetDelay = _.delay(@_unsetChangeSet, 2000)
|
47
|
+
@setState(_.extend( state, {pendingChangeSetDelay, displayChangeset}))
|
28
48
|
|
29
49
|
handleChange: (ev) ->
|
30
|
-
@props.
|
50
|
+
if @props.onChange
|
51
|
+
@props.onChange(ev)
|
52
|
+
else
|
53
|
+
@_setValue(ev.target.value)
|
31
54
|
null
|
32
55
|
|
33
56
|
renderMixinDisplayValue: ->
|
34
|
-
value = @
|
57
|
+
value = @_getValue() || ""
|
35
58
|
value = String(value) if _.isObject(value) or not value
|
36
59
|
<span>{value}</span>
|
37
60
|
|
61
|
+
formGroupClassNames: ->
|
62
|
+
_.classnames( _.result(this, 'formGroupClass'), {
|
63
|
+
changeset: @state.displayChangeset
|
64
|
+
})
|
65
|
+
|
38
66
|
_mixinRenderValue: (label, className) ->
|
39
67
|
value = (@renderDisplayValue || @renderMixinDisplayValue)?()
|
68
|
+
className = _.classnames(@props.className, className, @formGroupClassNames(), {
|
69
|
+
"align-#{@props.align}": @props.align
|
70
|
+
})
|
40
71
|
if @props.unstyled
|
41
72
|
value
|
42
73
|
else
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
</label>
|
52
|
-
</div>
|
53
|
-
</BS.Col>
|
74
|
+
<LC.FormGroup display {...@props}
|
75
|
+
className={className} label={label}
|
76
|
+
>
|
77
|
+
{value}
|
78
|
+
</LC.FormGroup>
|
79
|
+
|
80
|
+
getLabelValue: ->
|
81
|
+
@props.label || _.titleize _.humanize @props.name
|
54
82
|
|
55
83
|
render: ->
|
56
84
|
unless @props.unlabeled
|
57
|
-
label =
|
85
|
+
label =
|
86
|
+
<LC.ControlLabel {...@props} titleOnly
|
87
|
+
label={@getLabelValue()} />
|
88
|
+
|
58
89
|
if @isEditingRecord()
|
59
90
|
if @hasWriteAccess()
|
60
91
|
@renderEdit(label)
|
@@ -1,58 +1,35 @@
|
|
1
1
|
class Lanes.Components.FieldSet extends Lanes.React.Component
|
2
2
|
|
3
3
|
getDefaultProps: ->
|
4
|
-
|
4
|
+
expanded: true
|
5
5
|
|
6
6
|
propTypes:
|
7
7
|
title: React.PropTypes.string.isRequired
|
8
|
-
|
9
|
-
collapsed: React.PropTypes.bool
|
8
|
+
expanded: React.PropTypes.bool
|
10
9
|
|
11
10
|
getInitialState: ->
|
12
|
-
|
13
|
-
expanded: !@props.collapsed,
|
14
|
-
icon: if @props.collapsed then 'plus' else 'minus'
|
15
|
-
}
|
16
|
-
state.height = 30 if @props.collapsed
|
17
|
-
state
|
18
|
-
|
19
|
-
getClientHeight: ->
|
20
|
-
_.max(
|
21
|
-
_.pluck(@refs.body.getDOMNode().children, 'clientHeight')
|
22
|
-
) + 45
|
11
|
+
expanded: @props.expanded
|
23
12
|
|
13
|
+
componentWillReceiveProps: (nextProps) ->
|
14
|
+
@setState(expanded: nextProps.expanded) if nextProps.expanded?
|
24
15
|
|
25
16
|
toggleExpanded: ->
|
26
|
-
|
27
|
-
if ! @state.hasExpanded
|
28
|
-
@setState( hasExpanded: true, height: @getClientHeight() )
|
29
|
-
_.defer @toggleExpanded
|
30
|
-
return
|
31
|
-
@setState expanded: false, height: 30
|
32
|
-
else
|
33
|
-
@setState expanded: true, height: @getClientHeight()
|
34
|
-
|
35
|
-
_.delay( =>
|
36
|
-
if @isMounted()
|
37
|
-
@setState(icon: if @state.expanded then 'minus' else 'plus')
|
38
|
-
, @props.speed * 1000)
|
17
|
+
@setState(expanded: not @state.expanded)
|
39
18
|
|
40
19
|
render: ->
|
41
20
|
colProps = _.omit(@props, 'name')
|
42
21
|
<BS.Col {...colProps}>
|
43
22
|
<fieldset className={
|
44
23
|
_.classnames("collapsible", @props.className, @state.icon
|
45
|
-
|
46
|
-
}
|
47
|
-
style={
|
48
|
-
maxHeight: @state.height
|
49
|
-
transition: "max-height #{@props.speed}s ease-in-out";
|
24
|
+
{expanded: @state.expanded, collapsed: !@state.expanded})
|
50
25
|
}>
|
51
26
|
<legend onClick={@toggleExpanded}>
|
52
27
|
{@props.title}
|
53
28
|
</legend>
|
54
|
-
<
|
55
|
-
|
56
|
-
|
29
|
+
<BS.Collapse in={@state.expanded}>
|
30
|
+
<div ref="body" className="fieldset-fields">
|
31
|
+
{@props.children}
|
32
|
+
</div>
|
33
|
+
</BS.Collapse>
|
57
34
|
</fieldset>
|
58
35
|
</BS.Col>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Lanes.Components.FieldWrapper extends Lanes.React.BaseComponent
|
2
|
+
|
3
|
+
mixins: [
|
4
|
+
Lanes.React.Mixins.ReadEditingState
|
5
|
+
]
|
6
|
+
|
7
|
+
render: ->
|
8
|
+
props = _.omit(@props, 'value')
|
9
|
+
isEdit = @isEditingRecord()
|
10
|
+
className = _.classnames(props.className, display: !isEdit)
|
11
|
+
<LC.FormGroup {...props} className={className}>
|
12
|
+
{if isEdit then @props.children else @props.value}
|
13
|
+
</LC.FormGroup>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class Lanes.Components.FormGroup extends Lanes.React.Component
|
2
|
+
|
3
|
+
mixins: [
|
4
|
+
Lanes.React.Mixins.ReadEditingState
|
5
|
+
Lanes.React.Mixins.FieldErrors
|
6
|
+
]
|
7
|
+
|
8
|
+
propTypes:
|
9
|
+
align: React.PropTypes.oneOf([
|
10
|
+
'right', 'left', 'center'
|
11
|
+
])
|
12
|
+
|
13
|
+
bindDataEvents: ->
|
14
|
+
model: "invalid-fields invalid-field:#{@getInvalidFieldName()}"
|
15
|
+
|
16
|
+
render: ->
|
17
|
+
className = _.classnames(className, @props.className, "field"
|
18
|
+
editing: @props.editing
|
19
|
+
"align-#{@props.align}": @props.align
|
20
|
+
display: false == @props.editing
|
21
|
+
'has-error': @isFieldValueInvalid()
|
22
|
+
)
|
23
|
+
|
24
|
+
colProps = _.omit(@props, 'name', 'label', 'type', 'editing', 'display')
|
25
|
+
valueClassNames = _.classnames('value', {
|
26
|
+
"align-#{@props.align}": @props.align
|
27
|
+
})
|
28
|
+
<BS.Col {...colProps} className={className}>
|
29
|
+
<div className="form-group">
|
30
|
+
<LC.ControlLabel {...@props} />
|
31
|
+
<div className="input-group" name={@props.name}>
|
32
|
+
<div className={valueClassNames}>
|
33
|
+
{@props.children}
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
</BS.Col>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Lanes.Components.Icon extends Lanes.React.Component
|
2
|
+
|
3
|
+
propTypes:
|
4
|
+
type: React.PropTypes.string.isRequired
|
5
|
+
animated: React.PropTypes.bool
|
6
|
+
|
7
|
+
render: ->
|
8
|
+
|
9
|
+
classes = _.classnames 'icon', "icon-#{@props.type}", @props.className,
|
10
|
+
'cursor-pointer' : @props.onClick,
|
11
|
+
"icon-#{@props.size}" : @props.size,
|
12
|
+
'icon-pulse' : @props.animated
|
13
|
+
'flush' : @props.flush
|
14
|
+
'icon-lg' : @props['lg']
|
15
|
+
'icon-2x' : @props['2x']
|
16
|
+
'icon-3x' : @props['3x']
|
17
|
+
'icon-4x' : @props['4x']
|
18
|
+
'icon-5x' : @props['5x']
|
19
|
+
|
20
|
+
<i style={@props.style} className={classes} />
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class Lanes.Components.ImageSaver extends Lanes.React.Component
|
2
|
+
|
3
|
+
propTypes:
|
4
|
+
model: Lanes.PropTypes.Model
|
5
|
+
name: React.PropTypes.string.isRequired
|
6
|
+
|
7
|
+
listenNetworkEvents: true
|
8
|
+
bindDataEvents: ->
|
9
|
+
model: "change:#{@props.name} change:#{@props.name}_data"
|
10
|
+
|
11
|
+
uploadImage: ->
|
12
|
+
imageFormData = new FormData()
|
13
|
+
imageFormData.append('imageFile', imageFile)
|
14
|
+
|
15
|
+
handleImageChange: (ev) ->
|
16
|
+
ev.preventDefault()
|
17
|
+
@model.set("#{@props.name}_file", ev.target.files[0])
|
18
|
+
|
19
|
+
renderImage: ->
|
20
|
+
<img className="preview" src={@model.imageUrlFor('logo', 'thumb')} />
|
21
|
+
|
22
|
+
render: ->
|
23
|
+
value = if @model.hasImage(@props.name) then @renderImage() else null
|
24
|
+
className = _.classnames(@props.className, 'image-saver', {'with-image': @model.hasImage(@props.name)})
|
25
|
+
<LC.FieldWrapper {...@props} className={className} value={value}>
|
26
|
+
{value}
|
27
|
+
<form>
|
28
|
+
<label className="selector">
|
29
|
+
{if value then 'Update' else 'Choose'}
|
30
|
+
<input id='file' className="file" type="file" onChange={@handleImageChange} />
|
31
|
+
</label>
|
32
|
+
</form>
|
33
|
+
</LC.FieldWrapper>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Lanes.Components.Input extends Lanes.React.Component
|
2
|
+
|
3
|
+
mixins: [
|
4
|
+
Lanes.Components.Form.InputFieldMixin
|
5
|
+
]
|
6
|
+
|
7
|
+
renderInputField: (props, handlers, label) ->
|
8
|
+
if @props.inputOnly then @renderPlain(props, handlers) else @renderStyled(props, handlers, label)
|
9
|
+
|
10
|
+
renderPlain: (props, handlers) ->
|
11
|
+
<input {...props} {...handlers} />
|
12
|
+
|
13
|
+
renderStyled: (props, handlers, label) ->
|
14
|
+
colProps = _.omit(@props, 'name', 'label', 'type', 'editing', 'display')
|
15
|
+
|
16
|
+
colClassName = _.classnames("align-#{@props.align}": @props.align, @formGroupClassNames(), 'field')
|
17
|
+
<BS.Col {...colProps} className={colClassName}>
|
18
|
+
<BS.Input {...props} {...handlers} />
|
19
|
+
</BS.Col>
|