Skip to content

Commit

Permalink
add class to td and upgrade version for a new release (#21)
Browse files Browse the repository at this point in the history
* add class to td and upgrade version for a new release

* apply requested changes and doc

* add custom class to actions
  • Loading branch information
Isaac Massot authored and agustibr committed Sep 26, 2019
1 parent c8319d5 commit cd66201
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Changelog

## version 1.0.4 to be released
## version 1.0.5 to be released

- ...

## version 1.0.3 to
## version 1.0.4

- add class to td, for custom styles

## version 1.0.3

- fix allow currency and sortable attributes work together
- fix display format of data time
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ CtTableFor.setup do |config|
config.table_for_truncate_length = 50
config.table_for_truncate_separator = " "
config.table_for_truncate_omission = "..."
config.table_for_td_default_prefix_class = "td-item"
end
```
You can also define the breakpoint in your `sass` before importing `table_for`:
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/ct_table_for/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def table_for_cell model, record, attribute, cell_options: {}
nil
end

html << %Q{<td data-title="#{model.human_attribute_name("#{attribute}")}">}
html << %Q{<td data-title="#{model.human_attribute_name("#{attribute}")}" class="#{CtTableFor.table_for_td_default_prefix_class}-#{attribute}">}
case value
when NilClass
html << %Q{<i class="fa fa-minus text-muted"></i>}
Expand Down Expand Up @@ -179,7 +179,7 @@ def table_for_cell_for_locale model, attribute, value, cell_options: {}
def table_for_actions(record, options: {} )
return "" if options[:actions].blank?
html = ""
html << %Q{<td data-link-enabled="false">}
html << %Q{<td data-link-enabled="false" class="#{CtTableFor.table_for_td_default_prefix_class}-actions">}
html << %Q{<div class="btn-group btn-group-sm" role="group" aria-label="#{I18n.t(:actions, scope: [:table_for]).capitalize}">}
nesting = (options[:actions][:premodel] || []) + [record]
buttons = options[:actions][:buttons].map{ |b| b.split("|")}
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ CtTableFor.setup do |config|
config.table_for_truncate_length = 50
config.table_for_truncate_separator = " "
config.table_for_truncate_omission = "..."
config.table_for_td_default_prefix_class = "td-item"
end
```
You can also define the breakpoint in your `sass` before importing `table_for`:
Expand Down
2 changes: 2 additions & 0 deletions lib/ct_table_for/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class << self
mattr_accessor :table_for_truncate_length
mattr_accessor :table_for_truncate_separator
mattr_accessor :table_for_truncate_omission
mattr_accessor :table_for_td_default_prefix_class

self.table_for_wrapper_default_class = "table-responsive"
self.table_for_default_class = "table table-striped table-bordered table-condensed table-hover"
Expand All @@ -25,6 +26,7 @@ class << self
self.table_for_truncate_length = 50
self.table_for_truncate_separator = " "
self.table_for_truncate_omission = "..."
self.table_for_td_default_prefix_class = "td-item"
end

# this function maps the vars from your app into your engine
Expand Down
2 changes: 1 addition & 1 deletion lib/ct_table_for/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CtTableFor
VERSION = '1.0.3'
VERSION = '1.0.4'
end

0 comments on commit cd66201

Please sign in to comment.