lanes 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -0
- data/Gemfile +2 -2
- data/client/lanes/components/Base.coffee +12 -11
- data/client/lanes/components/enabled.js.erb +1 -1
- data/client/lanes/components/grid/Editor.coffee +2 -2
- data/client/lanes/components/grid/Grid.coffee +60 -58
- data/client/lanes/components/grid/PopOverEditor.coffee +3 -3
- data/client/lanes/components/grid/RowEditor.coffee +1 -1
- data/client/lanes/components/grid/{grid.scss → _index.scss} +0 -0
- data/client/lanes/components/grid/template.html +1 -1
- data/client/lanes/components/modal/ModalDialog.coffee +1 -1
- data/client/lanes/components/modal/{modal.scss → _index.scss} +1 -1
- data/client/lanes/components/modal/index.js +1 -1
- data/client/lanes/components/popover/PopOver.coffee +1 -1
- data/client/lanes/components/popover/_index.scss +1 -0
- data/client/lanes/components/popover/index.js +1 -1
- data/client/lanes/components/select_field/{select_field.scss → _index.scss} +0 -0
- data/client/lanes/extension/Extensions.coffee +3 -2
- data/client/lanes/lib/Templates.coffee +7 -0
- data/client/lanes/minimal.js +1 -1
- data/client/lanes/minimal.scss.erb +1 -1
- data/client/lanes/models/Base.coffee +16 -19
- data/client/lanes/models/Bootstrap.coffee +1 -2
- data/client/lanes/models/Collection.coffee +37 -25
- data/client/lanes/models/Screens.coffee +6 -18
- data/client/lanes/models/Sync.coffee +12 -5
- data/client/lanes/screens/Base.coffee +1 -2
- data/client/lanes/screens/Instance.coffee +2 -5
- data/client/lanes/screens/screen-definitions.js.erb +10 -2
- data/client/{styles → lanes/styles}/components/all.scss +0 -0
- data/client/{styles → lanes/styles}/components/changes-notification.scss +0 -0
- data/client/{styles → lanes/styles}/components/record-finder.scss +0 -0
- data/client/{styles → lanes/styles}/components/suggest.scss +0 -0
- data/client/{styles → lanes/styles}/fonts/icomoon.eot +0 -0
- data/client/{styles → lanes/styles}/fonts/icomoon.svg +0 -0
- data/client/{styles → lanes/styles}/fonts/icomoon.ttf +0 -0
- data/client/{styles → lanes/styles}/fonts/icomoon.woff +0 -0
- data/client/{styles → lanes/styles}/fonts/selection.json +0 -0
- data/client/{styles → lanes/styles}/fonts/style.scss +0 -0
- data/client/{styles → lanes/styles}/fonts.scss +5 -5
- data/client/{styles → lanes/styles}/forms.scss +0 -0
- data/client/{styles → lanes/styles}/index.css +0 -0
- data/client/{styles → lanes/styles}/keybindings.scss +0 -0
- data/client/{styles → lanes/styles}/layout.scss +0 -0
- data/client/{styles → lanes/styles}/plugins/all.scss +0 -0
- data/client/{styles → lanes/styles}/plugins/overlay.scss +0 -0
- data/client/{styles → lanes/styles}/plugins/resize-sensor.scss +0 -0
- data/client/{styles → lanes/styles}/screens.scss +0 -0
- data/client/{styles → lanes/styles}/tabs.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_alerts.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_badges.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_breadcrumbs.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_button-groups.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_buttons.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_carousel.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_close.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_code.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_component-animations.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_dropdowns.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_forms.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_glyphicons.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_grid.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_input-groups.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_jumbotron.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_labels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_list-group.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_media.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_mixins.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_modals.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_navbar.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_navs.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_normalize.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_pager.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_pagination.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_panels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_popovers.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_print.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_progress-bars.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_responsive-embed.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_responsive-utilities.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_scaffolding.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_tables.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_theme.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_thumbnails.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_tooltip.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_type.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_utilities.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_variables.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/_wells.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_alerts.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_background-variant.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_border-radius.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_buttons.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_center-block.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_clearfix.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_forms.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_gradients.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_grid-framework.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_grid.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_hide-text.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_image.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_labels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_list-group.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_nav-divider.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_nav-vertical-align.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_opacity.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_pagination.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_panels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_progress-bar.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_reset-filter.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_resize.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_responsive-visibility.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_size.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_tab-focus.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_table-row.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_text-emphasis.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_text-overflow.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_vendor-prefixes.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_alerts.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_badges.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_breadcrumbs.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_button-groups.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_buttons.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_carousel.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_close.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_code.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_component-animations.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_dropdowns.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_forms.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_glyphicons.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_grid.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_input-groups.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_jumbotron.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_labels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_list-group.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_media.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_mixins.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_modals.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_navbar.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_navs.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_normalize.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_pager.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_pagination.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_panels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_popovers.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_print.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_progress-bars.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_responsive-embed.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_responsive-utilities.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_scaffolding.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_tables.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_theme.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_thumbnails.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_tooltip.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_type.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_utilities.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_variables.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/_wells.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/bootstrap.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_alerts.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_background-variant.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_border-radius.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_buttons.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_center-block.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_clearfix.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_forms.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_gradients.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_grid-framework.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_grid.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_hide-text.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_image.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_labels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_list-group.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_nav-divider.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_nav-vertical-align.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_opacity.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_pagination.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_panels.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_progress-bar.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_reset-filter.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_resize.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_responsive-visibility.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_size.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_tab-focus.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_table-row.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_text-emphasis.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_text-overflow.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_vendor-prefixes.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap-custom-grid.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap-custom-modals.scss +0 -0
- data/client/{styles → lanes/styles}/vendor/bootstrap.scss +2 -2
- data/client/{styles → lanes/styles}/vendor/dataTables.scss +0 -0
- data/client/lanes/views/Base.coffee +34 -49
- data/client/lanes/views/FormBindings.coffee +22 -20
- data/client/lanes/views/Helpers.coffee +1 -1
- data/client/lanes/views/empty-span.html +1 -0
- data/client/lanes/workspace/ActiveScreensSwitcher.coffee +8 -1
- data/client/lanes/workspace/Layout.coffee +7 -4
- data/client/lanes/workspace/Navbar.coffee +6 -2
- data/client/lanes/workspace/Pages.coffee +5 -1
- data/client/lanes/workspace/ScreensMenu.coffee +14 -2
- data/client/lanes/workspace/WorkspaceView.coffee +5 -0
- data/client/lanes/workspace/index.js +1 -0
- data/client/lanes/workspace.scss.erb +6 -1
- data/lanes.gemspec +1 -1
- data/lib/lanes/api/controller.rb +5 -7
- data/lib/lanes/api/helper_methods.rb +1 -1
- data/lib/lanes/api/javascript_processor.rb +3 -2
- data/lib/lanes/command/app.rb +8 -4
- data/lib/lanes/command/generate_model.rb +13 -11
- data/lib/lanes/command/generate_screen.rb +9 -2
- data/lib/lanes/command/generate_view.rb +15 -3
- data/lib/lanes/command/generate_view.usage +7 -7
- data/lib/lanes/command/named_command.rb +2 -2
- data/lib/lanes/command/templates/client/index.js +3 -0
- data/lib/lanes/command/templates/client/models/BaseModel.coffee +5 -0
- data/lib/lanes/command/templates/client/models/Model.coffee +1 -1
- data/lib/lanes/command/templates/client/views/BaseView.coffee +5 -0
- data/lib/lanes/command/templates/client/views/View.coffee +1 -1
- data/lib/lanes/command/templates/config/screen.rb +8 -0
- data/lib/lanes/command/templates/lib/namespace/base_model.rb +9 -0
- data/lib/lanes/command/templates/lib/namespace/model.rb +1 -1
- data/lib/lanes/command/templates/spec/client/models/ModelSpec.coffee +1 -1
- data/lib/lanes/command/templates/spec/client/views/ViewSpec.coffee +1 -1
- data/lib/lanes/command.rb +1 -2
- data/lib/lanes/components.rb +5 -4
- data/lib/lanes/concerns/all.rb +0 -5
- data/lib/lanes/concerns/attr_accessor_with_default.rb +5 -3
- data/lib/lanes/concerns/set_attribute_data.rb +6 -23
- data/lib/lanes/configuration.rb +1 -0
- data/lib/lanes/extension.rb +19 -10
- data/lib/lanes/guard_tasks.rb +1 -1
- data/lib/lanes/model.rb +1 -6
- data/lib/lanes/{screens.rb → screen.rb} +40 -23
- data/lib/lanes/spec_helper.rb +4 -2
- data/lib/lanes/version.rb +1 -1
- data/lib/lanes.rb +1 -1
- data/spec/api/javascript_processor_spec.rb +3 -3
- data/spec/command_spec.rb +49 -0
- data/spec/concerns/attr_accessor_with_default_spec.rb +7 -0
- data/spec/helpers/lanes-helpers.coffee +46 -22
- data/spec/helpers/minitest_assertions.rb +23 -0
- data/spec/lanes/models/BaseSpec.coffee +57 -56
- data/spec/lanes/models/CollectionSpec.coffee +14 -0
- data/spec/lanes/models/PubSubSpec.coffee +5 -5
- data/spec/lanes/views/BaseSpec.coffee +32 -31
- data/spec/lanes/views/FormBindingsSpec.coffee +32 -0
- metadata +183 -179
- data/client/lanes/components/popover/popover.scss +0 -1
- data/lib/lanes/command/templates/lib/namespace/screen.rb +0 -17
- data/lib/lanes/concerns/code_identifier.rb +0 -43
- data/lib/lanes/concerns/immutable_model.rb +0 -32
- data/lib/lanes/concerns/locked_fields.rb +0 -84
- data/lib/lanes/concerns/random_hash_code.rb +0 -40
- data/lib/lanes/concerns/visible_id_identifier.rb +0 -53
- data/spec/concerns/code_identifier_spec.rb +0 -45
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -57,8 +57,8 @@ $popover-max-width: 320px;
|
|
57
57
|
@import "bootstrap/close";
|
58
58
|
|
59
59
|
// Components w/ JavaScript
|
60
|
-
|
61
|
-
|
60
|
+
/* @import "bootstrap/modals"; */
|
61
|
+
@import "bootstrap-custom-modals";
|
62
62
|
|
63
63
|
@import "bootstrap/tooltip";
|
64
64
|
|
File without changes
|
@@ -25,7 +25,7 @@ class ViewBase
|
|
25
25
|
pubSub : "boolean"
|
26
26
|
parent : "object"
|
27
27
|
subviewId : { type: "string", setOnce: true }
|
28
|
-
|
28
|
+
formBindings: { type: 'any', default: false }
|
29
29
|
|
30
30
|
derived:
|
31
31
|
'$el':
|
@@ -81,8 +81,8 @@ class ViewBase
|
|
81
81
|
if !this.pubSub? # if it's unset, not true/false; default to parent or true
|
82
82
|
this.pubSub = if this.parent?.pubSub? then this.parent.pubSub else true
|
83
83
|
|
84
|
-
|
85
|
-
|
84
|
+
if @formBindings || @parent?.formBindings
|
85
|
+
@formBindings = new Lanes.Views.FormBindings(this, @formBindings)
|
86
86
|
|
87
87
|
if @keyBindings
|
88
88
|
Lanes.Views.Keys.add(this, @keyBindings, @keyScope)
|
@@ -114,21 +114,15 @@ class ViewBase
|
|
114
114
|
# **render** is the core function that your view can override, its job is
|
115
115
|
# to populate its element (`this.el`), with the appropriate HTML.
|
116
116
|
render: ->
|
117
|
-
this.withRenderContext( this.renderWithTemplate )
|
118
|
-
return this;
|
119
|
-
|
120
|
-
withRenderContext: (fn, args...)->
|
121
117
|
Lanes.Views.RenderContext.push( @subviewId, @model )
|
122
|
-
|
118
|
+
this.renderContextFree()
|
123
119
|
Lanes.Views.RenderContext.pop()
|
124
|
-
this
|
125
|
-
returned
|
120
|
+
this
|
126
121
|
|
127
122
|
renderContextFree: ->
|
128
|
-
this.
|
123
|
+
this.replaceEl( this.renderTemplateMethod() );
|
129
124
|
this
|
130
125
|
|
131
|
-
|
132
126
|
# ## listenToAndRun
|
133
127
|
# Shortcut for registering a listener for a model
|
134
128
|
# and also triggering it right away.
|
@@ -137,50 +131,42 @@ class ViewBase
|
|
137
131
|
this.listenTo(object, events, bound)
|
138
132
|
bound();
|
139
133
|
|
140
|
-
# Replaces the current root element with
|
141
|
-
|
142
|
-
|
143
|
-
# or pass in a template directly.
|
144
|
-
# The template can either be a string or a function.
|
145
|
-
# If it's a function it will be passed the `context`
|
146
|
-
# argument.
|
147
|
-
renderWithTemplate: (templateArg)->
|
148
|
-
template = templateArg || this.resultsFor('template')
|
149
|
-
throw new Error('Template string or function needed.') unless template
|
150
|
-
template_fn = Lanes.Templates.find(template, this.FILE.extension)
|
151
|
-
newDom = if template_fn then template_fn( _.result(this,'templateModels')) else template
|
152
|
-
newDom = Lanes.Vendor.domify(newDom) if _.isString(newDom);
|
134
|
+
# Replaces the current root element with the contents of template
|
135
|
+
replaceEl: (template)->
|
136
|
+
newDom = Lanes.Vendor.domify(template)
|
153
137
|
parent = this.el && this.el.parentNode;
|
154
138
|
parent.replaceChild(newDom, this.el) if parent
|
155
139
|
if newDom.nodeName == '#document-fragment'
|
156
|
-
throw new Error(
|
140
|
+
throw new Error("View #{this.FILE.path} can only have one root element.")
|
157
141
|
if newDom.nodeName == '#text'
|
158
|
-
throw new Error(
|
142
|
+
throw new Error("View #{this.FILE.path} must have a root element.")
|
159
143
|
this.el = newDom;
|
144
|
+
this.onRender?()
|
160
145
|
return this;
|
161
146
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
147
|
+
# Renders the results of calling method "name"
|
148
|
+
# to a string and returns it.
|
149
|
+
#
|
150
|
+
# The template can either be a string property or a function that returns a string.
|
151
|
+
renderTemplateMethod:(name="template",data)->
|
152
|
+
template = if this[name]
|
153
|
+
_.result(this, name)
|
154
|
+
else
|
155
|
+
data ||= _.result(this,"#{name}Data")
|
156
|
+
path = _.result(this,'templatePrefix') + _.result(this, "#{name}Name")
|
157
|
+
Lanes.Templates.render(this, path, data)
|
158
|
+
throw new Error("#{this.FILE.path} failed to render #{name}") unless template
|
159
|
+
template
|
166
160
|
|
167
|
-
|
161
|
+
templateName: -> _.underscore( this.FILE.path )
|
168
162
|
|
169
|
-
|
170
|
-
{ model: this.model, collection: this.collection }
|
163
|
+
templatePrefix: -> this.FILE.extensionName.toLowerCase() + "/views/"
|
171
164
|
|
172
|
-
|
173
|
-
|
174
|
-
if template
|
175
|
-
template(data)
|
176
|
-
else
|
177
|
-
Lanes.fatal( "Template #{name} doesn't exist!" )
|
178
|
-
''
|
165
|
+
templateData: ->
|
166
|
+
{ model: @model?.toJSON?(), collection: @collection?.toJSON?() }
|
179
167
|
|
180
|
-
renderTemplateMethod: (method)->
|
181
|
-
return null unless name = _.result(this, method)
|
182
|
-
this.renderTemplate(name, _.result(this, "#{method}Models") || @model)
|
183
168
|
|
169
|
+
FILE: FILE
|
184
170
|
|
185
171
|
# Remove this view by taking the element out of the DOM, and removing any
|
186
172
|
# applicable events listeners.
|
@@ -327,7 +313,6 @@ class ViewBase
|
|
327
313
|
new klass(_.extend(options,{ el: el, parent: self }))
|
328
314
|
|
329
315
|
}
|
330
|
-
|
331
316
|
action = ->
|
332
317
|
return if (!this.el || !(el = this.query(opts.selector)))
|
333
318
|
if (!opts.waitFor || _.getPath(this, opts.waitFor))
|
@@ -391,10 +376,10 @@ class ViewBase
|
|
391
376
|
|
392
377
|
initializeKeyBindings: Lanes.emptyFn
|
393
378
|
|
394
|
-
initializeFormBindings: ->
|
395
|
-
|
396
|
-
|
397
|
-
|
379
|
+
# initializeFormBindings: ->
|
380
|
+
# @_form_bindings = {}
|
381
|
+
# for data, selector of @form_bindings
|
382
|
+
# @_form_bindings[data] =
|
398
383
|
|
399
384
|
setFieldsFromBindings: ->
|
400
385
|
binding.setAllFields() for name, binding of @_form_bindings
|
@@ -1,22 +1,21 @@
|
|
1
1
|
class Lanes.Views.FormBindings
|
2
2
|
|
3
|
-
constructor: (@view,
|
3
|
+
constructor: (@view, config={})->
|
4
4
|
_.bindAll(this,'onFieldChange')
|
5
|
-
@selector = "#{
|
6
|
-
@view.on( "change:el",
|
7
|
-
@view.on( "change
|
8
|
-
@view.on( "remove",
|
9
|
-
this.rebindModel( @view, @model
|
5
|
+
@selector = if config.selector then "#{config.selector} " else ""
|
6
|
+
@view.on( "change:el", this.rebindForm, this )
|
7
|
+
@view.on( "change:model", this.rebindModel, this )
|
8
|
+
@view.on( "remove", this.teardown, this )
|
9
|
+
this.rebindModel( @view, @view.model )
|
10
10
|
|
11
11
|
onFieldChange: (ev)->
|
12
12
|
el = Lanes.$(ev.target);
|
13
13
|
name = el.attr('name');
|
14
|
-
m =
|
14
|
+
m = @view.model;
|
15
15
|
return unless m.hasAttribute(name)
|
16
16
|
val = el.val()
|
17
|
-
|
18
17
|
el[0]._is_setting=true; m.set( name, val ); delete el[0]._is_setting
|
19
|
-
msg = m.
|
18
|
+
msg = m.checkValid(name,val)
|
20
19
|
this.setError( el, msg )
|
21
20
|
|
22
21
|
onAttributeUpdate: (model, opts={})->
|
@@ -24,7 +23,7 @@ class Lanes.Views.FormBindings
|
|
24
23
|
if attributes['errors'] && ! _.isEmpty(attributes['errors'])
|
25
24
|
for name, message of attributes['errors']
|
26
25
|
this.setError(Lanes.$(el),message) if el = this.getElement(name)
|
27
|
-
for name,
|
26
|
+
for name, _val of attributes
|
28
27
|
el = this.getElement(name)
|
29
28
|
this.setElValue(Lanes.$(el),model.get(name)) if el && ! el._is_setting
|
30
29
|
|
@@ -32,7 +31,8 @@ class Lanes.Views.FormBindings
|
|
32
31
|
if el.attr('type')
|
33
32
|
switch el.attr('type')
|
34
33
|
when 'radio'
|
35
|
-
|
34
|
+
selector="#{@selector}input[type=radio][name=#{el.attr('name')}]"
|
35
|
+
for input in Lanes.$(this.view.el).find(selector)
|
36
36
|
input.checked = input.value == value
|
37
37
|
when 'checkbox'
|
38
38
|
el.prop('checked', !!value)
|
@@ -67,27 +67,29 @@ class Lanes.Views.FormBindings
|
|
67
67
|
attrs
|
68
68
|
|
69
69
|
fields: ->
|
70
|
-
@cached_fields ||=
|
70
|
+
@cached_fields ||= @view.el?.querySelectorAll("#{@selector}input, #{@selector}.ro-input.update")
|
71
71
|
|
72
72
|
getElement: (name)->
|
73
|
-
|
73
|
+
return unless fields = this.fields()
|
74
|
+
for field in fields
|
75
|
+
return field if field.getAttribute('name') == name
|
76
|
+
null
|
74
77
|
|
75
78
|
setAllFields: ->
|
76
|
-
this.onAttributeUpdate(
|
77
|
-
|
78
|
-
model: ->
|
79
|
-
@cached_model ||= Lanes.getPath(@keypath, @view)
|
79
|
+
this.onAttributeUpdate(@view.model, all: true)
|
80
80
|
|
81
81
|
rebindForm: (view, el)->
|
82
82
|
input_selector = "#{@selector}input, #{@selector}select"
|
83
83
|
if old_el = @view.changedAttributes()['el']
|
84
84
|
Lanes.$(el).off("change", input_selector, this.onFieldChange )
|
85
85
|
@cached_fields = null
|
86
|
-
|
86
|
+
if @view.model
|
87
|
+
this.setAllFields()
|
88
|
+
@view.$el.on("change", input_selector, this.onFieldChange )
|
87
89
|
|
88
90
|
rebindModel: (view, model)->
|
89
91
|
this.clearErrors()
|
90
|
-
if old_model = @view.changedAttributes()[
|
92
|
+
if old_model = @view.changedAttributes()['model']
|
91
93
|
old_model.off( "change", this.onAttributeUpdate )
|
92
94
|
if model
|
93
95
|
this.onAttributeUpdate(model, { all: true } )
|
@@ -95,4 +97,4 @@ class Lanes.Views.FormBindings
|
|
95
97
|
model.on('change', this.onAttributeUpdate, this )
|
96
98
|
|
97
99
|
teardown: ->
|
98
|
-
|
100
|
+
@view.model?.off( "change", this.onAttributeUpdate )
|
@@ -15,7 +15,7 @@ impl = {
|
|
15
15
|
this.markSafe(contents)
|
16
16
|
|
17
17
|
template: (template,data)->
|
18
|
-
this.markSafe( Lanes.Templates.find('views/_'+template)(data) )
|
18
|
+
this.markSafe( Lanes.Templates.find('lanes/views/_'+template)(data) )
|
19
19
|
|
20
20
|
markSafe: (str)->
|
21
21
|
result = new String(str)
|
@@ -0,0 +1 @@
|
|
1
|
+
<span></span>
|
@@ -1,6 +1,10 @@
|
|
1
1
|
class TabView extends Lanes.Views.Base
|
2
2
|
|
3
3
|
template: "<li><a data-toggle='tab'></a><span class='close'>×</span></li>"
|
4
|
+
FILE: FILE
|
5
|
+
mixins:[
|
6
|
+
Lanes.Workspace.WorkspaceView
|
7
|
+
]
|
4
8
|
|
5
9
|
bindings:
|
6
10
|
'model.screen.title': { selector: 'a', type: 'text' }
|
@@ -22,7 +26,10 @@ TAB_PADDING = 0
|
|
22
26
|
|
23
27
|
class Lanes.Workspace.ActiveScreenSwitcher extends Lanes.Views.Base
|
24
28
|
|
25
|
-
|
29
|
+
templateName: 'screens-switcher'
|
30
|
+
mixins:[
|
31
|
+
Lanes.Workspace.WorkspaceView
|
32
|
+
]
|
26
33
|
|
27
34
|
key_scope: { name: 'nav', shortcut: '⌘+shift+t,ctrl+shift+t' }
|
28
35
|
key_bindings:
|
@@ -1,16 +1,19 @@
|
|
1
|
-
|
2
1
|
class Lanes.Workspace.Layout extends Lanes.Views.Base
|
3
2
|
|
4
|
-
|
3
|
+
templateName: 'layout'
|
4
|
+
mixins:[
|
5
|
+
Lanes.Workspace.WorkspaceView
|
6
|
+
]
|
7
|
+
FILE: FILE
|
5
8
|
|
6
9
|
subviews:
|
7
10
|
navbar:
|
8
11
|
hook: 'navbar-container'
|
9
|
-
view: '
|
12
|
+
view: 'Workspace.Navbar'
|
10
13
|
|
11
14
|
pages:
|
12
15
|
hook: 'page-container'
|
13
|
-
view: '
|
16
|
+
view: 'Workspace.Pages'
|
14
17
|
|
15
18
|
subviewOptions: -> { model: this.model }
|
16
19
|
|
@@ -1,6 +1,10 @@
|
|
1
1
|
class Lanes.Workspace.Navbar extends Lanes.Views.Base
|
2
2
|
|
3
|
-
|
3
|
+
templateName: 'navbar'
|
4
|
+
FILE: FILE
|
5
|
+
mixins:[
|
6
|
+
Lanes.Workspace.WorkspaceView
|
7
|
+
]
|
4
8
|
|
5
9
|
events:
|
6
10
|
'click .screens-menu-toggle': 'switchMenu'
|
@@ -9,7 +13,7 @@ class Lanes.Workspace.Navbar extends Lanes.Views.Base
|
|
9
13
|
subviews:
|
10
14
|
screens:
|
11
15
|
hook: 'screens-container'
|
12
|
-
view: '
|
16
|
+
view: 'Workspace.ActiveScreenSwitcher'
|
13
17
|
model: 'model'
|
14
18
|
|
15
19
|
bindings:
|
@@ -1,6 +1,10 @@
|
|
1
1
|
class ScreenList extends Lanes.Views.Base
|
2
2
|
|
3
3
|
template: "<li><a href='#'><span></span><i></i></a></li>"
|
4
|
+
FILE: FILE
|
5
|
+
mixins:[
|
6
|
+
Lanes.Workspace.WorkspaceView
|
7
|
+
]
|
4
8
|
|
5
9
|
events:
|
6
10
|
click: 'displayScreen'
|
@@ -16,6 +20,10 @@ class ScreenList extends Lanes.Views.Base
|
|
16
20
|
class ScreenGroup extends Lanes.Views.Base
|
17
21
|
|
18
22
|
template: -> '<li class="group"><a href="#"><span></span><i></i></a><ul></ul></li>'
|
23
|
+
FILE: FILE
|
24
|
+
mixins:[
|
25
|
+
Lanes.Workspace.WorkspaceView
|
26
|
+
]
|
19
27
|
events:
|
20
28
|
'click .group>a': 'toggleMenu'
|
21
29
|
|
@@ -42,8 +50,12 @@ class ScreenGroup extends Lanes.Views.Base
|
|
42
50
|
|
43
51
|
class Lanes.Workspace.ScreensMenu extends Lanes.Views.Base
|
44
52
|
|
45
|
-
|
46
|
-
|
53
|
+
templateName: 'screens-menu'
|
54
|
+
mixins:[
|
55
|
+
Lanes.Workspace.WorkspaceView
|
56
|
+
]
|
57
|
+
|
58
|
+
FILE: FILE
|
47
59
|
|
48
60
|
subviews:
|
49
61
|
navigation:
|
@@ -11,7 +11,7 @@
|
|
11
11
|
@import "<%= ext.stylesheet_include %>";
|
12
12
|
<% end %>
|
13
13
|
<% Lanes::Components.enabled_with_dependencies(self) do | component | %>
|
14
|
-
@import "components/<%= component
|
14
|
+
@import "lanes/components/<%= component %>/index";
|
15
15
|
<% end %>
|
16
16
|
@import "styles/plugins/all";
|
17
17
|
@import "styles/layout";
|
@@ -22,3 +22,8 @@
|
|
22
22
|
@import "styles/forms";
|
23
23
|
@import "styles/keybindings";
|
24
24
|
}
|
25
|
+
<% if !Lanes.config.initial_workspace_screen_id.blank? &&
|
26
|
+
screen = Lanes::Screen[Lanes.config.initial_workspace_screen_id]
|
27
|
+
%>
|
28
|
+
@import "<%= screen.css.remove(/\.css$/) + "/index.scss" %>"
|
29
|
+
<% end %>
|
data/lanes.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.required_ruby_version = ">= 2.0"
|
26
26
|
|
27
|
-
spec.add_dependency "activerecord", "~> 4.
|
27
|
+
spec.add_dependency "activerecord", "~> 4.2"
|
28
28
|
spec.add_dependency "pg", "~> 0.17"
|
29
29
|
spec.add_dependency "sinatra", "~> 1.4"
|
30
30
|
spec.add_dependency "bcrypt", "~> 3.1"
|
data/lib/lanes/api/controller.rb
CHANGED
@@ -148,12 +148,11 @@ module Lanes
|
|
148
148
|
if options[:total_count]
|
149
149
|
json[:total] = options.delete(:total_count)
|
150
150
|
end
|
151
|
-
json.merge
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
return json
|
151
|
+
json.merge(
|
152
|
+
success: success,
|
153
|
+
message: options[:messsage] || json_status_str(query, type.to_s.capitalize, success),
|
154
|
+
data: success ? records_for_reply(query, options) : []
|
155
|
+
)
|
157
156
|
end
|
158
157
|
|
159
158
|
|
@@ -327,5 +326,4 @@ module Lanes
|
|
327
326
|
|
328
327
|
end
|
329
328
|
end
|
330
|
-
|
331
329
|
end
|
@@ -26,14 +26,15 @@ module Lanes
|
|
26
26
|
# if the file is being loaded under the "lanes" directory
|
27
27
|
# it's not an extension
|
28
28
|
if ns && ns != "Lanes"
|
29
|
+
ns = ns.underscore.camelize
|
29
30
|
ref = "(window.Lanes ? window.Lanes['#{ns}'] : null)"
|
30
31
|
"(function(Lanes, #{ns}, _, window, FILE, undefined)"\
|
31
32
|
"{\n#{js}\n})(window.Lanes,#{ref},window._, window,"\
|
32
|
-
"{namespace:#{ref},
|
33
|
+
"{namespace:#{ref},extensionName:'#{ns}',path:'#{file}'});"
|
33
34
|
else
|
34
35
|
"(function(Lanes, _, window, FILE, undefined)"\
|
35
36
|
"{\n#{js}\n})(window.Lanes,window._, window,"\
|
36
|
-
"{namespace:window.Lanes,
|
37
|
+
"{namespace:window.Lanes,extensionName:'Lanes',path:'#{file}'});"
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
data/lib/lanes/command/app.rb
CHANGED
@@ -24,30 +24,34 @@ module Lanes
|
|
24
24
|
template "lib/namespace.rb", "lib/#{name}.rb"
|
25
25
|
template "lib/namespace/version.rb", "lib/#{name}/version.rb"
|
26
26
|
template "lib/namespace/extension.rb", "lib/#{name}/extension.rb"
|
27
|
+
template "lib/namespace/base_model.rb", "lib/#{name}/model.rb"
|
27
28
|
template "config/routes.rb"
|
28
29
|
template "config/lanes.rb"
|
29
30
|
template "gitignore",".gitignore"
|
30
31
|
create_file "tmp/.gitkeep",""
|
31
32
|
create_file "db/.gitkeep", ""
|
33
|
+
create_file "config/screens.rb"
|
32
34
|
end
|
33
35
|
|
34
36
|
def create_client_files
|
35
37
|
self.class.source_root.join('client').children.each do | path |
|
36
38
|
next unless path.directory?
|
37
|
-
empty_directory "#{client_dir}/#{path.basename}"
|
39
|
+
empty_directory "#{client_dir}/#{path.basename}"
|
38
40
|
create_file "#{client_dir}/#{path.basename}/.gitkeep"
|
39
41
|
end
|
42
|
+
template "client/models/BaseModel.coffee", "#{client_dir}/models/Base.coffee"
|
43
|
+
template "client/views/BaseView.coffee", "#{client_dir}/views/Base.coffee"
|
40
44
|
template "client/index.js", "#{client_dir}/index.js"
|
41
45
|
template "client/Extension.coffee", "#{client_dir}/Extension.coffee"
|
42
46
|
template "client/styles.scss", "#{client_dir}/styles.scss"
|
43
47
|
end
|
44
48
|
|
45
49
|
def create_spec
|
46
|
-
|
50
|
+
|
47
51
|
end
|
48
|
-
|
52
|
+
|
49
53
|
def create_first_screen
|
50
|
-
|
54
|
+
template "client/screens/Screen.coffee", "#{client_dir}/screens/Base.coffee"
|
51
55
|
end
|
52
56
|
end
|
53
57
|
|
@@ -28,7 +28,8 @@ module Lanes
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def create_migration
|
31
|
-
migration = exising_migration ||
|
31
|
+
migration = exising_migration ||
|
32
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S") + "_create_#{table_name}.rb"
|
32
33
|
self.fields = fields.map{ |field| ModelAttribute.parse(field) }
|
33
34
|
template "db/create_table_migration.rb", "db/migrate/#{migration}"
|
34
35
|
end
|
@@ -36,15 +37,16 @@ module Lanes
|
|
36
37
|
def create_model
|
37
38
|
template "lib/namespace/model.rb", "lib/#{namespace}/#{file_name}.rb"
|
38
39
|
template "spec/namespace/model_spec.rb", "#{spec_dir}/#{file_name}.rb"
|
39
|
-
template "spec/fixtures/namespace/model.yml",
|
40
|
+
template "spec/fixtures/namespace/model.yml",
|
41
|
+
"spec/fixtures/#{namespace}/#{file_name}.yml"
|
40
42
|
end
|
41
43
|
|
42
44
|
def create_client
|
43
45
|
self.fields.unshift ModelAttribute.parse("id:integer")
|
44
46
|
template "client/models/Model.coffee", \
|
45
|
-
|
47
|
+
"#{client_dir}/models/#{class_name}.coffee"
|
46
48
|
template "spec/client/models/ModelSpec.coffee", \
|
47
|
-
|
49
|
+
"#{spec_dir}/models/#{class_name}Spec.coffee"
|
48
50
|
end
|
49
51
|
|
50
52
|
def add_route
|
@@ -83,13 +85,13 @@ module Lanes
|
|
83
85
|
end
|
84
86
|
end
|
85
87
|
|
86
|
-
def client_parent
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
end
|
88
|
+
# def client_parent
|
89
|
+
# if options[:parent] == 'Lanes::Model'
|
90
|
+
# "Lanes.Models.Base"
|
91
|
+
# else
|
92
|
+
# "#{namespace.camelize}.Models.#{options[:parent]}"
|
93
|
+
# end
|
94
|
+
# end
|
93
95
|
|
94
96
|
def max_field_length
|
95
97
|
@max_field_length ||= fields.map{|field|
|