Sha256: b9f7de085bc5a9d026f4b2eab4075eebf82dd436bee27f00f43807a8c5b51e68

Contents?: true

Size: 982 Bytes

Versions: 33

Compression:

Stored size: 982 Bytes

Contents

<!-- Renders the name of the current context using a variety of methods.

### Details

 - Equivalent to `<nil-view>` if `this` is nil
 - Equivalent to `<count>` if `this` is an Array
 - Equivalent to `<type-name>` if `this` is a class
 - If the context has a `name_attribute` defined, equivalent to `<view:abc/>` (where `abc` is the name attribute)
 - Finally falls back to `this.to_s` (html escaped), but only if the user has view permission for `this`

### Attributes

 - if-present: if given, nothing at all will be rendered for nil values (as opposed to rendering `<nil-view>`)

-->
<def tag="name" attrs="if-present"><%=
  if this.nil?
    nil_view unless if_present
  else
    if this.is_a?(Array)
      count
    elsif this.is_a?(Class)
      type_name(attributes)
    elsif (name_attr = this.class.try.name_attribute) && can_view?(this, name_attr)
      view(merge_attrs(attributes, {:field => name_attr}))
    elsif can_view?(this)
      h this.to_s
    end
  end
%></def>

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
hobo_rapid-2.2.6 taglibs/views/name.dryml
hobo_rapid-2.2.5 taglibs/views/name.dryml
hobo_rapid-2.2.4 taglibs/views/name.dryml
hobo_rapid-2.2.3 taglibs/views/name.dryml
hobo_rapid-2.2.2 taglibs/views/name.dryml
hobo_rapid-2.2.1 taglibs/views/name.dryml
hobo_rapid-2.2.0 taglibs/views/name.dryml
hobo_rapid-2.1.2 taglibs/views/name.dryml
hobo_rapid-2.1.1 taglibs/views/name.dryml
hobo_rapid-2.1.0 taglibs/views/name.dryml
hobo_rapid-2.1.0.pre4 taglibs/views/name.dryml
hobo_rapid-2.1.0.pre3 taglibs/views/name.dryml
hobo_rapid-2.1.0.pre2 taglibs/views/name.dryml
hobo_rapid-2.1.0.pre1 taglibs/views/name.dryml
hobo_rapid-2.0.1 taglibs/views/name.dryml
hobo_rapid-2.0.0 taglibs/views/name.dryml
hobo_rapid-2.0.0.pre10 taglibs/views/name.dryml
hobo_rapid-2.0.0.pre9 taglibs/views/name.dryml
hobo_rapid-2.0.0.pre8 taglibs/views/name.dryml
hobo_rapid-2.0.0.pre7 taglibs/views/name.dryml