Sha256: 495e12e1c50cd47072ac1e09e117272902928566289648621df24f4cb50e5698

Contents?: true

Size: 541 Bytes

Versions: 30

Compression:

Stored size: 541 Bytes

Contents

class Tool
  include ActiveModel::Validations

  ALL = ['LineMeasureTool', 'AreaMeasureTool',
    'PrevTool', 'NextTool', 'LinkTool', 'PrintTool',
    'ExportTool', 'SelectTool'] #, 'EditTool'

  validates_presence_of :topic, :name

  attr_accessor :topic, :name

  def initialize(topic, name)
    @topic, @name = topic, name
  end

  def self.accessible_tools(topic, ability)
    tools = ALL.select do |tool|
      ability.can?(:show, Tool.new(topic, tool))
    end
    tools << 'EditTool' if ability.can?(:edit, topic)
    tools
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
gb_mapfish_appserver-2.0.0 app/models/tool.rb
gb_mapfish_appserver-1.1.1 app/models/tool.rb
gb_mapfish_appserver-1.1.0 app/models/tool.rb
gb_mapfish_appserver-1.0.6 app/models/tool.rb
gb_mapfish_appserver-1.0.5 app/models/tool.rb
gb_mapfish_appserver-1.0.4 app/models/tool.rb
gb_mapfish_appserver-1.0.3 app/models/tool.rb
gb_mapfish_appserver-1.0.2 app/models/tool.rb
gb_mapfish_appserver-1.0.1 app/models/tool.rb
gb_mapfish_appserver-1.0.0 app/models/tool.rb
gb_mapfish_appserver-0.9.7 app/models/tool.rb
gb_mapfish_appserver-0.9.6 app/models/tool.rb
gb_mapfish_appserver-0.9.5 app/models/tool.rb
gb_mapfish_appserver-0.9.4 app/models/tool.rb
gb_mapfish_appserver-0.9.3 app/models/tool.rb
gb_mapfish_appserver-0.9.2 app/models/tool.rb
gb_mapfish_appserver-0.9.1 app/models/tool.rb
gb_mapfish_appserver-0.9.0 app/models/tool.rb
gb_mapfish_appserver-0.8.7 app/models/tool.rb
gb_mapfish_appserver-0.8.6 app/models/tool.rb