Permalink
Browse files

removed :truncated

fixes #643
  • Loading branch information...
1 parent 77b4559 commit 105e84147b87c98c936a01ff195c6e5d7d600959 @bbenezech bbenezech committed with zbo Aug 5, 2011
View
@@ -44,6 +44,8 @@ If you have good reasons to think you found a *rails_admin* bug, submit a ticket
API Update Note
---------------
+:truncated? has been removed, use pretty_value instead to fine-tune the output of your field in show and list views.
+
Important notice about `BelongsToAssociation`:
In the DSL, they now must be referenced by the association name, not the child_key.
Considering:
@@ -130,7 +130,7 @@
- other_left = rails_admin_list_path(params.except("set").merge(:model_name => @abstract_model.to_param, :set => params[:set].to_i - 1))
%td.other.left{ :style => "#{'display: none' if @other.include?("left")}" }= link_to "...", other_left, :remote => true
- properties.map{|property| property.bind(:object, object)}.each do |property|
- %td{:class => "#{property.css_class}"}= ([:text, :string].include?(property.type) && property.truncated?) ? property.pretty_value.truncate(40) : property.pretty_value
+ %td{:class => "#{property.css_class}"}= property.pretty_value
- other_right = rails_admin_list_path(params.except("set").merge(:model_name => @abstract_model.to_param, :set => params[:set].to_i + 1))
%td.other.right{ :style => "#{'display: none' if @other.include?("right")}" }= link_to "...", other_right, :remote => true
%td.last
@@ -55,7 +55,7 @@ def column_css_class(*args, &block)
end
register_instance_option(:truncated?) do
- true
+ ActiveSupport::Deprecation.warn("'#{self.name}.truncated?' is deprecated, use '#{self.name}.pretty_value' instead", caller)
end
register_instance_option(:sortable) do
@@ -26,6 +26,10 @@ class String < RailsAdmin::Config::Fields::Base
text
end
+
+ register_instance_option(:pretty_value) do
+ bindings[:view].truncate(formatted_value.to_s, :length => 60)
+ end
register_instance_option(:html_attributes) do
{
@@ -20,6 +20,10 @@ class Text < RailsAdmin::Config::Fields::Base
register_instance_option(:ckeditor_config_js) do
"/javascripts/ckeditor/config.js"
end
+
+ register_instance_option(:pretty_value) do
+ bindings[:view].truncate(formatted_value.to_s, :length => 60)
+ end
register_instance_option(:html_attributes) do
{

0 comments on commit 105e841

Please sign in to comment.