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-0.8.5 app/models/tool.rb
gb_mapfish_appserver-0.8.4 app/models/tool.rb
gb_mapfish_appserver-0.8.3 app/models/tool.rb
gb_mapfish_appserver-0.8.2 app/models/tool.rb
gb_mapfish_appserver-0.8.1 app/models/tool.rb
gb_mapfish_appserver-0.8.0 app/models/tool.rb
gb_mapfish_appserver-0.0.7 app/models/tool.rb
gb_mapfish_appserver-0.0.6 app/models/tool.rb
gb_mapfish_appserver-0.0.5 app/models/tool.rb
gb_mapfish_appserver-0.0.4 app/models/tool.rb