Sha256: be3b76bf066ca051075a990823a8557a0d4151f173042c3531820a612e7e28ed
Contents?: true
Size: 889 Bytes
Versions: 2
Compression:
Stored size: 889 Bytes
Contents
require 'nitro/control/attribute' module Nitro # Controls a Fixnum attribute that can contain discreet values # (options). # # === Example # # Pass a 'reverse' dictionary. Reverse to reuse the has for # easy rendering of labels. Dictionary to allow for ordered # keys. # # PRIORITY_VALUES = Dictionary[ # 0, :trivial, # 1, :minor, # 2, :major, # 3, :blocker # ] # # attr_accessor :priority, Fixnum, :control => :options, :options_data => PRIORITY_VALUES class OptionsControl < AttributeControl setting :style, :default => 'width: 100px', :doc => 'The default style' def render style = @anno.control_style || self.class.style data = @anno[:options_data] %{ #{emit_label} <select id="#{@attribute}_ctl" name="#{@attribute}"> #{options :labels => data.values, :values => data.keys, :selected => value} </select> } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.41.0 | lib/nitro/control/attribute/options.rb |
nitro-0.40.0 | lib/nitro/control/attribute/options.rb |