module Sinatra::RbbtToolHelper
Public Instance Methods
tool(toolname, options = {}, &block)
click to toggle source
# File lib/rbbt/rest/web_tool.rb, line 4 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