Sha256: 7350e9cc8c340edf460d3797cb4785fd2cb5b888403a7a9af45bef22f58643e0
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
module Darkext module Sinatra module Helpers def view(view, options = {}) html = haml(view,options) flash.clear html end def partial(page, options = {}) # Can't make this use view() because of the flash.clear haml(page, options.merge!(:layout => false)) end def css_link_tag(sheet, media = 'screen,projection') partial("%link{ :type => 'text/css', :href => '/stylesheets/#{sheet}.css', :rel => 'stylesheet', :media => '#{media}' }") end def js_script_tag(script) partial("%script{ :type => 'text/javascript', :src => '/javascripts/#{script}.js' }") end def js_tag(script) temp = ["%script{ :type => 'text/javascript' }", " //<![CDATA[", " = #{script}", " //]]>"].join("\n") partial(temp) end def flash session[:flash] = {} if session[:flash] && session[:flash].class != Hash session[:flash] ||= {} end def host port = request.env['SERVER_PORT'] port = port == 80 ? "" : ":#{port}" "#{protocol}://#{server_name}#{port}" end def protocol request.env['rack.url_scheme'] end def server_name request.env['SERVER_NAME'] end def set_title(extra) @title = "#{options.site_name} - #{extra}" end def base "#{host}#{options.site_base}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
darkhelmet-darkext-0.8.1 | lib/darkext/sinatra.rb |