Module: Card::MachineInput
- Included in:
- Set::Type::CoffeeScript, Set::Type::Css, Set::Type::JavaScript, Set::Type::Skin
- Defined in:
- mod/03_machines/lib/card/machine_input.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Class Method Details
.included(host_class) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'mod/03_machines/lib/card/machine_input.rb', line 15 def self.included host_class host_class.extend( ClassMethods ) host_class.machines_wql = {} host_class.machine_input do format._render_raw end host_class.event "after_machine_input_updated_#{host_class.name.gsub(':','_')}".to_sym, :after=>:extend, :on => :save do machines = Card.search( {:right_plus => [{:codename => "machine_input"}, {:link_to => name}]}.merge(host_class.machines_wql) ) machines.each do |item| item.reset_machine_output! if item.kind_of? Machine end end host_class.event "before_machine_input_deleted_#{host_class.name.gsub(':','_')}".to_sym, :after=>:approve, :on => :delete do @involved_machines = Card.search( {:right_plus => [{:codename => "machine_input"}, {:link_to => name}]}.merge(host_class.machines_wql) ) end host_class.event "after_machine_input_deleted_#{host_class.name.gsub(':','_')}".to_sym, :after=>:store_subcards, :on => :delete do @involved_machines.each do |item| item.reset_machine_output! if item.kind_of? Machine end end end |