Sha256: f55a475b585e61b85e3a12a39f1efd0b37ea50ba68b86460f6b82899802c2ebe
Contents?: true
Size: 949 Bytes
Versions: 92
Compression:
Stored size: 949 Bytes
Contents
module Sinatra module RbbtToolHelper def tool(toolname, options = {}, &block) options[:id] ||= toolname.to_s + "_#{rand(10000)}" options[:block] = block if block_given? template_file = locate_template("tools/#{toolname}") Log.debug "Loading tool #{toolname} from: #{template_file}" content = Tilt::HamlTemplate.new(template_file, :filename => template_file).render(self, options) styles = begin path = locate_sass("tools/#{toolname}") link_css "/stylesheets/tools/#{toolname}" if path.exists? rescue Exception "" end javascript = begin path = locate_javascript("tools/#{toolname}") link_js "/js-find/tools/#{toolname}" if path.exists? rescue Exception "" end styles + content + javascript end end end
Version data entries
92 entries across 92 versions & 1 rubygems