2015-07-25 14:28:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
class InstructionView
|
|
|
|
|
|
|
|
include React::Component
|
|
|
|
required_param :interpreter
|
|
|
|
required_param :instruction
|
|
|
|
|
|
|
|
define_state :active => ""
|
|
|
|
|
|
|
|
before_mount do
|
2015-07-25 20:04:20 +02:00
|
|
|
check_active interpreter.instruction
|
2015-07-25 14:28:59 +02:00
|
|
|
end
|
|
|
|
|
2015-07-25 20:04:20 +02:00
|
|
|
def check_active i
|
2015-07-27 20:29:41 +02:00
|
|
|
active! instruction == i ? "bright" : ""
|
2015-07-25 20:04:20 +02:00
|
|
|
|
|
|
|
end
|
2015-07-25 14:28:59 +02:00
|
|
|
def instruction_changed old , ins
|
2015-07-25 20:04:20 +02:00
|
|
|
check_active ins
|
2015-07-25 14:28:59 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def render
|
|
|
|
div :class => active do
|
2015-07-27 20:29:41 +02:00
|
|
|
instruction.to_s if instruction
|
2015-07-25 14:28:59 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|