Sha256: 2239ed35d5f0a0259147c1da96828038d5f9d75b678dee4dbc17c1400c3d8d91
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
require 'surveyor/common' module Surveyor module Models module QuestionGroupMethods def self.included(base) # Associations base.send :has_many, :questions base.send :has_one, :dependency end include RenderText # Instance Methods def initialize(*args) super(*args) default_args end def default_args self.display_type ||= "inline" self.api_id ||= Surveyor::Common.generate_api_id end def renderer display_type.blank? ? :default : display_type.to_sym end def display_type=(val) write_attribute(:display_type, val.nil? ? nil : val.to_s) end def dependent? self.dependency != nil end def triggered?(response_set) dependent? ? self.dependency.is_met?(response_set) : true end def css_class(response_set) [(dependent? ? "g_dependent" : nil), (triggered?(response_set) ? nil : "g_hidden"), custom_class].compact.join(" ") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
surveyor-0.22.0 | lib/surveyor/models/question_group_methods.rb |