quick_script 0.5.10 → 0.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module QuickScript
2
- VERSION = "0.5.10"
2
+ VERSION = "0.5.11"
3
3
  end
@@ -274,6 +274,7 @@
274
274
  ko.modelStates.EDITING = 4
275
275
  ko.modelStates.INSERTING = 5
276
276
  ko.modelStates.APPENDING = 6
277
+ ko.modelStates.UPDATING = 7
277
278
  ko.editors = {}
278
279
 
279
280
  jQuery.fn.extend
@@ -568,6 +569,8 @@ class @Collection
568
569
  @events.onchange() if @events.onchange?
569
570
  if op == Collection.REPLACE
570
571
  @model_state(ko.modelStates.LOADING)
572
+ if op == Collection.UPDATE
573
+ @model_state(ko.modelStates.UPDATING)
571
574
  else if op == Collection.APPEND
572
575
  @model_state(ko.modelStates.APPENDING)
573
576
  else if op == Collection.INSERT
@@ -576,7 +579,7 @@ class @Collection
576
579
  @scope(scope) if scope?
577
580
  @_load(@scope(), Collection.REPLACE, callback)
578
581
  update : (callback)->
579
- @_load(@scope(), Collection.REPLACE, callback)
582
+ @_load(@scope(), Collection.UPDATE, callback)
580
583
  insert : (scope, callback)->
581
584
  @_load(scope, Collection.INSERT, callback)
582
585
  append : (scope, callback)->
@@ -593,7 +596,7 @@ class @Collection
593
596
  models.push(model)
594
597
  views.push(new cls("view-#{model.id()}", @view_owner(), model))
595
598
 
596
- if !op? || op == Collection.REPLACE
599
+ if !op? || op == Collection.REPLACE || op == Collection.UPDATE
597
600
  @items(models)
598
601
  @views(views)
599
602
  else if op == Collection.INSERT
@@ -611,6 +614,8 @@ class @Collection
611
614
  @update()
612
615
  hasItems : ->
613
616
  @items().length > 0
617
+ length : ->
618
+ @items().length
614
619
  addItem : (item)->
615
620
  item.collection = this
616
621
  cls = @view_model()
@@ -663,6 +668,7 @@ class @Collection
663
668
  Collection.REPLACE = 0
664
669
  Collection.INSERT = 1
665
670
  Collection.APPEND = 2
671
+ Collection.UPDATE = 3
666
672
 
667
673
  class @View
668
674
  init : ->
@@ -851,6 +857,7 @@ class @AppView extends @View
851
857
  constructor : (user_model)->
852
858
  @app = this
853
859
  @path = ko.observable(null)
860
+ @previous_path = ko.observable(null)
854
861
  @path_parts = []
855
862
  ko.addTemplate "app-view", """
856
863
  <div data-bind='foreach : viewList()'>
@@ -874,6 +881,7 @@ class @AppView extends @View
874
881
  super('app', null)
875
882
  route : (path) ->
876
883
  console.log("Loading path '#{path}'")
884
+ @previous_path(@path())
877
885
  @path(path)
878
886
  @path_parts = @path().split('/')
879
887
  @handlePath(path)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quick_script
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 10
10
- version: 0.5.10
9
+ - 11
10
+ version: 0.5.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alan Graham
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-06-17 00:00:00 Z
18
+ date: 2012-06-20 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Framework for single-page web applications