iugu-ux 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module IuguUX
2
- VERSION = "1.0.9"
2
+ VERSION = "1.0.10"
3
3
  end
@@ -42,10 +42,6 @@ class window.app.BaseResource extends Backbone.AssociatedModel
42
42
  @["removeFrom#{@properCasedRelationName relation.key}"] = (object) ->
43
43
  @get(relation.key).destroy(object)
44
44
 
45
- sync: (method, model, options) ->
46
- @configureAjax()
47
- Backbone.sync method, model, options
48
-
49
45
  toJSON: (options) ->
50
46
  _.omit( _.clone( super(options) ), @virtual_attributes )
51
47
 
@@ -55,7 +51,7 @@ class window.app.BaseResource extends Backbone.AssociatedModel
55
51
 
56
52
  save: (attributes, options) ->
57
53
  if @isValid(true)
58
- super null, @handleViewContext options
54
+ super attributes, @handleViewContext options
59
55
 
60
56
  handleViewContext: (options) ->
61
57
  return options unless options.context
@@ -77,16 +73,20 @@ class window.app.BaseResource extends Backbone.AssociatedModel
77
73
  destroy: (options) ->
78
74
  super @handleViewContext options
79
75
 
76
+ getAjaxParameters: ->
77
+ return if ajax_params? then ajax_params else {}
78
+
80
79
  configureAjax: ->
81
80
  app.ajaxSetup
82
81
  headers:
83
82
  Authorization: $.base64.encode api_token
83
+ data: @getAjaxParameters()
84
84
 
85
85
  appendLocaleInfo: (uri) ->
86
86
  uri + (if uri.indexOf('?') then '?' else '&') + 'hl=' + encodeURIComponent( i18n.locale )
87
87
 
88
88
  request: ( type, url, options ) ->
89
- @configureAjax()
90
89
  options = _.extend options,
91
90
  type: type
91
+
92
92
  app.ajax url, options
@@ -1,6 +1,7 @@
1
1
  window.app.BaseResources = Backbone.Paginator.requestPager.extend
2
2
 
3
3
  initialize: ->
4
+ @factorySync = @sync
4
5
  @server_api =
5
6
  'limit': ->
6
7
  return @perPage
@@ -8,8 +9,8 @@ window.app.BaseResources = Backbone.Paginator.requestPager.extend
8
9
  'start': ->
9
10
  return (@currentPage - 1) * @perPage
10
11
 
11
- 'api_token': ->
12
- return api_token
12
+ # 'api_token': ->
13
+ # return api_token
13
14
 
14
15
  paginator_ui:
15
16
  firstPage: 1
@@ -20,10 +21,14 @@ window.app.BaseResources = Backbone.Paginator.requestPager.extend
20
21
  @server_api[param] = value
21
22
  @trigger 'configured-filter', param
22
23
 
24
+ getAjaxParameters: ->
25
+ return if ajax_params? then ajax_params else {}
26
+
23
27
  configureAjax: ->
24
28
  app.ajaxSetup
25
29
  headers:
26
30
  Authorization: $.base64.encode api_token
31
+ data: @getAjaxParameters()
27
32
 
28
33
  getFilter: (param) ->
29
34
  @server_api[param]
@@ -90,6 +90,7 @@ Backbone.Paginator = (function ( Backbone, _, $ ) {
90
90
  url: _.result(queryOptions, 'url')
91
91
  }, options);
92
92
 
93
+
93
94
  return Backbone.ajax( queryOptions );
94
95
 
95
96
  },
@@ -732,18 +733,19 @@ Backbone.Paginator = (function ( Backbone, _, $ ) {
732
733
  // Allows the passing in of {data: {foo: 'bar'}} at request time to overwrite server_api defaults
733
734
  if( options.data ){
734
735
  options.data = decodeURIComponent($.param(_.extend(queryAttributes,options.data)));
736
+ // options.data = _.extend(queryAttributes,options.data);
735
737
  }else{
738
+ // options.data = queryAttributes;
736
739
  options.data = decodeURIComponent($.param(queryAttributes));
737
740
  }
738
741
 
739
742
  queryOptions = _.extend(queryOptions, {
740
743
  jsonpCallback: 'callback',
741
- processData: false,
744
+ processData: true,
742
745
  url: _.result(queryOptions, 'url')
743
746
  }, options);
744
-
745
- return Backbone.ajax( queryOptions );
746
747
 
748
+ return Backbone.ajax( queryOptions );
747
749
  },
748
750
 
749
751
  requestNextPage: function ( options ) {
@@ -40,6 +40,7 @@ String.prototype.capitalize = ->
40
40
  @_callback_xdr = ->
41
41
  app.ajax = app._xdr_frame.contentWindow.jQuery.ajax
42
42
  app.ajaxSetup = app._xdr_frame.contentWindow.jQuery.ajaxSetup
43
+ app.ajaxPrefilter = app._xdr_frame.contentWindow.jQuery.ajaxPrefilter
43
44
  app._features['xdr'] = true
44
45
  if (Backbone)
45
46
  Backbone.ajax = app.ajax
@@ -77,6 +78,7 @@ String.prototype.capitalize = ->
77
78
  @app._features['xdr'] = true
78
79
  @app.ajax = jQuery.ajax
79
80
  @app.ajaxSetup = jQuery.ajaxSetup
81
+ @app.ajaxPrefilter = jQuery.ajaxPrefilter
80
82
 
81
83
  @app.root = '/'
82
84
  if app_root
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iugu-ux
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.10
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-12-02 00:00:00.000000000 Z
12
+ date: 2013-12-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: coffee-script
@@ -866,7 +866,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
866
866
  version: '0'
867
867
  segments:
868
868
  - 0
869
- hash: 1572526259889169736
869
+ hash: -3545096253132802105
870
870
  required_rubygems_version: !ruby/object:Gem::Requirement
871
871
  none: false
872
872
  requirements:
@@ -875,7 +875,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
875
875
  version: '0'
876
876
  segments:
877
877
  - 0
878
- hash: 1572526259889169736
878
+ hash: -3545096253132802105
879
879
  requirements: []
880
880
  rubyforge_project: iugu-ux
881
881
  rubygems_version: 1.8.24