lanes 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +7 -0
  3. data/Gemfile +2 -2
  4. data/client/lanes/components/Base.coffee +12 -11
  5. data/client/lanes/components/enabled.js.erb +1 -1
  6. data/client/lanes/components/grid/Editor.coffee +2 -2
  7. data/client/lanes/components/grid/Grid.coffee +60 -58
  8. data/client/lanes/components/grid/PopOverEditor.coffee +3 -3
  9. data/client/lanes/components/grid/RowEditor.coffee +1 -1
  10. data/client/lanes/components/grid/{grid.scss → _index.scss} +0 -0
  11. data/client/lanes/components/grid/template.html +1 -1
  12. data/client/lanes/components/modal/ModalDialog.coffee +1 -1
  13. data/client/lanes/components/modal/{modal.scss → _index.scss} +1 -1
  14. data/client/lanes/components/modal/index.js +1 -1
  15. data/client/lanes/components/popover/PopOver.coffee +1 -1
  16. data/client/lanes/components/popover/_index.scss +1 -0
  17. data/client/lanes/components/popover/index.js +1 -1
  18. data/client/lanes/components/select_field/{select_field.scss → _index.scss} +0 -0
  19. data/client/lanes/extension/Extensions.coffee +3 -2
  20. data/client/lanes/lib/Templates.coffee +7 -0
  21. data/client/lanes/minimal.js +1 -1
  22. data/client/lanes/minimal.scss.erb +1 -1
  23. data/client/lanes/models/Base.coffee +16 -19
  24. data/client/lanes/models/Bootstrap.coffee +1 -2
  25. data/client/lanes/models/Collection.coffee +37 -25
  26. data/client/lanes/models/Screens.coffee +6 -18
  27. data/client/lanes/models/Sync.coffee +12 -5
  28. data/client/lanes/screens/Base.coffee +1 -2
  29. data/client/lanes/screens/Instance.coffee +2 -5
  30. data/client/lanes/screens/screen-definitions.js.erb +10 -2
  31. data/client/{styles → lanes/styles}/components/all.scss +0 -0
  32. data/client/{styles → lanes/styles}/components/changes-notification.scss +0 -0
  33. data/client/{styles → lanes/styles}/components/record-finder.scss +0 -0
  34. data/client/{styles → lanes/styles}/components/suggest.scss +0 -0
  35. data/client/{styles → lanes/styles}/fonts/icomoon.eot +0 -0
  36. data/client/{styles → lanes/styles}/fonts/icomoon.svg +0 -0
  37. data/client/{styles → lanes/styles}/fonts/icomoon.ttf +0 -0
  38. data/client/{styles → lanes/styles}/fonts/icomoon.woff +0 -0
  39. data/client/{styles → lanes/styles}/fonts/selection.json +0 -0
  40. data/client/{styles → lanes/styles}/fonts/style.scss +0 -0
  41. data/client/{styles → lanes/styles}/fonts.scss +5 -5
  42. data/client/{styles → lanes/styles}/forms.scss +0 -0
  43. data/client/{styles → lanes/styles}/index.css +0 -0
  44. data/client/{styles → lanes/styles}/keybindings.scss +0 -0
  45. data/client/{styles → lanes/styles}/layout.scss +0 -0
  46. data/client/{styles → lanes/styles}/plugins/all.scss +0 -0
  47. data/client/{styles → lanes/styles}/plugins/overlay.scss +0 -0
  48. data/client/{styles → lanes/styles}/plugins/resize-sensor.scss +0 -0
  49. data/client/{styles → lanes/styles}/screens.scss +0 -0
  50. data/client/{styles → lanes/styles}/tabs.scss +0 -0
  51. data/client/{styles → lanes/styles}/vendor/bootstrap/_alerts.scss +0 -0
  52. data/client/{styles → lanes/styles}/vendor/bootstrap/_badges.scss +0 -0
  53. data/client/{styles → lanes/styles}/vendor/bootstrap/_breadcrumbs.scss +0 -0
  54. data/client/{styles → lanes/styles}/vendor/bootstrap/_button-groups.scss +0 -0
  55. data/client/{styles → lanes/styles}/vendor/bootstrap/_buttons.scss +0 -0
  56. data/client/{styles → lanes/styles}/vendor/bootstrap/_carousel.scss +0 -0
  57. data/client/{styles → lanes/styles}/vendor/bootstrap/_close.scss +0 -0
  58. data/client/{styles → lanes/styles}/vendor/bootstrap/_code.scss +0 -0
  59. data/client/{styles → lanes/styles}/vendor/bootstrap/_component-animations.scss +0 -0
  60. data/client/{styles → lanes/styles}/vendor/bootstrap/_dropdowns.scss +0 -0
  61. data/client/{styles → lanes/styles}/vendor/bootstrap/_forms.scss +0 -0
  62. data/client/{styles → lanes/styles}/vendor/bootstrap/_glyphicons.scss +0 -0
  63. data/client/{styles → lanes/styles}/vendor/bootstrap/_grid.scss +0 -0
  64. data/client/{styles → lanes/styles}/vendor/bootstrap/_input-groups.scss +0 -0
  65. data/client/{styles → lanes/styles}/vendor/bootstrap/_jumbotron.scss +0 -0
  66. data/client/{styles → lanes/styles}/vendor/bootstrap/_labels.scss +0 -0
  67. data/client/{styles → lanes/styles}/vendor/bootstrap/_list-group.scss +0 -0
  68. data/client/{styles → lanes/styles}/vendor/bootstrap/_media.scss +0 -0
  69. data/client/{styles → lanes/styles}/vendor/bootstrap/_mixins.scss +0 -0
  70. data/client/{styles → lanes/styles}/vendor/bootstrap/_modals.scss +0 -0
  71. data/client/{styles → lanes/styles}/vendor/bootstrap/_navbar.scss +0 -0
  72. data/client/{styles → lanes/styles}/vendor/bootstrap/_navs.scss +0 -0
  73. data/client/{styles → lanes/styles}/vendor/bootstrap/_normalize.scss +0 -0
  74. data/client/{styles → lanes/styles}/vendor/bootstrap/_pager.scss +0 -0
  75. data/client/{styles → lanes/styles}/vendor/bootstrap/_pagination.scss +0 -0
  76. data/client/{styles → lanes/styles}/vendor/bootstrap/_panels.scss +0 -0
  77. data/client/{styles → lanes/styles}/vendor/bootstrap/_popovers.scss +0 -0
  78. data/client/{styles → lanes/styles}/vendor/bootstrap/_print.scss +0 -0
  79. data/client/{styles → lanes/styles}/vendor/bootstrap/_progress-bars.scss +0 -0
  80. data/client/{styles → lanes/styles}/vendor/bootstrap/_responsive-embed.scss +0 -0
  81. data/client/{styles → lanes/styles}/vendor/bootstrap/_responsive-utilities.scss +0 -0
  82. data/client/{styles → lanes/styles}/vendor/bootstrap/_scaffolding.scss +0 -0
  83. data/client/{styles → lanes/styles}/vendor/bootstrap/_tables.scss +0 -0
  84. data/client/{styles → lanes/styles}/vendor/bootstrap/_theme.scss +0 -0
  85. data/client/{styles → lanes/styles}/vendor/bootstrap/_thumbnails.scss +0 -0
  86. data/client/{styles → lanes/styles}/vendor/bootstrap/_tooltip.scss +0 -0
  87. data/client/{styles → lanes/styles}/vendor/bootstrap/_type.scss +0 -0
  88. data/client/{styles → lanes/styles}/vendor/bootstrap/_utilities.scss +0 -0
  89. data/client/{styles → lanes/styles}/vendor/bootstrap/_variables.scss +0 -0
  90. data/client/{styles → lanes/styles}/vendor/bootstrap/_wells.scss +0 -0
  91. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_alerts.scss +0 -0
  92. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_background-variant.scss +0 -0
  93. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_border-radius.scss +0 -0
  94. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_buttons.scss +0 -0
  95. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_center-block.scss +0 -0
  96. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_clearfix.scss +0 -0
  97. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_forms.scss +0 -0
  98. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_gradients.scss +0 -0
  99. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_grid-framework.scss +0 -0
  100. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_grid.scss +0 -0
  101. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_hide-text.scss +0 -0
  102. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_image.scss +0 -0
  103. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_labels.scss +0 -0
  104. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_list-group.scss +0 -0
  105. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_nav-divider.scss +0 -0
  106. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_nav-vertical-align.scss +0 -0
  107. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_opacity.scss +0 -0
  108. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_pagination.scss +0 -0
  109. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_panels.scss +0 -0
  110. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_progress-bar.scss +0 -0
  111. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_reset-filter.scss +0 -0
  112. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_resize.scss +0 -0
  113. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_responsive-visibility.scss +0 -0
  114. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_size.scss +0 -0
  115. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_tab-focus.scss +0 -0
  116. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_table-row.scss +0 -0
  117. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_text-emphasis.scss +0 -0
  118. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_text-overflow.scss +0 -0
  119. data/client/{styles → lanes/styles}/vendor/bootstrap/mixins/_vendor-prefixes.scss +0 -0
  120. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_alerts.scss +0 -0
  121. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_badges.scss +0 -0
  122. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_breadcrumbs.scss +0 -0
  123. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_button-groups.scss +0 -0
  124. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_buttons.scss +0 -0
  125. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_carousel.scss +0 -0
  126. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_close.scss +0 -0
  127. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_code.scss +0 -0
  128. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_component-animations.scss +0 -0
  129. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_dropdowns.scss +0 -0
  130. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_forms.scss +0 -0
  131. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_glyphicons.scss +0 -0
  132. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_grid.scss +0 -0
  133. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_input-groups.scss +0 -0
  134. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_jumbotron.scss +0 -0
  135. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_labels.scss +0 -0
  136. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_list-group.scss +0 -0
  137. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_media.scss +0 -0
  138. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_mixins.scss +0 -0
  139. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_modals.scss +0 -0
  140. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_navbar.scss +0 -0
  141. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_navs.scss +0 -0
  142. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_normalize.scss +0 -0
  143. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_pager.scss +0 -0
  144. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_pagination.scss +0 -0
  145. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_panels.scss +0 -0
  146. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_popovers.scss +0 -0
  147. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_print.scss +0 -0
  148. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_progress-bars.scss +0 -0
  149. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_responsive-embed.scss +0 -0
  150. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_responsive-utilities.scss +0 -0
  151. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_scaffolding.scss +0 -0
  152. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_tables.scss +0 -0
  153. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_theme.scss +0 -0
  154. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_thumbnails.scss +0 -0
  155. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_tooltip.scss +0 -0
  156. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_type.scss +0 -0
  157. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_utilities.scss +0 -0
  158. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_variables.scss +0 -0
  159. data/client/{styles → lanes/styles}/vendor/bootstrap/old/_wells.scss +0 -0
  160. data/client/{styles → lanes/styles}/vendor/bootstrap/old/bootstrap.scss +0 -0
  161. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_alerts.scss +0 -0
  162. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_background-variant.scss +0 -0
  163. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_border-radius.scss +0 -0
  164. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_buttons.scss +0 -0
  165. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_center-block.scss +0 -0
  166. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_clearfix.scss +0 -0
  167. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_forms.scss +0 -0
  168. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_gradients.scss +0 -0
  169. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_grid-framework.scss +0 -0
  170. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_grid.scss +0 -0
  171. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_hide-text.scss +0 -0
  172. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_image.scss +0 -0
  173. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_labels.scss +0 -0
  174. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_list-group.scss +0 -0
  175. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_nav-divider.scss +0 -0
  176. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_nav-vertical-align.scss +0 -0
  177. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_opacity.scss +0 -0
  178. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_pagination.scss +0 -0
  179. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_panels.scss +0 -0
  180. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_progress-bar.scss +0 -0
  181. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_reset-filter.scss +0 -0
  182. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_resize.scss +0 -0
  183. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_responsive-visibility.scss +0 -0
  184. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_size.scss +0 -0
  185. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_tab-focus.scss +0 -0
  186. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_table-row.scss +0 -0
  187. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_text-emphasis.scss +0 -0
  188. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_text-overflow.scss +0 -0
  189. data/client/{styles → lanes/styles}/vendor/bootstrap/old/mixins/_vendor-prefixes.scss +0 -0
  190. data/client/{styles → lanes/styles}/vendor/bootstrap-custom-grid.scss +0 -0
  191. data/client/{styles → lanes/styles}/vendor/bootstrap-custom-modals.scss +0 -0
  192. data/client/{styles → lanes/styles}/vendor/bootstrap.scss +2 -2
  193. data/client/{styles → lanes/styles}/vendor/dataTables.scss +0 -0
  194. data/client/lanes/views/Base.coffee +34 -49
  195. data/client/lanes/views/FormBindings.coffee +22 -20
  196. data/client/lanes/views/Helpers.coffee +1 -1
  197. data/client/lanes/views/empty-span.html +1 -0
  198. data/client/lanes/workspace/ActiveScreensSwitcher.coffee +8 -1
  199. data/client/lanes/workspace/Layout.coffee +7 -4
  200. data/client/lanes/workspace/Navbar.coffee +6 -2
  201. data/client/lanes/workspace/Pages.coffee +5 -1
  202. data/client/lanes/workspace/ScreensMenu.coffee +14 -2
  203. data/client/lanes/workspace/WorkspaceView.coffee +5 -0
  204. data/client/lanes/workspace/index.js +1 -0
  205. data/client/lanes/workspace.scss.erb +6 -1
  206. data/lanes.gemspec +1 -1
  207. data/lib/lanes/api/controller.rb +5 -7
  208. data/lib/lanes/api/helper_methods.rb +1 -1
  209. data/lib/lanes/api/javascript_processor.rb +3 -2
  210. data/lib/lanes/command/app.rb +8 -4
  211. data/lib/lanes/command/generate_model.rb +13 -11
  212. data/lib/lanes/command/generate_screen.rb +9 -2
  213. data/lib/lanes/command/generate_view.rb +15 -3
  214. data/lib/lanes/command/generate_view.usage +7 -7
  215. data/lib/lanes/command/named_command.rb +2 -2
  216. data/lib/lanes/command/templates/client/index.js +3 -0
  217. data/lib/lanes/command/templates/client/models/BaseModel.coffee +5 -0
  218. data/lib/lanes/command/templates/client/models/Model.coffee +1 -1
  219. data/lib/lanes/command/templates/client/views/BaseView.coffee +5 -0
  220. data/lib/lanes/command/templates/client/views/View.coffee +1 -1
  221. data/lib/lanes/command/templates/config/screen.rb +8 -0
  222. data/lib/lanes/command/templates/lib/namespace/base_model.rb +9 -0
  223. data/lib/lanes/command/templates/lib/namespace/model.rb +1 -1
  224. data/lib/lanes/command/templates/spec/client/models/ModelSpec.coffee +1 -1
  225. data/lib/lanes/command/templates/spec/client/views/ViewSpec.coffee +1 -1
  226. data/lib/lanes/command.rb +1 -2
  227. data/lib/lanes/components.rb +5 -4
  228. data/lib/lanes/concerns/all.rb +0 -5
  229. data/lib/lanes/concerns/attr_accessor_with_default.rb +5 -3
  230. data/lib/lanes/concerns/set_attribute_data.rb +6 -23
  231. data/lib/lanes/configuration.rb +1 -0
  232. data/lib/lanes/extension.rb +19 -10
  233. data/lib/lanes/guard_tasks.rb +1 -1
  234. data/lib/lanes/model.rb +1 -6
  235. data/lib/lanes/{screens.rb → screen.rb} +40 -23
  236. data/lib/lanes/spec_helper.rb +4 -2
  237. data/lib/lanes/version.rb +1 -1
  238. data/lib/lanes.rb +1 -1
  239. data/spec/api/javascript_processor_spec.rb +3 -3
  240. data/spec/command_spec.rb +49 -0
  241. data/spec/concerns/attr_accessor_with_default_spec.rb +7 -0
  242. data/spec/helpers/lanes-helpers.coffee +46 -22
  243. data/spec/helpers/minitest_assertions.rb +23 -0
  244. data/spec/lanes/models/BaseSpec.coffee +57 -56
  245. data/spec/lanes/models/CollectionSpec.coffee +14 -0
  246. data/spec/lanes/models/PubSubSpec.coffee +5 -5
  247. data/spec/lanes/views/BaseSpec.coffee +32 -31
  248. data/spec/lanes/views/FormBindingsSpec.coffee +32 -0
  249. metadata +183 -179
  250. data/client/lanes/components/popover/popover.scss +0 -1
  251. data/lib/lanes/command/templates/lib/namespace/screen.rb +0 -17
  252. data/lib/lanes/concerns/code_identifier.rb +0 -43
  253. data/lib/lanes/concerns/immutable_model.rb +0 -32
  254. data/lib/lanes/concerns/locked_fields.rb +0 -84
  255. data/lib/lanes/concerns/random_hash_code.rb +0 -40
  256. data/lib/lanes/concerns/visible_id_identifier.rb +0 -53
  257. data/spec/concerns/code_identifier_spec.rb +0 -45
@@ -10,6 +10,9 @@ CommonMethods = {
10
10
  break if found != -1
11
11
  found
12
12
 
13
+ # convenience method to create a new subCollection
14
+ subcollection: (options)->
15
+ new Lanes.Models.SubCollection(this, options)
13
16
 
14
17
  destroyAll: (options={})->
15
18
  success = options.success
@@ -21,7 +24,6 @@ CommonMethods = {
21
24
  success.apply(@,arguments) if success
22
25
  })
23
26
  Lanes.Models.Sync.perform('delete', this, options)
24
-
25
27
  }
26
28
 
27
29
  class ModelsCollection
@@ -31,56 +33,66 @@ class ModelsCollection
31
33
  @errors=[]
32
34
  Lanes.Vendor.Ampersand.Collection.apply(this, arguments)
33
35
 
36
+ # convenience method to instantiate a collection
37
+ # then call fetch on it with the options provided
34
38
  @fetch: (options)->
35
39
  collection = new this
36
40
  collection.fetch(options)
37
41
  collection
38
-
42
+
43
+ # Fetch the a set of models for the collection, replacing all
44
+ # current models whith them when the call completes
39
45
  fetch: (options={})->
40
- @_isLoaded = true
41
- Lanes.Models.Sync.wrapRequest(this,options)
42
- return this.sync('read', this, options)
46
+ handlers = Lanes.Models.Sync.wrapRequest(this,options)
47
+ if options.force || !@_isLoaded
48
+ this.sync('read', this, options)
49
+ else
50
+ handlers.resolvePromise( record: this, reply: {} )
51
+ handlers.promise
52
+
53
+ # Call the callback function when the current fetch succeeds
54
+ # If the collection is not currently being loaded,
55
+ # the callback is immediatly invoked
56
+ whenLoaded: (cb)->
57
+ if this.requestInProgress
58
+ cb(this)
59
+ else
60
+ this._loaded_callbacks ||= []
61
+ this._loaded_callbacks.push(cb)
62
+ this
43
63
 
44
64
  # Sets the attribute data from a server respose
45
65
  setFromServer: (data, options)->
66
+ @_isLoaded = true
46
67
  method = if options.reset then 'reset' else 'set'
47
68
  this[method](data, options)
48
- this.trigger('sync', this, data, options)
49
-
50
- isLoaded:->
51
- @_isLoaded
69
+ if this._loaded_callbacks
70
+ cb(this) for cb in this._loaded_callbacks
71
+ delete this._loaded_callbacks
52
72
 
53
- ensureLoaded: ( callback )->
54
- if ! @_isLoaded && ! this.length
55
- this.fetch({ success: callback })
56
- else if callback
57
- callback()
73
+ isLoaded:-> @_isLoaded
58
74
 
75
+ # true if any models have unsaved data
59
76
  isDirty: ->
60
77
  for model in @models
61
78
  return true if model.isDirty()
62
79
  false
63
80
 
64
- parse:(resp)->
65
- resp['data']
66
-
67
- viewJSON: (options)->
68
- this.map( (model) ->
69
- model.viewJSON(options)
70
- )
71
-
72
- url: ->
73
- @model::urlRoot()
81
+ url: -> @model::urlRoot()
74
82
 
75
83
  sync: Lanes.Models.Sync.perform
76
84
 
77
85
  save: (options)->
78
86
  Lanes.Models.Sync.perform('update', this, options)
79
87
 
88
+ # returns data to save to server. If options.saveAll is true,
89
+ # all attributes from all models data is returned.
90
+ # Otherwise only unsaved attributes are returned.
80
91
  dataForSave: (options)->
81
92
  unsaved = []
82
93
  for model in @models
83
- unsaved.push( model.unsavedModels() ) if model.isDirty()
94
+ if options.saveAll || model.isDirty()
95
+ unsaved.push( model.dataForSave(options) )
84
96
  unsaved
85
97
 
86
98
  _prepareModel: (attrs, options={})->
@@ -38,9 +38,11 @@ class ScreenDefinition extends Lanes.Models.BasicModel
38
38
  view: 'string'
39
39
  icon: 'string'
40
40
  group_id: 'string'
41
- files: 'array'
42
41
  loading: 'boolean'
43
42
  model: 'string'
43
+ assets: 'array'
44
+ js: 'string'
45
+ css: 'string'
44
46
 
45
47
  derived:
46
48
  model_type:
@@ -54,7 +56,7 @@ class ScreenDefinition extends Lanes.Models.BasicModel
54
56
  @views.push( new ScreenView( screen: this, viewport: viewport ) )
55
57
 
56
58
  getScreen: ->
57
- @viewModel ||= Lanes.getPath(this.view,"Lanes.Screens")
59
+ @viewModel ||= Lanes.getPath(this.view)
58
60
  if @viewModel?
59
61
  _.Promise.resolve(@viewMOdel)
60
62
  else
@@ -62,9 +64,9 @@ class ScreenDefinition extends Lanes.Models.BasicModel
62
64
 
63
65
  loadScreen: ->
64
66
  me=this
65
- return new _.Promise( (resolve,reject)->
67
+ return new _.Promise( (resolve,reject)->
66
68
  me.loading=true
67
- Lanes.lib.Request(me.files)
69
+ Lanes.lib.Request(me.assets)
68
70
  .then ->
69
71
  me.loading=false
70
72
  me.viewModel = Lanes.getPath(me.view)
@@ -80,20 +82,6 @@ class ScreenDefinition extends Lanes.Models.BasicModel
80
82
  display: (ui)->
81
83
  this.getScreen().then => @_setDisplaying(ui)
82
84
 
83
- # @viewModel ||= Lanes.Screens[this.view]
84
- # if @viewModel?
85
- # this._setDisplaying(ui)
86
- # else
87
- # this.loading=true
88
- # Lanes.lib.Request(this.files)
89
- # .then =>
90
- # @viewModel = Lanes.Screens[this.view]
91
- # @_setDisplaying(ui)
92
- # @loading=false
93
- # .catch (failures)=>
94
- # @loading=false
95
- # Lanes.warn(failures)
96
-
97
85
 
98
86
  class ScreenViewSet extends Lanes.Models.BasicCollection
99
87
 
@@ -1,4 +1,3 @@
1
-
2
1
  # a simple reimplentation
3
2
  # to use traffic cop
4
3
  methodMap = {
@@ -46,13 +45,20 @@ Lanes.Models.Sync = {
46
45
  options.resolvePromise = resolve
47
46
  options.rejectPromise = reject
48
47
  )
49
- options.error = (reply, resp, req)->
50
- options.rejectPromise( this.copyServerResp(record,resp.responseJSON || {error: resp.responseText}) )
48
+ options.error = (reply, status, req)->
49
+ options.rejectPromise(
50
+ Lanes.Models.Sync.copyServerReply( record,
51
+ resp.responseJSON || {error: resp.responseText}
52
+ )
53
+ )
54
+ delete record.requestInProgress
51
55
  error?.apply(options.scope, arguments)
52
56
 
53
- options.success = (reply,resp,req)->
57
+ options.success = (reply, status, req)->
54
58
  record.setFromServer( reply.data, options ) if reply?.data?
59
+ record.trigger("sync", record, reply, status)
55
60
  options.resolvePromise( Lanes.Models.Sync.copyServerReply(record,reply) )
61
+ delete record.requestInProgress
56
62
  success?.apply(options.scope, arguments)
57
63
  options
58
64
 
@@ -81,6 +87,7 @@ Lanes.Models.Sync = {
81
87
 
82
88
  # Make the request, allowing the user to override any Ajax options.
83
89
  xhr = options.xhr = Lanes.$.ajax(_.extend(params, options))
84
- model.trigger "request", model, xhr, options
90
+ model.requestInProgress = true
91
+ model.trigger("request", model, xhr, options)
85
92
  xhr
86
93
  }
@@ -16,8 +16,7 @@ class ScreenBase
16
16
 
17
17
  reset: Lanes.emptyFn
18
18
 
19
- template: ->
20
- this.FILE.extension.toLowerCase() + "/screens/" + _.underscore( this.FILE.file ) + "/layout";
19
+ templatePrefix: -> this.FILE.extensionName.toLowerCase() + "/screens/"
21
20
 
22
21
  render: ->
23
22
  previouslyRendered = this.rendered
@@ -22,11 +22,11 @@ class Lanes.Screens.Instance
22
22
  this.root.tooltip({
23
23
  viewport: '.lanes'
24
24
  selector: '[data-tooltip-message]'
25
- title: => @getAttribute('data-tooltip-message')
25
+ title: -> this.getAttribute('data-tooltip-message')
26
26
  });
27
27
  Lanes.Views.Keys.initialize();
28
28
  Lanes.Models.PubSub.initialize() if options.pub_sub;
29
-
29
+
30
30
  view = Lanes.getPath(options.root_view);
31
31
  if view
32
32
  this.displayInitialView(view);
@@ -45,8 +45,5 @@ class Lanes.Screens.Instance
45
45
  displayInitialView:(view)->
46
46
  this.view = new view({parent: this, model: this.viewport}).render();
47
47
  this.viewport.el = this.view.$el;
48
-
49
48
  this.root.append( this.view.el );
50
49
  Lanes.Extensions.fireOnAvailable(this);
51
-
52
-
@@ -1,7 +1,15 @@
1
- <% Lanes::Screens::Group.each(self) do | spec | %>
1
+ <% if !Lanes.config.initial_workspace_screen_id.blank? &&
2
+ screen = Lanes::Screen[Lanes.config.initial_workspace_screen_id]
3
+ require_asset screen.js
4
+ end %>
5
+
6
+ <% Lanes::Screen.each_group do | spec | %>
2
7
  Lanes.Models.Screens.groups.add( <%= spec.to_json %> );
3
8
  <% end %>
4
9
 
5
- <% Lanes::Screens::Definition.each(self) do | spec | %>
10
+ <% Lanes::Screen.each do | spec | %>
6
11
  Lanes.Models.Screens.register( <%= spec.to_json %> );
7
12
  <% end %>
13
+
14
+ <% depend_on "/Users/nas/code/lanes-access/config/screens.rb" %>
15
+
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,10 +1,10 @@
1
1
  @font-face {
2
2
  font-family: 'skr-icon';
3
- src:url(font-path('styles/fonts/icomoon.eot') + '?-7u8s0f');
4
- src:url(font-path('styles/fonts/icomoon.eot') + '?#iefix-7u8s0f') format('embedded-opentype'),
5
- url(font-path('styles/fonts/icomoon.woff') + '?-7u8s0f') format('woff'),
6
- url(font-path('styles/fonts/icomoon.ttf') + '?-7u8s0f') format('truetype'),
7
- url(font-path('styles/fonts/icomoon.svg') + '?-7u8s0f#icomoon') format('svg');
3
+ src:url(font-path('lanes/styles/fonts/icomoon.eot') + '?-7u8s0f');
4
+ src:url(font-path('lanes/styles/fonts/icomoon.eot') + '?#iefix-7u8s0f') format('embedded-opentype'),
5
+ url(font-path('lanes/styles/fonts/icomoon.woff') + '?-7u8s0f') format('woff'),
6
+ url(font-path('lanes/styles/fonts/icomoon.ttf') + '?-7u8s0f') format('truetype'),
7
+ url(font-path('lanes/styles/fonts/icomoon.svg') + '?-7u8s0f#icomoon') format('svg');
8
8
  font-weight: normal;
9
9
  font-style: normal;
10
10
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes