Sha256: 983b2aa85763340e117d170090be2037d7bc024dc3ebe4a0282428e25673b2c8

Contents?: true

Size: 560 Bytes

Versions: 60

Compression:

Stored size: 560 Bytes

Contents

module ClarkKent
  class SharingScope

    attr_accessor :parent

    def initialize(record, parent)
      @record = record
      @parent = parent
    end

    def dom_id
      str = parent.type
      str += "_#{@record.id}" if @record.respond_to? :id
      str += "_reports"
    end

    def human_name
      if @record.respond_to? :name
        @record.name
      else
        @record
      end
    end

    def reports
      if 'Everyone' == @record
        ClarkKent::Report.shared
      else
        @record.clark_kent_reports
      end
    end

  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
clark_kent-0.11.3 app/models/clark_kent/sharing_scope.rb
clark_kent-0.11.2 app/models/clark_kent/sharing_scope.rb
clark_kent-0.11.1 app/models/clark_kent/sharing_scope.rb
clark_kent-0.11.0 app/models/clark_kent/sharing_scope.rb
clark_kent-0.10.4 app/models/clark_kent/sharing_scope.rb
clark_kent-0.10.2 app/models/clark_kent/sharing_scope.rb
clark_kent-0.10.1 app/models/clark_kent/sharing_scope.rb
clark_kent-0.10.0 app/models/clark_kent/sharing_scope.rb
clark_kent-0.9.9 app/models/clark_kent/sharing_scope.rb
clark_kent-0.9.8 app/models/clark_kent/sharing_scope.rb
clark_kent-0.9.7 app/models/clark_kent/sharing_scope.rb
clark_kent-0.9.6 app/models/clark_kent/sharing_scope.rb
clark_kent-0.9.5 app/models/clark_kent/sharing_scope.rb
clark_kent-0.9.4 app/models/clark_kent/sharing_scope.rb
clark_kent-0.9.2 app/models/clark_kent/sharing_scope.rb
clark_kent-0.9.1 app/models/clark_kent/sharing_scope.rb
clark_kent-0.9.0 app/models/clark_kent/sharing_scope.rb
clark_kent-0.8.11 app/models/clark_kent/sharing_scope.rb
clark_kent-0.8.10 app/models/clark_kent/sharing_scope.rb
clark_kent-0.8.9 app/models/clark_kent/sharing_scope.rb