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
@@ -23,14 +23,19 @@ class Operator extends Lanes.React.Component
|
|
23
23
|
class Lanes.Components.RecordFinder.Clause extends Lanes.React.Component
|
24
24
|
|
25
25
|
propsTypes:
|
26
|
-
onAddClause: React.PropTypes.func.isRequired
|
27
26
|
model: Lanes.PropTypes.State.isRequired
|
27
|
+
onEnter: React.PropTypes.func.isRequired
|
28
|
+
onAddClause: React.PropTypes.func.isRequired
|
28
29
|
|
29
30
|
setValue: (ev) ->
|
30
31
|
@model.value = ev.target.value
|
31
32
|
|
32
|
-
runQuery: ->
|
33
|
-
|
33
|
+
runQuery: -> @model.query.results.ensureLoaded()
|
34
|
+
|
35
|
+
componentDidMount: -> @refs.query.focus()
|
36
|
+
|
37
|
+
handleKeyDown: (ev) ->
|
38
|
+
@props.onEnter() if ev.key is 'Enter'
|
34
39
|
|
35
40
|
render: ->
|
36
41
|
<BS.Row className="clause">
|
@@ -38,7 +43,7 @@ class Lanes.Components.RecordFinder.Clause extends Lanes.React.Component
|
|
38
43
|
<div className="input-group">
|
39
44
|
|
40
45
|
<div className="input-group-btn">
|
41
|
-
<BS.DropdownButton title={@model.description}>
|
46
|
+
<BS.DropdownButton id={@model.field.title} title={@model.description}>
|
42
47
|
<form>
|
43
48
|
<div className="col-xs-6">
|
44
49
|
<div className="fields">
|
@@ -56,6 +61,8 @@ class Lanes.Components.RecordFinder.Clause extends Lanes.React.Component
|
|
56
61
|
</BS.DropdownButton>
|
57
62
|
</div>
|
58
63
|
<input type="text"
|
64
|
+
ref='query'
|
65
|
+
onKeyDown={@handleKeyDown}
|
59
66
|
value={@model.value}
|
60
67
|
onChange={@setValue}
|
61
68
|
className="form-control query-string"
|
@@ -5,15 +5,12 @@ class Lanes.Components.RecordFinder.Dialog extends Lanes.React.Component
|
|
5
5
|
@props.query.clauses
|
6
6
|
|
7
7
|
propTypes:
|
8
|
+
query: Lanes.PropTypes.State.isRequired
|
8
9
|
onRecordSelect: React.PropTypes.func.isRequired
|
9
10
|
|
10
11
|
contextTypes:
|
11
12
|
viewport: Lanes.PropTypes.State.isRequired
|
12
13
|
|
13
|
-
login: ->
|
14
|
-
@model.save().then =>
|
15
|
-
Lanes.current_user.setLoginData(@model.user, @model.access) if @model.user
|
16
|
-
|
17
14
|
warning: ->
|
18
15
|
<BS.Alert bsStyle='warning'>
|
19
16
|
<strong>{@model.lastServerMessage}</strong>
|
@@ -21,34 +18,36 @@ class Lanes.Components.RecordFinder.Dialog extends Lanes.React.Component
|
|
21
18
|
|
22
19
|
onRecordSelect: (model) ->
|
23
20
|
return unless model
|
24
|
-
@props.query.
|
21
|
+
@props.query.loadModel(model).then @props.onRecordSelect
|
25
22
|
_.delay( =>
|
26
23
|
@onCancel()
|
27
24
|
, 300)
|
28
25
|
|
29
26
|
onCancel: ->
|
30
|
-
@
|
27
|
+
@context.viewport.hideModal()
|
31
28
|
|
32
29
|
addClause: ->
|
33
30
|
@props.query.addNewClause()
|
31
|
+
selectFirst: ->
|
32
|
+
model = @props.query.results.modelAt(0)
|
33
|
+
@onRecordSelect(model) if model
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
animation={false}>
|
40
|
-
<div className='modal-body record-finder-dialog'>
|
41
|
-
<div className="form-horizontal query-clauses">
|
42
|
-
{ for c in @clauses.models
|
43
|
-
<LC.RecordFinder.Clause key={c.cid} onAddClause={@addClause} model=c /> }
|
44
|
-
</div>
|
45
|
-
<LC.Grid query={@props.query} height=200
|
46
|
-
onSelectionChange=@onRecordSelect
|
47
|
-
/>
|
48
|
-
</div>
|
35
|
+
onColumnSort: (field) ->
|
36
|
+
clause = @clauses.last()
|
37
|
+
clause.field = field
|
38
|
+
_.dom(@, '.clause:last-child .query-string').focusAndSelect()
|
49
39
|
|
50
|
-
|
51
|
-
|
40
|
+
render: ->
|
41
|
+
<div className='record-finder-dialog row'>
|
42
|
+
<div className="form-horizontal query-clauses">
|
43
|
+
{ for c in @clauses.models
|
44
|
+
<LC.RecordFinder.Clause
|
45
|
+
key={c.cid} onEnter={@selectFirst}
|
46
|
+
onAddClause={@addClause} model=c /> }
|
52
47
|
</div>
|
53
|
-
|
54
|
-
|
48
|
+
<LC.Grid
|
49
|
+
onColumnClick={@onColumnSort}
|
50
|
+
query={@props.query} height=200 autoLoadQuery
|
51
|
+
onSelectionChange=@onRecordSelect
|
52
|
+
/>
|
53
|
+
</div>
|
@@ -1,23 +1,41 @@
|
|
1
1
|
class Lanes.Components.RecordFinder extends Lanes.React.Component
|
2
2
|
|
3
3
|
propTypes:
|
4
|
-
query:
|
5
|
-
model:
|
6
|
-
|
7
|
-
|
4
|
+
query: Lanes.PropTypes.State.isRequired
|
5
|
+
model: Lanes.PropTypes.State
|
6
|
+
parentModel: Lanes.PropTypes.State
|
7
|
+
commands: React.PropTypes.object
|
8
|
+
onModelSet: React.PropTypes.func
|
8
9
|
|
9
10
|
contextTypes:
|
10
|
-
|
11
|
+
viewport: Lanes.PropTypes.State.isRequired
|
12
|
+
|
13
|
+
modelForAccess: ->
|
14
|
+
if @props.parentModel
|
15
|
+
@props.parentModel[@props.associationName]
|
16
|
+
else
|
17
|
+
@props.model
|
11
18
|
|
12
19
|
showFinder: ->
|
13
|
-
@
|
14
|
-
|
15
|
-
|
16
|
-
|
20
|
+
@props.query.reset()
|
21
|
+
@context.viewport.displayModal(
|
22
|
+
title: "Find #{@props.query.title}"
|
23
|
+
buttons: [{title: 'Cancel'}]
|
24
|
+
autoHide: true
|
25
|
+
body: =>
|
26
|
+
<LC.RecordFinder.Dialog query={@props.query} onRecordSelect={@setModel} />
|
27
|
+
)
|
28
|
+
|
29
|
+
setModel: (model) ->
|
30
|
+
if @props.parentModel
|
31
|
+
@props.parentModel.set(@props.associationName, model)
|
32
|
+
@props.commands?.setModel(model)
|
33
|
+
@props.onModelSet?(model)
|
17
34
|
|
18
35
|
loadCurrentSelection: ->
|
19
|
-
@props.
|
20
|
-
|
36
|
+
value = @props.model[@props.query.initialField.id]
|
37
|
+
@props.query.loadSingle(value).then (model) =>
|
38
|
+
@setModel(model)
|
21
39
|
|
22
40
|
onKeyPress: (ev) ->
|
23
41
|
if "Enter" == ev.key
|
@@ -25,14 +43,27 @@ class Lanes.Components.RecordFinder extends Lanes.React.Component
|
|
25
43
|
this.loadCurrentSelection()
|
26
44
|
null
|
27
45
|
|
46
|
+
getValue: ->
|
47
|
+
if @props.parentModel
|
48
|
+
@props.parentModel[@props.associationName][@props.name]
|
49
|
+
else
|
50
|
+
@props.model[@props.name]
|
51
|
+
|
52
|
+
|
28
53
|
render: ->
|
29
54
|
findIcon = <button className="btn btn-primary icon icon-search icon-lg" onClick={@showFinder}/>
|
30
|
-
|
55
|
+
model = @props.parentModel or @props.model
|
56
|
+
label =
|
57
|
+
<LC.ControlLabel titleOnly {...@props} model={model} />
|
58
|
+
|
59
|
+
<LC.Input
|
31
60
|
ref="input"
|
32
|
-
{...@props}
|
33
61
|
groupClassName="record-finder"
|
34
62
|
editOnly writable
|
35
63
|
name={@props.query.initialField.id}
|
36
64
|
onKeyPress={@onKeyPress}
|
37
|
-
|
65
|
+
{...@props}
|
66
|
+
label={label}
|
67
|
+
model={@modelForAccess()}
|
68
|
+
getValue={@getValue}
|
38
69
|
buttonAfter={findIcon} />
|
@@ -1,3 +1,8 @@
|
|
1
|
+
.record-finder-dialog {
|
2
|
+
@include flexbox();
|
3
|
+
@include flex-direction(column);
|
4
|
+
}
|
5
|
+
|
1
6
|
|
2
7
|
.record-finder-query-string {
|
3
8
|
text-transform: uppercase;
|
@@ -5,11 +10,12 @@
|
|
5
10
|
|
6
11
|
.record-finder {
|
7
12
|
.form-control {
|
8
|
-
|
13
|
+
|
9
14
|
}
|
10
15
|
}
|
11
16
|
|
12
17
|
.query-clauses {
|
18
|
+
|
13
19
|
.row {
|
14
20
|
margin-bottom: 5px;
|
15
21
|
}
|
@@ -31,7 +37,7 @@
|
|
31
37
|
}
|
32
38
|
}
|
33
39
|
&.multiple {
|
34
|
-
|
40
|
+
|
35
41
|
}
|
36
42
|
|
37
43
|
.query-field {
|
@@ -40,7 +46,7 @@
|
|
40
46
|
label {
|
41
47
|
display: block;
|
42
48
|
}
|
43
|
-
|
49
|
+
|
44
50
|
.operators {
|
45
51
|
label {
|
46
52
|
display: block;
|
@@ -61,9 +67,6 @@
|
|
61
67
|
|
62
68
|
|
63
69
|
.modal-dialog.tiny {
|
64
|
-
.skr-grid thead > tr > th {
|
65
|
-
font-size: unset;
|
66
|
-
}
|
67
70
|
.action {
|
68
71
|
text-align: center;
|
69
72
|
.btn.run-query span {
|
@@ -1,78 +1,133 @@
|
|
1
1
|
class Lanes.Components.SelectField extends Lanes.React.Component
|
2
2
|
mixins: [ Lanes.Components.Form.FieldMixin ]
|
3
3
|
|
4
|
-
getDefaultProps: ->
|
5
|
-
labelField: 'name', idField: 'id'
|
6
|
-
|
7
4
|
propTypes:
|
8
|
-
|
9
|
-
|
5
|
+
choices: React.PropTypes.arrayOf(
|
6
|
+
React.PropTypes.shape({
|
7
|
+
id: React.PropTypes.any
|
8
|
+
label: React.PropTypes.string
|
9
|
+
})
|
10
|
+
)
|
11
|
+
model: Lanes.PropTypes.Model
|
12
|
+
labelField: React.PropTypes.string
|
10
13
|
getSelection: React.PropTypes.func
|
11
14
|
setSelection: React.PropTypes.func
|
15
|
+
displayLimit: React.PropTypes.number
|
16
|
+
syncOptions: React.PropTypes.object
|
17
|
+
multiSelect: React.PropTypes.bool
|
18
|
+
fetchWhenOpen: React.PropTypes.bool
|
19
|
+
allowFreeForm: React.PropTypes.bool
|
20
|
+
includeBlankRow: React.PropTypes.bool
|
21
|
+
displayFallback: React.PropTypes.string
|
22
|
+
|
23
|
+
getDefaultProps: ->
|
24
|
+
labelField: 'code', idField: 'id'
|
12
25
|
|
13
26
|
dataObjects:
|
14
|
-
|
15
|
-
@props.
|
16
|
-
@props.model?.
|
17
|
-
|
27
|
+
query: ->
|
28
|
+
src = @props.queryModel or
|
29
|
+
@props.model.associations?.collectionFor(@props.name).model
|
30
|
+
query = new Lanes.Models.Query({
|
31
|
+
syncOptions: Lanes.Models.Query.mergedSyncOptions(@props.syncOptions)
|
32
|
+
src: src
|
33
|
+
fields: [
|
34
|
+
{id: (@props.model?.idAttribute or 'id'), visible: false},
|
35
|
+
@props.labelField
|
36
|
+
]
|
37
|
+
})
|
38
|
+
|
39
|
+
renderDisplayValue: ->
|
40
|
+
value = @getValue()?[@props.labelField]
|
41
|
+
<span>{value}</span>
|
42
|
+
|
43
|
+
getValue: ->
|
44
|
+
return undefined if @state.isOpen and not @props.multiSelect
|
45
|
+
return @state.tempDisplayValue if @state.tempDisplayValue
|
46
|
+
model = @props.getSelection?(@model, @props) or @model?[@props.name]
|
47
|
+
return undefined unless model
|
48
|
+
return model if @props.multiSelect
|
49
|
+
label = model[@props.labelField] or @props.defaultLabel
|
50
|
+
if !label and not _.isEmpty(@props.choices)
|
51
|
+
label = _.findWhere( @props.choices, id: model.id)?[@props.labelField]
|
52
|
+
if label
|
53
|
+
{id: model.id, "#{@props.labelField}": label}
|
54
|
+
else if model.id
|
55
|
+
model.id
|
56
|
+
else
|
57
|
+
undefined
|
18
58
|
|
19
|
-
|
20
|
-
|
59
|
+
getClause: -> @query.clauses.first()
|
60
|
+
getChoices: ->
|
61
|
+
@props.choices or @query.results.map (row) =>
|
62
|
+
{id: row[0], "#{@props.labelField}": row[1]}
|
21
63
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
64
|
+
onToggle: (isOpen) ->
|
65
|
+
if isOpen and _.isEmpty(@props.choices)
|
66
|
+
c = @getClause()
|
67
|
+
c.value = ''
|
68
|
+
@query.results.reload()
|
69
|
+
@setState({isOpen})
|
70
|
+
|
71
|
+
setModel: (model) ->
|
72
|
+
@setState({isOpen: false, tempDisplayValue: false, requestInProgress: false})
|
27
73
|
if @props.setSelection
|
28
|
-
@props.setSelection(
|
74
|
+
@props.setSelection(model, model: @model)
|
29
75
|
else
|
30
|
-
@model.set(@props.name,
|
31
|
-
true
|
76
|
+
@model.set(@props.name, model)
|
32
77
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
78
|
+
onChange: (value) ->
|
79
|
+
if @props.multiSelect
|
80
|
+
@setModel(value)
|
81
|
+
else
|
82
|
+
if _.isObject(value)
|
83
|
+
model = if Lanes.u.isState(value) then value else new @query.model(value)
|
84
|
+
model.fetch(@props.syncOptions).then(@setModel)
|
85
|
+
@setState(isOpen: false, tempDisplayValue: value, requestInProgress: true)
|
86
|
+
else
|
87
|
+
if not @props.choices
|
88
|
+
c = @getClause()
|
89
|
+
return if c.value is value
|
90
|
+
c.value = value
|
91
|
+
@query.results.reload()
|
92
|
+
@setState(isOpen: true)
|
42
93
|
|
43
|
-
|
44
|
-
|
94
|
+
getMessages: ->
|
95
|
+
loading = @query.results.requestInProgress
|
96
|
+
emptyList: if loading then 'Loading …' else 'No records found'
|
97
|
+
emptyFilter: 'No records found'
|
45
98
|
|
46
|
-
|
47
|
-
|
48
|
-
labelField = @props.labelField
|
49
|
-
@collection.map (model) ->
|
50
|
-
{id: model.id, label: _.result(model, labelField)}
|
99
|
+
isBusy: ->
|
100
|
+
!!(@state.requestInProgress or @query.results.requestInProgress)
|
51
101
|
|
52
102
|
renderEdit: (label) ->
|
53
|
-
Component = if @props.multi
|
54
|
-
Lanes.Vendor.ReactWidgets.Multiselect
|
55
|
-
else
|
56
|
-
Lanes.Vendor.ReactWidgets.Combobox
|
57
103
|
props = _.omit(@props, 'label')
|
104
|
+
Component = Lanes.Vendor.ReactWidgets[if @props.multiSelect then 'Multiselect' else 'Combobox']
|
58
105
|
select = <Component
|
59
|
-
|
60
|
-
|
61
|
-
|
106
|
+
ref="select"
|
107
|
+
className={@props.className}
|
108
|
+
open={@state.isOpen}
|
62
109
|
onChange={@onChange}
|
110
|
+
onToggle={@onToggle}
|
111
|
+
data={@getChoices()}
|
112
|
+
busy={@isBusy()}
|
113
|
+
valueField="id"
|
114
|
+
textField={@props.labelField}
|
115
|
+
filter='startsWith'
|
63
116
|
name={@props.name}
|
64
|
-
|
65
|
-
{
|
117
|
+
messages={@getMessages()}
|
118
|
+
onBlur={@onFieldInteraction}
|
119
|
+
value={@getValue()}
|
120
|
+
{...props}
|
121
|
+
/>
|
122
|
+
|
66
123
|
|
67
124
|
if @props.unstyled
|
68
125
|
select
|
69
126
|
else
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
</div>
|
78
|
-
</BS.Col>
|
127
|
+
<LC.FormGroup
|
128
|
+
{...@props}
|
129
|
+
className={@formGroupClassNames()}
|
130
|
+
label={@getLabelValue()}
|
131
|
+
>
|
132
|
+
{select}
|
133
|
+
</LC.FormGroup>
|