module Fiona7 class EditingEnvCheck def initialize(env) self.env = env self.editing_context = self.env[Scrivito::EditingContextMiddleware::ENVKEY] end def rtc_selected? editing_context && editing_context.authenticated_editor? && selected_workspace_id == 'rtc' end def editing_mode? rtc_selected? && editing_context && editing_context.authenticated_editor? && selected_display_mode == 'editing' end protected attr_accessor :env attr_accessor :editing_context private def selected_workspace_id # NOTE: this does not require workspace lookup/load_obj # and thus is potentially faster self.editing_context.instance_variable_get(:@selected_workspace_id).to_s end def selected_display_mode # NOTE: this does not require workspace lookup/load_obj # and thus is potentially faster self.editing_context.instance_variable_get(:@display_mode).to_s end end end