tablets 0.3.5 → 0.3.6

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: 1564751a538edf09cb61d1c929361c6621782589
4
- data.tar.gz: da118f76f81317587d6c3921bac7d59a50968ded
3
+ metadata.gz: 2d046e5a6fa2f522b63f13c69f724ff82473387c
4
+ data.tar.gz: 8587012faa26256221152719f81b85456d8621de
5
5
  SHA512:
6
- metadata.gz: dcaf12f9cdb95379c9de4e55150c5f7bed84194c2c559220842ba273dc30bb3b34833ce6b89e9aad94f57902a6e23f64a54ef55d69b7e03e1a5746825f79e22f
7
- data.tar.gz: c65b3c6e8a53b9833c70fe0b8b091a90673b4b658606d8c40938c00055079ed4c37f54e63a757b42e2a987acb89ab0eaecb3439207ad3e200b5e580567d73b8c
6
+ metadata.gz: aa268e7dc0dd793dfcacbbfefef99d90889f37664edb250745caa05d81a8fe00b88bc66d26a60c96f9e8df5e8052f783984efddfb4a02a84215bd75f6d2ac871
7
+ data.tar.gz: 884625f076e9e455246648e4d8858c8677940acedaa6dc9b62d9468fbf40fcc0b465bcbb4662a6ae322abbaca01340e2433370a467ac9ed815ec61884c256b7b
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Tablets
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/tablets.svg)](http://badge.fury.io/rb/tablets)
4
+ [![Code Climate](https://codeclimate.com/github/zenedge/tablets/badges/gpa.svg)](https://codeclimate.com/github/zenedge/tablets)
5
+ [![Test Coverage](https://codeclimate.com/github/zenedge/tablets/badges/coverage.svg)](https://codeclimate.com/github/zenedge/tablets/coverage)
4
6
 
5
7
  ## Installation
6
8
 
@@ -56,7 +58,7 @@ Tablets.register :posts do
56
58
  options: { className: 'post-title' }
57
59
  }, {
58
60
  title: 'User',
59
- data: ->(user) { [user.first_name, user.last_name].compact.join(' ') },
61
+ data: proc { |user, controller| user == controller.current_user ? 'It is you' : [user.first_name, user.last_name].compact.join(' ') },
60
62
  order: ['users.first_name', 'users.last_name'],
61
63
  search: ['users.first_name', 'users.last_name']
62
64
  }]
@@ -44,7 +44,7 @@ class Tablets.Tablet
44
44
  @trigger('afterResponse', data)
45
45
 
46
46
  reload: ->
47
- @element.dataTable().fnDraw(false)
47
+ @element.dataTable().fnDraw()
48
48
 
49
49
  toggleDetails: (tr) ->
50
50
  row = @table.row tr
@@ -4,7 +4,7 @@ module Tablets
4
4
  before_filter :authorize!
5
5
 
6
6
  def data
7
- render json: Tablets::Data.new(tablet, data_params)
7
+ render json: Tablets::Data.new(tablet, data_params, self)
8
8
  end
9
9
 
10
10
  private
data/lib/tablets/data.rb CHANGED
@@ -6,9 +6,10 @@ module Tablets
6
6
  # Responsible to fetch and prepare data for jquery-datatables.
7
7
  class Data
8
8
  # Initializes data with tablet and params.
9
- def initialize(tablet, params)
9
+ def initialize(tablet, params, controller)
10
10
  @tablet = tablet
11
11
  @params = params
12
+ @controller = controller
12
13
  end
13
14
 
14
15
  # Prepares data to render as json.
@@ -64,7 +65,7 @@ module Tablets
64
65
  def cell(record, column)
65
66
  case column[:data]
66
67
  when Symbol then record.send(column[:data])
67
- when Proc then column[:data].call(record)
68
+ when Proc then column[:data].call(record, @controller)
68
69
  end
69
70
  end
70
71
  end
@@ -1,3 +1,3 @@
1
1
  module Tablets
2
- VERSION = '0.3.5'
2
+ VERSION = '0.3.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tablets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yevhen Shemet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-12 00:00:00.000000000 Z
11
+ date: 2015-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -131,11 +131,8 @@ files:
131
131
  - lib/tablets/version.rb
132
132
  - lib/tablets/view_helpers.rb
133
133
  - spec/lib/tablets/data/processing/base_spec.rb
134
- - spec/lib/tablets/data/processing/filter_spec.rb
135
- - spec/lib/tablets/data/processing/order_spec.rb
136
134
  - spec/lib/tablets/data/processing/paginate_spec.rb
137
135
  - spec/lib/tablets/data/query_spec.rb
138
- - spec/lib/tablets/data_spec.rb
139
136
  - spec/lib/tablets/global/configurator_spec.rb
140
137
  - spec/lib/tablets/global/loader_spec.rb
141
138
  - spec/lib/tablets/global/store_spec.rb
@@ -163,21 +160,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
160
  version: '0'
164
161
  requirements: []
165
162
  rubyforge_project:
166
- rubygems_version: 2.4.6
163
+ rubygems_version: 2.4.8
167
164
  signing_key:
168
165
  specification_version: 4
169
166
  summary: Wrapper around jquery-datatables.
170
167
  test_files:
171
- - spec/lib/tablets/data_spec.rb
172
- - spec/lib/tablets/utils/config_spec.rb
173
- - spec/lib/tablets/view_helpers_spec.rb
174
- - spec/lib/tablets/renderer_spec.rb
168
+ - spec/spec_helper.rb
175
169
  - spec/lib/tablets/data/processing/base_spec.rb
176
- - spec/lib/tablets/data/processing/order_spec.rb
177
- - spec/lib/tablets/data/processing/filter_spec.rb
178
170
  - spec/lib/tablets/data/processing/paginate_spec.rb
179
171
  - spec/lib/tablets/data/query_spec.rb
180
- - spec/lib/tablets/global/loader_spec.rb
181
172
  - spec/lib/tablets/global/store_spec.rb
182
173
  - spec/lib/tablets/global/configurator_spec.rb
183
- - spec/spec_helper.rb
174
+ - spec/lib/tablets/global/loader_spec.rb
175
+ - spec/lib/tablets/view_helpers_spec.rb
176
+ - spec/lib/tablets/utils/config_spec.rb
177
+ - spec/lib/tablets/renderer_spec.rb
@@ -1,9 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'tablets/data/processing/filter'
4
-
5
- RSpec.describe Tablets::Data::Processing::Filter do
6
- subject { described_class.new(params, columns) }
7
-
8
- let(:columns) { :columns }
9
- end
@@ -1,9 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'tablets/data/processing/order'
4
-
5
- RSpec.describe Tablets::Data::Processing::Order do
6
- subject { described_class.new(params, columns) }
7
-
8
- let(:columns) { :columns }
9
- end
@@ -1,7 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'tablets/data'
4
-
5
- RSpec.describe Tablets::Data do
6
- subject { described_class.new(tablet, params) }
7
- end