effective_datatables 4.14.1 → 4.15.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 +4 -4
- data/app/helpers/effective_datatables_private_helper.rb +16 -1
- data/app/models/effective/datatable_value_tool.rb +1 -1
- data/app/models/effective/effective_datatable/csv.rb +11 -1
- data/app/models/effective/effective_datatable/dsl/datatable.rb +2 -2
- data/lib/effective_datatables/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e8e433f359f9879d96a6a5fc387d7a17bc00b7aa351c6d7e26ffc8b2bcccca10
         | 
| 4 | 
            +
              data.tar.gz: df96403a27342d13874832a107195ba75561410d08cf1893fccb75dceff79e80
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 623e9378a8787d73d6204ea0356382a1230d991634d2ae1c58fb8babfbae0fee872985e0ae052d12934fe1d673a3e142616fc58d0e03085ef3a08adce692f942
         | 
| 7 | 
            +
              data.tar.gz: 674f3b2d483621875d760834629d2c3964f0a6a006ec6b932466e0ee23580c1767a156ee5556ac6b5c0b40b525935dc906dca7e987e2c4bea2e6aa200f08a7bd
         | 
| @@ -59,10 +59,25 @@ module EffectiveDatatablesPrivateHelper | |
| 59 59 | 
             
                when :reorder
         | 
| 60 60 | 
             
                  content_tag(:span, t('effective_datatables.reorder'), style: 'display: none;')
         | 
| 61 61 | 
             
                else
         | 
| 62 | 
            -
                   | 
| 62 | 
            +
                  label = opts[:label].presence || datatable_human_attribute_name(datatable, name, opts)
         | 
| 63 | 
            +
                  content_tag(:span, label)
         | 
| 63 64 | 
             
                end
         | 
| 64 65 | 
             
              end
         | 
| 65 66 |  | 
| 67 | 
            +
              def datatable_human_attribute_name(datatable, name, opts)
         | 
| 68 | 
            +
                return (name.to_s.split('.').last || '').titleize unless datatable.active_record_collection?
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                case opts[:as]
         | 
| 71 | 
            +
                when :belongs_to
         | 
| 72 | 
            +
                  opts[:resource].human_name
         | 
| 73 | 
            +
                when :has_many
         | 
| 74 | 
            +
                  opts[:resource].human_plural_name
         | 
| 75 | 
            +
                else
         | 
| 76 | 
            +
                  datatable.collection_class.human_attribute_name(name)
         | 
| 77 | 
            +
                end
         | 
| 78 | 
            +
             | 
| 79 | 
            +
              end
         | 
| 80 | 
            +
             | 
| 66 81 | 
             
              def datatable_search_tag(datatable, name, opts)
         | 
| 67 82 | 
             
                return datatable_new_resource_button(datatable, name, opts) if name == :_actions
         | 
| 68 83 |  | 
| @@ -79,7 +79,7 @@ module Effective | |
| 79 79 | 
             
                def search_column(collection, original, column, index)
         | 
| 80 80 | 
             
                  Rails.logger.info "VALUE TOOL: search_column #{column.to_s} #{original} #{index}" if EffectiveDatatables.debug
         | 
| 81 81 |  | 
| 82 | 
            -
                  fuzzy = column[:search][: | 
| 82 | 
            +
                  fuzzy = (column[:search][:operation] == :matches)
         | 
| 83 83 |  | 
| 84 84 | 
             
                  term = Effective::Attribute.new(column[:as]).parse(original, name: column[:name])
         | 
| 85 85 | 
             
                  term_downcased = term.to_s.downcase
         | 
| @@ -15,7 +15,17 @@ module Effective | |
| 15 15 | 
             
                  end
         | 
| 16 16 |  | 
| 17 17 | 
             
                  def csv_header
         | 
| 18 | 
            -
                    columns.map  | 
| 18 | 
            +
                    columns.map do |name, opts|
         | 
| 19 | 
            +
                      opts[:label].presence || csv_human_attribute_name(name)
         | 
| 20 | 
            +
                    end
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                  def csv_human_attribute_name(name)
         | 
| 24 | 
            +
                    if active_record_collection?
         | 
| 25 | 
            +
                      collection_class.human_attribute_name(name)
         | 
| 26 | 
            +
                    else
         | 
| 27 | 
            +
                      (name.to_s.split('.').last || '')
         | 
| 28 | 
            +
                    end
         | 
| 19 29 | 
             
                  end
         | 
| 20 30 |  | 
| 21 31 | 
             
                  def csv_file
         | 
| @@ -51,7 +51,7 @@ module Effective | |
| 51 51 | 
             
                        csv: csv,
         | 
| 52 52 | 
             
                        format: (format if block_given?),
         | 
| 53 53 | 
             
                        index: nil,
         | 
| 54 | 
            -
                        label:  | 
| 54 | 
            +
                        label: label,
         | 
| 55 55 | 
             
                        name: name,
         | 
| 56 56 | 
             
                        partial: partial,
         | 
| 57 57 | 
             
                        partial_as: partial_as,
         | 
| @@ -80,7 +80,7 @@ module Effective | |
| 80 80 | 
             
                        csv: csv,
         | 
| 81 81 | 
             
                        format: nil,
         | 
| 82 82 | 
             
                        index: nil,
         | 
| 83 | 
            -
                        label:  | 
| 83 | 
            +
                        label: label,
         | 
| 84 84 | 
             
                        name: name,
         | 
| 85 85 | 
             
                        partial: partial,
         | 
| 86 86 | 
             
                        partial_as: partial_as,
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: effective_datatables
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 4. | 
| 4 | 
            +
              version: 4.15.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Code and Effect
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2023- | 
| 11 | 
            +
            date: 2023-02-09 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         |