Sha256: f9e49a5c4443b90582576ebf5e343eef35eac7644520957e43828885cd3433b2

Contents?: true

Size: 916 Bytes

Versions: 96

Compression:

Stored size: 916 Bytes

Contents

module Sinatra
  module RbbtToolHelper
    def tool(toolname, options = {})
      options[:id] ||= toolname.to_s + "_#{rand(10000)}"

      template_file = locate_template("tools/#{toolname}")
      Log.debug "Loading tool #{toolname} from: #{template_file}"
      content = Tilt::HamlTemplate.new(template_file, :filename => template_file, :ugly => production?).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

96 entries across 96 versions & 1 rubygems

Version Path
rbbt-rest-1.8.56 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.55 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.53 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.52 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.51 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.50 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.49 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.48 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.47 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.46 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.45 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.44 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.43 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.42 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.41 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.40 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.38 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.37 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.36 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.8.35 lib/rbbt/rest/web_tool.rb