Sha256: 66ee0204b40d8c14e4db093e6b01bd8b476ece9a8492c1befdfeb87b5da4c5cd
Contents?: true
Size: 1018 Bytes
Versions: 41
Compression:
Stored size: 1018 Bytes
Contents
module Spider; module Components class Confirm < Spider::Widget tag 'confirm' is_attr_accessor :actions def prepare @scene.params = collapse_params(@request.params) if (!@actions) add_action('_w'+param_name(self)+'[cancel]', 'Cancel') add_action('_w'+param_name(self)+'[ok]', 'Ok') end end def add_action(name, value) @actions ||= [] @actions << [name, value] end def collapse_params(h, first=true) res = {} h.each do |k, v| res_key = first ? k : "[#{k}]" if (v.is_a?(Hash)) collapse_params(v, false).each do |v_k, v_v| res["#{res_key}#{v_k}"] = v_v end else res[res_key] = v end end return res end end end; end
Version data entries
41 entries across 41 versions & 1 rubygems