app/views/textreads/show.html.erb in mega_bar-0.0.1 vs app/views/textreads/show.html.erb in mega_bar-0.5.1
- old
+ new
@@ -1,12 +1,24 @@
-<%= obj.read_attribute(displayable_field[:field].field) %>
+<% value = textread[:truncation].to_i == 0 ? obj.read_attribute(field.field).to_s :
+ obj.read_attribute(field.field).to_s.truncate(textread[:truncation].to_i, {omission: textread[:truncation_format], separator: textread[:truncation_separator]}) %>
+
+
+<% if field_display.link_type == 'link_field_value' && field_display.format == 'textread' %>
+ <%= value %>
+<% elsif field.default_data_format_edit == 'textbox' && field.data_type == 'string' %>
+ <%= best_in_place obj, field.field, value: value %>
+<% elsif field.default_data_format_edit == 'textarea' && field.data_type == 'text'%>
+ <%= best_in_place obj, field.field, value: value, as: :textarea %>
+<% else %>
+ <%= value %>
+<% end %>