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.7.13 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.7.12 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.7.11 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.7.10 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.7.9 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.7.8 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.7.7 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.7.6 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.7.5 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.7.4 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.7.3 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.7.2 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.7.1 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.7.0 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.6.28 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.6.26 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.6.25 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.6.24 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.6.23 lib/rbbt/rest/web_tool.rb
rbbt-rest-1.6.22 lib/rbbt/rest/web_tool.rb