aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers/application_helper.rb
blob: 3b5bfdfdab69078f159941e59527422b89b67d1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module ApplicationHelper

  def selected_referential?
    @referential.present? and not @referential.new_record?
  end

  def polymorphic_path_patch( source)
    relative_url_root = Rails.application.config.relative_url_root
    relative_url_root && !source.starts_with?("#{relative_url_root}/") ? "#{relative_url_root}#{source}" : source
  end
  def assets_path_patch( source)
    relative_url_root = Rails.application.config.relative_url_root
    return "/assets/#{source}" unless relative_url_root
    "#{relative_url_root}/assets/#{source}"
  end
  

  def help_page?
    controller_name == "help"
  end

  def test_sheet_page?
    controller_name == "test_sheet"
  end

  def help_path
    url_for(:controller => "/help", :action => "show") + '/'
  end
  
  def test_sheet_path
    url_for(:controller => "/test_sheet", :action => "show") + '/'
  end
  
end