Sha256: ae9332ad8939c00cf30547cc12d8cefaf360f6bf2b491a45e50af0f4910d4ddd
Contents?: true
Size: 1.58 KB
Versions: 1
Compression:
Stored size: 1.58 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') @dsh_sheet = sheet @dsh_media = media partial('%link{ :type => "text/css", :href => "/stylesheets/#{@dsh_sheet}.css", :rel => "stylesheet", :media => "#{@dsh_media}" }') end def js_script_tag(script) @dsh_script = script partial('%script{ :type => "text/javascript", :src => "/javascripts/#{@dsh_script}.js" }') end def js_tag(script) @dsh_script = script temp = ["%script{ :type => 'text/javascript' }", " //<![CDATA[", " = @dsh_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.0 | lib/darkext/sinatra.rb |