tbone 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 762a9a7f0b5004d70b13084e5964bd4bbbd35f8a
4
- data.tar.gz: 480daf570fe262459d1cffd9f3dd6c448ad94ac4
3
+ metadata.gz: 5e67d35c442a40347e70411b3850f34815a2e56e
4
+ data.tar.gz: d1b9971a426d7ca625443da4dfaee8ed51af73d6
5
5
  SHA512:
6
- metadata.gz: f3882533e26dc87cbf9a29c01b8bc2eb6fffb8353314b032fe22e491e71d6c3874dd9bedcdfd7f01dc2a150d3d632e55db26a8dccd0383b528265a8d357104f8
7
- data.tar.gz: 7b178cda6b09dbb12bf38cdb2e8d8105813aad4b26e2e2289d413f9222d2b78eef64c53bfee90fd42128dff1d55e024d9772703829c9c18e9ca08d42f334a091
6
+ metadata.gz: 1eb6c4a471e7ffc15e1203caeeb03db74f0f5f4864ffd2ffbed992d27b16c889ca14384312b812e8da49b2f6821afeb6f13bd8b3ebe7a8c1f6fd7f6c69cfe7cd
7
+ data.tar.gz: c8009b88c57cf7e9743e442afc0df09541a7cd0486451452dc59ff9a900cc3f7ececcd3c0b0a0df170b1f96d793e12936588197c0561138a09155c8b736c7aab
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
@@ -0,0 +1,27 @@
1
+ define [
2
+ 'jquery'
3
+ 'backbone'
4
+ ], ($, Backbone) ->
5
+ Backbone._sync = Backbone.sync
6
+
7
+ Backbone.sync = (method, model, options) =>
8
+ if (!options.noCSRF)
9
+ beforeSend = options.beforeSend
10
+
11
+ options.beforeSend = (xhr) =>
12
+ token = $('meta[name="csrf-token"]').attr('content')
13
+ xhr.setRequestHeader('X-CSRF-Token', token) if token
14
+ return beforeSend.apply(this, arguments) if beforeSend
15
+
16
+ if (options.data == null && model && (method == 'create' || method == 'update' || method == 'patch'))
17
+ options.contentType = 'application/json'
18
+ data = JSON.stringify(options.attrs || model.toJSON(options))
19
+ if (model.paramRoot)
20
+ data = {}
21
+ data[model.paramRoot] = model.toJSON(options)
22
+ else
23
+ data = model.toJSON();
24
+
25
+ options.data = JSON.stringify(data);
26
+
27
+ Backbone._sync(method, model, options);
@@ -1,4 +1,6 @@
1
- (($) ->
1
+ define [
2
+ 'jquery'
3
+ ], ($) ->
2
4
  $.extend $.fn,
3
5
  backboneLink: (model) ->
4
6
  form = $(this)
@@ -40,5 +42,3 @@
40
42
  inputs.bind 'change', (e) =>
41
43
  el = $(e.target)
42
44
  model.set(name, getValue(el))
43
-
44
- ) jQuery
data/lib/tbone/engine.rb CHANGED
@@ -29,7 +29,7 @@ module Tbone
29
29
  'bootstrap-typeahead'
30
30
  ]
31
31
  conf['paths'] = {}
32
- jquery_plugs.each { |e|
32
+ jquery_plugs.each { |e|
33
33
  conf['paths'][e] = "twitter/bootstrap/#{e}"
34
34
  conf['shim'][e] = ['jquery']
35
35
  }
data/tbone.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: tbone 0.4.0 ruby lib
5
+ # stub: tbone 0.4.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "tbone"
9
- s.version = "0.4.0"
9
+ s.version = "0.4.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Pavel Tatarsky"]
14
- s.date = "2014-12-11"
14
+ s.date = "2014-12-12"
15
15
  s.description = "Library for mixing together requirejs backbone and twitter bootstrap"
16
16
  s.email = "fazzzenda@mail.ru"
17
17
  s.extra_rdoc_files = [
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  "Rakefile",
28
28
  "VERSION",
29
29
  "app/assets/javascripts/backbone-rails.js.coffee",
30
+ "app/assets/javascripts/backbone_rails_sync.js.coffee",
30
31
  "app/assets/javascripts/bootstrap.js.coffee",
31
32
  "app/assets/javascripts/collections/paginated.js.coffee",
32
33
  "app/assets/javascripts/helpers/alert_queue.js.coffee",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tbone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Tatarsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-11 00:00:00.000000000 Z
11
+ date: 2014-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n-js
@@ -208,6 +208,7 @@ files:
208
208
  - Rakefile
209
209
  - VERSION
210
210
  - app/assets/javascripts/backbone-rails.js.coffee
211
+ - app/assets/javascripts/backbone_rails_sync.js.coffee
211
212
  - app/assets/javascripts/bootstrap.js.coffee
212
213
  - app/assets/javascripts/collections/paginated.js.coffee
213
214
  - app/assets/javascripts/helpers/alert_queue.js.coffee