Sha256: e7eb13b3bc29738979ae93125317a7cf84415aebee0eb78bfeb8c4d5f6e7504b

Contents?: true

Size: 855 Bytes

Versions: 22

Compression:

Stored size: 855 Bytes

Contents

#!/usr/bin/env ruby

require 'sinatra/base'

module Sinatra
  module LinkToHelper
    # from http://gist.github.com/98310
    def link_to(url_fragment, mode=:path_only)
      case mode
      when :path_only
        base = request.script_name
      when :full_url
        if (request.scheme == 'http' && request.port == 80 ||
            request.scheme == 'https' && request.port == 443)
          port = ""
        else
          port = ":#{request.port}"
        end
        base = "#{request.scheme}://#{request.host}#{port}#{request.script_name}"
      else
        raise "Unknown script_url mode #{mode}"
      end
      "#{base}#{url_fragment}"
    end
  end

  module PageTitleHelper
    def page_title(string)
      @page_title = string
    end

    def include_page_title
      @page_title ? "#{@page_title} | Visage" : "Visage"
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
visage-app-1.0.0 lib/visage-app/helpers.rb
visage-app-0.9.6 lib/visage-app/helpers.rb
visage-app-0.9.5 lib/visage-app/helpers.rb
visage-app-0.9.4 lib/visage-app/helpers.rb
visage-app-0.9.3 lib/visage-app/helpers.rb
visage-app-0.9.2 lib/visage-app/helpers.rb
visage-app-0.9.1 lib/visage-app/helpers.rb
visage-app-0.9.0.pre2 lib/visage-app/helpers.rb
visage-app-0.9.0 lib/visage-app/helpers.rb
visage-app-0.9.0.pre1 lib/visage-app/helpers.rb
visage-app-0.3.3 lib/visage-app/helpers.rb
visage-app-0.3.2 lib/visage/helpers.rb
visage-app-0.3.1 lib/visage/helpers.rb
visage-app-0.3.0 lib/visage/helpers.rb
visage-app-0.2.7 lib/visage/helpers.rb
visage-app-0.2.6 lib/visage/helpers.rb
visage-app-0.2.5 lib/visage/helpers.rb
visage-app-0.2.4 lib/visage/helpers.rb
visage-app-0.2.3 lib/visage/helpers.rb
visage-app-0.2.2 lib/visage/helpers.rb