Sha256: 59c8bdfce888cafc9c1e8d1d85e00ca5b6e534787fe6e1358001dad40ebfdc8c
Contents?: true
Size: 828 Bytes
Versions: 49
Compression:
Stored size: 828 Bytes
Contents
module Orange # Admin resource is a resource to help in building administration # panels. class AdminResource < Resource def afterLoad @links = {} end def add_link(section, *args) opts = args.extract_with_defaults(:position => 0) @links[section] = [] unless @links.has_key?(section) matches = @links[section].select{|i| i[:resource] == opts[:resource] && i[:text] == opts[:text]} return @links[section] unless matches.empty? @links[section].insert(opts.delete(:position), opts) @links[section].compact! @links[section].uniq! end def links(packet) @links.each do |k,section| section.each {|link| link[:href] = orange[:mapper].route_to(packet, link[:resource], link[:resource_args]) } end end end end
Version data entries
49 entries across 49 versions & 2 rubygems