datagrid 1.6.3 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5f1043a8a905be92c309d00b6c0b107ebec35939c89b5766f5d7c43dbe2c584
4
- data.tar.gz: 8b4bd8b0130ef2fa83cebe7012386ffcdb4d9ba32d3e803080e4345d6eb74dee
3
+ metadata.gz: cae619097e4bcae30de30bf2b5e9dc949f197146f3b17c01f5a2e4edb17e5ecc
4
+ data.tar.gz: 61751f34844c4127b7fc47bbacdbb2656d61aa015f574855de2a23bfc2dffe4a
5
5
  SHA512:
6
- metadata.gz: 4c42259fe4c806e235d10610ab4b3681319d8f5712c73addc1d54f61d6e6cbd0447a967464f878464da2b54f60dc376acef5238cce1467a097d7cbf799beb51d
7
- data.tar.gz: 1ac692930c8a269190bc36ecce7c50cf1c1696fe5b9b6dc0644adfa59eb15a2bab77f4dac70a29633693e707e53ef29ed874eda6f6c82533ed441afe72a5d304
6
+ metadata.gz: 8bcea069b9bafc8b573226366a1abf194910d3fa5798711568b7106428d94ec915b141f23986094d8579ce8450328e1eb5b71932646c4224c0f1f7ac01f9718b
7
+ data.tar.gz: 7a40443171fe84d7b9f22daabdf2d1c182926fc69c9b47fde54e5a2271c394b8b5f7541a512e898c4e1472f93f4e94cf9cb90a7d47a9ad51113ee65efaf80610
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
+ ## 1.7.0
2
+
3
+ * Depend on `railties` instead of `rails` to prevent loading of unnecessary frameworks
4
+ * Bugfix `File.exist?` usage for ruby 3.0 [#307](https://github.com/bogdan/datagrid/issues/307)
5
+ * Drop support of old Ruby versions (< 2.7)
6
+ * Drop support of old Rails versions (< 6.0)
7
+
1
8
  ## 1.6.3
2
9
 
3
- * Fix usage of options spread operator for ruby 3.0 [#296](https://github.com/bogdan/datagrid/issues/296)
10
+ * Fix usage of options spread operator for Ruby 3.0 [#296](https://github.com/bogdan/datagrid/issues/296)
4
11
 
5
12
  ## 1.6.2
6
13
 
data/Readme.markdown CHANGED
@@ -1,6 +1,6 @@
1
1
  # Datagrid
2
2
 
3
- [![Build Status](https://travis-ci.org/bogdan/datagrid.svg?branch=master)](https://travis-ci.org/bogdan/datagrid)
3
+ [![Build Status](https://github.com/bogdan/datagrid/workflows/CI/badge.svg?branch=master)](https://github.com/bogdan/datagrid/actions)
4
4
 
5
5
  [![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)
6
6
 
@@ -27,7 +27,7 @@ Ruby library that helps you to build and represent table-like data with:
27
27
 
28
28
  * [Readme](/Readme.markdown) - this read-me for basic information
29
29
  * [Wiki](https://github.com/bogdan/datagrid/wiki) - general reference on how to use the gem
30
- * [Rdoc](https://rdoc.info/github/bogdan/datagrid) - API reference
30
+ * [Rdoc](https://rubydoc.info/gems/datagrid) - API reference
31
31
 
32
32
  ### Live Demo
33
33
 
data/datagrid.gemspec CHANGED
@@ -1,14 +1,12 @@
1
1
  # frozen_string_literal: true
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "datagrid/version"
2
+
3
+ require_relative "lib/datagrid/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
6
  s.name = "datagrid"
8
7
  s.version = Datagrid::VERSION
9
8
  s.require_paths = ["lib"]
10
9
  s.authors = ["Bogdan Gusiev"]
11
- s.date = "2020-09-07"
12
10
  s.summary = "Ruby gem to create datagrids"
13
11
  s.description = "This allows you to easily build datagrid aka data tables with sortable columns and filters"
14
12
  s.email = "agresso@gmail.com"
@@ -23,19 +21,17 @@ Gem::Specification.new do |s|
23
21
  "datagrid.gemspec",
24
22
  ]
25
23
  s.files += `git ls-files | grep -E '^(app|lib|templates)'`.split("\n")
26
- s.homepage = "http://github.com/bogdan/datagrid"
24
+ s.homepage = "https://github.com/bogdan/datagrid"
27
25
  s.licenses = ["MIT"]
28
- s.required_ruby_version = Gem::Requirement.new(">= 2.0")
29
- s.rubygems_version = "3.0.8"
30
- url = 'https://github.com/bogdan/datagrid'
26
+ s.required_ruby_version = Gem::Requirement.new(">= 2.7")
31
27
  s.metadata = {
32
- "homepage_uri" => url,
33
- "bug_tracker_uri" => "#{url}/issues",
34
- "documentation_uri" => "#{url}/wiki",
35
- "changelog_uri" => "#{url}/blob/master/CHANGELOG.md",
36
- "source_code_uri" => url,
28
+ "homepage_uri" => s.homepage,
29
+ "bug_tracker_uri" => "#{s.homepage}/issues",
30
+ "documentation_uri" => "#{s.homepage}/wiki",
31
+ "changelog_uri" => "#{s.homepage}/blob/master/CHANGELOG.md",
32
+ "source_code_uri" => s.homepage,
37
33
  }
38
34
 
39
- s.add_dependency(%q<rails>, [">= 4.0"])
35
+ s.add_dependency "railties", ">= 6.0"
40
36
  end
41
37
 
@@ -1,10 +1,7 @@
1
-
2
1
  module Datagrid
3
-
4
2
  # Required to be ActiveModel compatible
5
- # @private
6
- module ActiveModel #:nodoc:
7
-
3
+ module ActiveModel
4
+ # @!visibility private
8
5
  def self.included(base)
9
6
  base.extend ClassMethods
10
7
  base.class_eval do
@@ -18,41 +15,40 @@ module Datagrid
18
15
  extend ::ActiveModel::AttributesAssignment
19
16
  rescue LoadError
20
17
  end
21
-
22
18
  end
23
- base.send :include, InstanceMethods
24
- end # self.included
19
+ end
25
20
 
26
21
  module ClassMethods
22
+ # @return [String] URL query parameter name of the grid class
27
23
  def param_name
28
24
  self.to_s.underscore.tr('/', '_')
29
25
  end
30
- end # ClassMethods
26
+ end
31
27
 
32
- module InstanceMethods
33
- def param_name
34
- self.class.param_name
35
- end
28
+ # @return [String] URL query parameter name of the grid class
29
+ def param_name
30
+ self.class.param_name
31
+ end
36
32
 
37
- def param_key
38
- param_name
39
- end
33
+ # @return [String] URL query parameter name of the grid class
34
+ def param_key
35
+ param_name
36
+ end
40
37
 
41
- def to_key
42
- [self.class.param_name]
43
- end
38
+ def to_key
39
+ [self.class.param_name]
40
+ end
44
41
 
45
- def persisted?
46
- false
47
- end
42
+ def persisted?
43
+ false
44
+ end
48
45
 
49
- def to_model
50
- self
51
- end
46
+ def to_model
47
+ self
48
+ end
52
49
 
53
- def to_param
54
- self.param_name
55
- end
56
- end # InstanceMethods
50
+ def to_param
51
+ self.param_name
52
+ end
57
53
  end
58
54
  end
@@ -21,11 +21,9 @@ module Datagrid
21
21
  # will always present in the grid table and won't be listed
22
22
  # in column names selection
23
23
  # Accepts same options as <tt>:enum</tt> filter
24
- #
25
- # Examples:
26
- #
24
+ # @example
27
25
  # column_names_filter(header: "Choose columns")
28
- #
26
+ # @see Datagrid::Filters::ClassMethods#filter
29
27
  def column_names_filter(**options)
30
28
  filter(
31
29
  :column_names, :enum,
@@ -37,24 +35,28 @@ module Datagrid
37
35
  end
38
36
  end
39
37
 
40
- def columns(*args, **options) #:nodoc:
38
+ # @!visibility private
39
+ def columns(*args, **options)
41
40
  super(*selected_column_names(*args), **options)
42
41
  end
43
42
 
44
- # Returns a list of enabled columns with <tt>:mandatory => true</tt> option
43
+ # Returns a list of enabled columns with <tt>mandatory: true</tt> option
45
44
  # If no mandatory columns specified than all of them considered mandatory
45
+ # @return [Array<Datagrid::Columns::Column>]
46
46
  def mandatory_columns
47
47
  available_columns.select {|c| c.mandatory? }
48
48
  end
49
49
 
50
50
  # Returns a list of enabled columns without <tt>:mandatory => true</tt> option
51
+ # If no mandatory columns specified than all of them considered mandatory but not optional
52
+ # @return [Array<Datagrid::Columns::Column>]
51
53
  def optional_columns
52
54
  available_columns - mandatory_columns
53
55
  end
54
56
 
55
57
  protected
56
58
 
57
- def optional_columns_select #:nodoc:
59
+ def optional_columns_select
58
60
  optional_columns.map {|c| [c.header, c.name] }
59
61
  end
60
62
 
@@ -1,6 +1,8 @@
1
1
  class Datagrid::Columns::Column
2
2
 
3
- class ResponseFormat # :nodoc:
3
+ # Datagrid class holding an information of
4
+ # how a column should be rendered in data/console/csv format and HTML format
5
+ class ResponseFormat
4
6
 
5
7
  attr_accessor :data_block, :html_block
6
8