Sha256: c1a2cb1138c34e6428bf0f1b9f69ed81aa82719514896e5a4aa13b554a67523f

Contents?: true

Size: 975 Bytes

Versions: 46

Compression:

Stored size: 975 Bytes

Contents

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

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
infopark_fiona7-1.2.0.0.0 lib/fiona7/editing_env_check.rb
infopark_fiona7-1.1.0.0.9 lib/fiona7/editing_env_check.rb
infopark_fiona7-1.1.0.0.8 lib/fiona7/editing_env_check.rb
infopark_fiona7-1.1.0.0.7 lib/fiona7/editing_env_check.rb
infopark_fiona7-1.1.0.0.6 lib/fiona7/editing_env_check.rb
infopark_fiona7-1.1.0.0.5 lib/fiona7/editing_env_check.rb
infopark_fiona7-1.1.0.0.4 lib/fiona7/editing_env_check.rb
infopark_fiona7-1.1.0.0.3 lib/fiona7/editing_env_check.rb
infopark_fiona7-1.1.0.0.2 lib/fiona7/editing_env_check.rb
infopark_fiona7-1.1.0.0.10 lib/fiona7/editing_env_check.rb
infopark_fiona7-1.1.0.0.1 lib/fiona7/editing_env_check.rb
infopark_fiona7-1.1.0.0.0 lib/fiona7/editing_env_check.rb
infopark_fiona7-0.71.1.9 lib/fiona7/editing_env_check.rb
infopark_fiona7-0.71.1.8 lib/fiona7/editing_env_check.rb
infopark_fiona7-0.71.1.7 lib/fiona7/editing_env_check.rb
infopark_fiona7-0.71.1.6 lib/fiona7/editing_env_check.rb
infopark_fiona7-0.71.1.5 lib/fiona7/editing_env_check.rb
infopark_fiona7-0.71.1.4 lib/fiona7/editing_env_check.rb
infopark_fiona7-0.71.1.3 lib/fiona7/editing_env_check.rb
infopark_fiona7-0.71.1.2 lib/fiona7/editing_env_check.rb