Sha256: 92f9803b71b32a2e1aba74ee0fe7273f11d9cd2849a3bd31959d79ee29fb0ef5
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
require 'nitro/control/attribute' module Nitro # The base class for controls used to inspect object # relations. #-- # FIXME: this is a temp hack. # TODO: Fix mismatches with attributes. #++ class RelationControl < AttributeControl # === Input # # * object = the object to inspect # * symbol = the relation symbol # * anno = the relation annotations # * options = additional options def initialize object, rel, options @object = object @anno = rel @value = options[:value] || object.send(rel.name.to_sym) @options = options end def symbol @anno[:symbol] end def rel @anno end private # Emit the label for this control. # The label is skipped if the control is created with the # option :no_label set to true. #-- # TODO: reuse attribute control version. #++ def emit_label return '' if @options[:no_label] title = @anno[:title] || @options[:label] || @anno[:name].to_s.humanize %{<label for="#{@anno[:name]}">#{title}</label>} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.41.0 | lib/nitro/control/relation.rb |
nitro-0.40.0 | lib/nitro/control/relation.rb |