backboneAX 0.1.0 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module BackboneAX
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -5,7 +5,6 @@ class Bx.Collection.Paginate extends Bx.Collection.Base
5
5
  @pageSize = options.pageSize ? 10
6
6
  @pageCurrent = options.pageCurrent ? 0
7
7
  @pageTotal = options.pageTotal ? 1
8
- @current = options.current ? null
9
8
 
10
9
  parse: (response) ->
11
10
  @pageCurrent = if response.pagination then response.pagination.current ? 1 else 1
@@ -14,24 +13,17 @@ class Bx.Collection.Paginate extends Bx.Collection.Base
14
13
 
15
14
  fetch: (options = {}) ->
16
15
  options.data = $.extend(options.data || {}, {page: @pageCurrent, pageSize: @pageSize})
17
-
18
- if @current? && @current.isNew()
19
- optionsSuccess = options.success
20
- options.success = (collection, response) =>
21
- first = collection.first()
22
- @currentSet(first.id) if first?
23
- optionsSuccess(collection, response) if optionsSuccess
24
-
25
16
  super(options)
26
17
 
27
18
  # RESTART THE SEARCH
28
- restart: (options = {}) ->
29
- options.add = false
19
+ restart: (options = {}) ->
20
+ options.reset = true
30
21
  @pageCurrent = 1
31
22
  @fetch(options)
32
23
 
33
24
  # PREV PAGE / NEXT PAGE
34
25
  prev: (options = {}) ->
26
+ options.reset = true
35
27
  if @pageCurrent > 0
36
28
  @pageCurrent--
37
29
  @fetch(options)
@@ -40,6 +32,7 @@ class Bx.Collection.Paginate extends Bx.Collection.Base
40
32
  @pageCurrent > 1
41
33
 
42
34
  next: (options = {}) ->
35
+ options.reset = true
43
36
  if @pageCurrent < @pageTotal
44
37
  @pageCurrent++
45
38
  @fetch(options)
@@ -49,41 +42,10 @@ class Bx.Collection.Paginate extends Bx.Collection.Base
49
42
 
50
43
  # MORE PAGE
51
44
  more: (options = {}) ->
52
- options.add = true
45
+ options.reset = false
53
46
  if @pageCurrent < @pageTotal
54
47
  @pageCurrent++
55
48
  @fetch(options)
56
49
 
57
50
  hasMore: () ->
58
51
  @pageCurrent < @pageTotal
59
-
60
- # CURRENT
61
- currentSet: (id)->
62
- if @current? && @current.id != parseInt(id, 10)
63
- @current.set({id: id}, {silent: true})
64
- @current.fetch();
65
-
66
- currentPrev: () ->
67
- return unless @current?
68
- index = @indexOf(@current.id)
69
- if index > 0
70
- @currentSet(@at(index - 1).id)
71
-
72
- hasCurrentPrev: () ->
73
- return false unless @current?
74
- index = @indexOf(@current.id)
75
- return index > 0
76
-
77
- currentNext: () ->
78
- return unless @current?
79
- index = @indexOf(@current.id)
80
- if index < @size - 1
81
- @currentSet(@at(index + 1).id)
82
- else
83
- @more()
84
-
85
- hasCurrentNext: () ->
86
- return false unless @current?
87
- index = @indexOf(@current.id)
88
- return (index < @size - 1) || @hasMore()
89
-
@@ -91,9 +91,9 @@ class Bx.View.Base extends Backbone.View
91
91
  fields = if $scope? then $("*[data-setter]", $scope) else @$("*[data-setter]")
92
92
  _.each fields, (field) =>
93
93
  $field = $(field)
94
- setters= $field.attr("data-setter").split(";");
94
+ setters= $field.attr("data-setter").split(",");
95
95
  _.each setters, (setter) =>
96
- setdata = setter.split(',')
96
+ setdata = setter.split(':')
97
97
  setdata.push("text") if (setdata.length == 1 )
98
98
  switch $.trim(setdata[1])
99
99
  when "id"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backboneAX
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-21 00:00:00.000000000 Z
12
+ date: 2013-05-21 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: backbone Application Extensions for cleaner application development
15
15
  email:
@@ -51,7 +51,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
51
51
  version: '0'
52
52
  segments:
53
53
  - 0
54
- hash: -614484520966720426
54
+ hash: -705998462310592341
55
55
  required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  none: false
57
57
  requirements:
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  version: '0'
61
61
  segments:
62
62
  - 0
63
- hash: -614484520966720426
63
+ hash: -705998462310592341
64
64
  requirements: []
65
65
  rubyforge_project: backboneAX
66
66
  rubygems_version: 1.8.25