Preview
Represents an annotated ViewComponent preview class.
Attributes
.id | Unique ID for the preview |
.label | Label for the preview, used in navigation |
.path | Unique preview reference path. |
.url_path | URL path of the preview |
.file_path | Absolute filesystem path to the preview class file |
.examples | Array of all the preview examples defined in the preview class |
.components | Array of all the components used in the preview - usually just one! |
.component | The first (and normally only) component used in the preview |
.type | The entity type. Returns |
Methods
.tags
Returns an array of tag objects representing all tags that have been applied of the specified type.
If no tag type is provided then all tags are returned.
preview.tags(<tag_type?>)
<tag_type?> | Optional tag type to filter by - e.g. |
<ul id="todo-list">
<% preview.tags(:todo).each do |todo| %>
<li><%= todo.task %></li>
<% end %>
</ul>
.tag
Returns the first Tag of type <tag_type>
that has been applied.
preview.tag(<tag_type?>)
<tag_type?> | Optional tag type to filter by - e.g. |
<p>Preview status: "<%= preview.tag(:status).label %>"</p>