module Olelo::ApplicationHelper

Public Instance Methods

action?(action) click to toggle source
# File lib/olelo/helper.rb, line 294
def action?(action)
  if params[:action]
    params[:action].split('-', 2).first == action.to_s
  else
    unescape(request.path_info).starts_with?("/#{action}")
  end
end
build_static_path(path) click to toggle source
# File lib/olelo/helper.rb, line 318
def build_static_path(path)
  file = File.join(Config['app_path'], 'static', path)
  build_path "static-#{File.mtime(file).to_i}/#{path}"
end
head() click to toggle source
# File lib/olelo/helper.rb, line 323
    def head
      @@head_links ||= %{<link rel="shortcut icon" href="#{escape_html build_static_path('favicon.png')}" type="image/png"/>
<link rel="stylesheet" href="#{escape_html build_static_path("themes/#{Config['theme']}/style.css")}" type="text/css"/>
<script src="#{escape_html build_static_path("script.js")}" type="text/javascript"></script>}
      # Add base path to root page to fix links in history browsing and for wikis with base_path
      base_path = if request.path_info =~ %r{^/version/[^/]+$} ||
                      (request.path_info == '/' && Config['base_path'] != '/')
        url = request.base_url << [Config['base_path'], '/', request.path_info, '/'].join.gsub(%r{/+}, '/')
        %{<base href="#{escape_html url}"/>}
      end
      [base_path, @@head_links, *invoke_hook(:head)].join.html_safe
    end
menu(name) click to toggle source
render(name, options = {}) click to toggle source
# File lib/olelo/helper.rb, line 348
def render(name, options = {})
  layout = options.delete(:layout) != false && !params[:no_layout]
  output = Symbol === name ? render_partial(name, options) : name
  output = render_partial(:layout, options) { output } if layout
  invoke_hook :render, name, output, layout
  output
end
Also aliased as: render_partial
render_partial(name, options = {})
Alias for: render
session() click to toggle source
# File lib/olelo/helper.rb, line 336
def session
  env['rack.session'] ||= {}
end
tabs(*actions) click to toggle source
# File lib/olelo/helper.rb, line 287
def tabs(*actions)
  tabs = actions.map do |action|
    %{<li id="tabhead-#{action}"#{action?(action) ? ' class="selected"' : ''}><a href="#tab-#{action}">#{escape_html action.t}</a></li>}
  end
  %{<ul class="tabs">#{tabs.join}</ul>}.html_safe
end
title(content = nil, &block) click to toggle source
# File lib/olelo/helper.rb, line 310
def title(content = nil, &block)
  if block_given? || content
    define_block(:title, content, &block)
  else
    render_block(:title)
  end
end