Provides a read-only view tailored to the type of the object being viewed. <view> is a polymorphic tag which means that there are a variety of definitions, each one written for a particular type. For example there are views for
Boolean. The type specific view is enclosed in a wrapper tag (typically a
<div>) with some useful classes automatically added.
Assuming the context is a blog post…
Viewing a DateTime field:
<view:created_at/> -> <span class="view blog-post-created-at">June 09, 2008 15:36</span>
Viewing a String field:
<view:title/> -> <span class="view blog-post-title">My First Blog Post</span>
Viewing an Integer field:
<view:comment_count/> -> <span class="view blog-post-comment-count">4</span>
Viewing the blog post itself results in a link to the blog post (using Rapid’s <a> tag):
<view/> -> <span class="view model:blog-post-1"><a href="/blog_posts/1">My First Blog Post</a></span>
if-blank attribute can be used to provide alternate content if
force attribute causes the permission check to be skipped.
The wrapper tag is
<span>unless the field type is
String) where it is
<div>. Use the
blockattributes to force a
<view:body/> -> <div class="view blog-post-body">This is my blog post body</div> <view:body inline/> -> <span class="view blog-post-body">This is my blog post body</span> <view:created_at block/> -> <div class="view blog-post-created-at">June 09, 2008 15:36</div>
no-wrapperattribute to remove the wrapper tag completely. e.g.
<view:created_at no-wrapper/> -> June 09, 2008 15:36
Edit this page