Skip to content
blizz edited this page Sep 12, 2010 · 4 revisions
Attribute Description Default Value Example
inline      
block      
if-blank      
no-wrapper      
truncate      

<view> tag defined in rapid.dryml


<def tag="view" attrs="inline, block, if-blank, no-wrapper, truncate"><%= raise HoboError, "view of non-viewable field '#{this_field}' of #{this_parent.typed_id rescue this_parent}" unless can_view? res = if this.nil? && if_blank.nil? this_type.is_a?(Class) && this_type <= String ? "" : nil_view elsif (refl = this_field_reflection) && refl.macro == :has_many has_many_view(attributes) else view_tag = find_polymorphic_tag(“view”) if view_tag == “view” # i.e. it didn’t find a type specific tag if this.respond_to?(:to_html) this.to_html(scope.xmldoctype) else this.to_s end else attrs = add_classes(attributes, “view”, type_and_field.?.dasherize, model_idclass) view_attrs = attrs_for(view_tag) the_view = send(view_tag, attrs & view_attrs) the_view = if_blank if if_blank && the_view.blank? truncate = 30 if truncate == true the_view = self.truncate(the_view, truncate.to_i) if truncate the_view = the_view.strip if no_wrapper the_view else wrapper = if inline :span elsif block || this.is_a?(HoboFields::Text) :div else :span end element(wrapper, attrs – view_attrs, the_view) end end end Hobo::Dryml.last_if = !res.blank? res

%>


Clone this wiki locally