datagrid 1.5.7 → 1.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.markdown +5 -0
- data/VERSION +1 -1
- data/datagrid.gemspec +4 -4
- data/lib/datagrid/columns.rb +3 -11
- data/lib/datagrid/columns/column.rb +1 -1
- data/spec/datagrid/helper_spec.rb +15 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa302439fb009cb596541a3cd2c6d5d584dc973c
|
4
|
+
data.tar.gz: 53a5b714ec1ecc3279c7cd0fb278c7c4c150785d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72b9bb255878dafebf1a932ee8908fedeba902e306480ebe3a1792267c63f19ff61959336be9d7c48f4df9b8f922f24ba21c781e9c000708a632d1b45577f1ac
|
7
|
+
data.tar.gz: ec7577b30d0579b9ba106e220d4c89c2d2fb70bb83f33d31fce3feb4396a7bb28850ef81664187567696b585b26c2ef0873f2165859f36fe9d6233e3e092409d
|
data/Readme.markdown
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Datagrid
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/bogdan/datagrid.svg?branch=master)](https://travis-ci.org/bogdan/datagrid)
|
4
|
+
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fbogdan%2Fdatagrid.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fbogdan%2Fdatagrid?ref=badge_shield)
|
4
5
|
|
5
6
|
Ruby library that helps you to build and represent table-like data with:
|
6
7
|
|
@@ -197,3 +198,7 @@ Like datagrid?
|
|
197
198
|
Follow the repository on [GitHub](https://github.com/bogdan/datagrid).
|
198
199
|
|
199
200
|
Read [author blog](http://gusiev.com).
|
201
|
+
|
202
|
+
|
203
|
+
## License
|
204
|
+
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fbogdan%2Fdatagrid.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fbogdan%2Fdatagrid?ref=badge_large)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.8
|
data/datagrid.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: datagrid 1.5.
|
5
|
+
# stub: datagrid 1.5.8 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "datagrid".freeze
|
9
|
-
s.version = "1.5.
|
9
|
+
s.version = "1.5.8"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Bogdan Gusiev".freeze]
|
14
|
-
s.date = "2017-
|
14
|
+
s.date = "2017-12-12"
|
15
15
|
s.description = "This allows you to easily build datagrid aka data tables with sortable columns and filters".freeze
|
16
16
|
s.email = "agresso@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -130,7 +130,7 @@ Gem::Specification.new do |s|
|
|
130
130
|
s.homepage = "http://github.com/bogdan/datagrid".freeze
|
131
131
|
s.licenses = ["MIT".freeze]
|
132
132
|
s.required_ruby_version = Gem::Requirement.new(">= 2.0".freeze)
|
133
|
-
s.rubygems_version = "2.6.
|
133
|
+
s.rubygems_version = "2.6.14".freeze
|
134
134
|
s.summary = "Ruby gem to create datagrids".freeze
|
135
135
|
|
136
136
|
if s.respond_to? :specification_version then
|
data/lib/datagrid/columns.rb
CHANGED
@@ -313,8 +313,9 @@ module Datagrid
|
|
313
313
|
# grid.to_csv(:id, :name)
|
314
314
|
# grid.to_csv(:col_sep => ';')
|
315
315
|
def to_csv(*column_names)
|
316
|
+
require "csv"
|
316
317
|
options = column_names.extract_options!
|
317
|
-
|
318
|
+
CSV.generate(
|
318
319
|
{:headers => self.header(*column_names), :write_headers => true}.merge!(options)
|
319
320
|
) do |csv|
|
320
321
|
each_with_batches do |asset|
|
@@ -531,19 +532,10 @@ module Datagrid
|
|
531
532
|
end
|
532
533
|
end
|
533
534
|
|
534
|
-
def csv_class
|
535
|
-
if RUBY_VERSION >= "1.9"
|
536
|
-
require 'csv'
|
537
|
-
CSV
|
538
|
-
else
|
539
|
-
require "fastercsv"
|
540
|
-
FasterCSV
|
541
|
-
end
|
542
|
-
end
|
543
|
-
|
544
535
|
def value_from_html_block(context, asset, column)
|
545
536
|
args = []
|
546
537
|
remaining_arity = column.html_block.arity
|
538
|
+
asset = decorate(asset)
|
547
539
|
|
548
540
|
if column.data?
|
549
541
|
args << data_value(column, asset)
|
@@ -149,7 +149,7 @@ class Datagrid::Columns::Column
|
|
149
149
|
def preload
|
150
150
|
preload = options[:preload]
|
151
151
|
|
152
|
-
if
|
152
|
+
if preload == true && driver.can_preload?(driver.to_scope(grid_class.scope), name)
|
153
153
|
name
|
154
154
|
else
|
155
155
|
preload
|
@@ -599,6 +599,21 @@ describe Datagrid::Helper do
|
|
599
599
|
expect(subject.datagrid_value(report, :name, entry)).to eq("<a href=\"/profile\">Star</a>")
|
600
600
|
end
|
601
601
|
|
602
|
+
it "applies decorator" do
|
603
|
+
report = test_report do
|
604
|
+
scope {Entry}
|
605
|
+
decorate do |model|
|
606
|
+
Class.new(Struct.new(:model)) do
|
607
|
+
def name
|
608
|
+
model.name.upcase
|
609
|
+
end
|
610
|
+
end
|
611
|
+
end
|
612
|
+
column(:name, html: true)
|
613
|
+
end
|
614
|
+
entry = Entry.create!(name: 'hello')
|
615
|
+
expect(subject.datagrid_value(report, :name, entry)).to eq("HELLO")
|
616
|
+
end
|
602
617
|
end
|
603
618
|
|
604
619
|
describe ".datagrid_header" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datagrid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdan Gusiev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -300,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
300
300
|
version: '0'
|
301
301
|
requirements: []
|
302
302
|
rubyforge_project:
|
303
|
-
rubygems_version: 2.6.
|
303
|
+
rubygems_version: 2.6.14
|
304
304
|
signing_key:
|
305
305
|
specification_version: 4
|
306
306
|
summary: Ruby gem to create datagrids
|