Skip to content

Commit

Permalink
[FEATURE] added table cell, passing :l as an attribute parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
agustibr committed Jun 29, 2017
1 parent de4ac01 commit 60af1c1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Changelog

## version 0.1.11.beta to be released
## version 0.1.12.beta to be released

- ...

## version 0.1.11.beta

- added `localized` table cell, passing :l as an attribute parameter

## version 0.1.10.beta

- fix table_for_cell_for_image_image_class in helper
Expand Down
10 changes: 9 additions & 1 deletion app/helpers/ct_table_for/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ def table_for_cell model, record, attribute, cell_options: {}
elsif defined?(Paperclip) and value.is_a?(Paperclip::Attachment)
html << table_for_cell_for_image( record, attribute, cell_options: cell_options )
else
html << value.to_s.truncate(50, separator: " ")
if cell_options.include? "l"
html << table_for_cell_for_locale(model, attribute, value)
else
html << value.to_s.truncate(50, separator: " ")
end
end
end
html << %Q{</td>}
Expand All @@ -133,6 +137,10 @@ def table_for_cell_for_image record, attribute, cell_options: {}
html << image_tag(record.send(attribute).url(size), class: CtTableFor.table_for_cell_for_image_image_class, style: "max-height: 100px;")
html.html_safe
end

def table_for_cell_for_locale model, attribute, value, cell_options: {}
html = model.human_attribute_name("#{attribute.underscore}.#{value.underscore}")
end


def table_for_actions(record, options: {} )
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 = '0.1.10.beta'
VERSION = '0.1.11.beta'
end

0 comments on commit 60af1c1

Please sign in to comment.