Class: Admin::HelpController

Inherits:
ApplicationController
  • Object
show all
Includes:
ActiveSupport::CoreExtensions::String::Inflections
Defined in:
app/controllers/admin/help_controller.rb

Instance Method Summary collapse

Instance Method Details

#developingObject



42
43
44
# File 'app/controllers/admin/help_controller.rb', line 42

def developing
  
end

#extension_docObject



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'app/controllers/admin/help_controller.rb', line 46

def extension_doc
  @template_name = 'extension_doc'
  @role = params[:role].nil? ? 'all' : params[:role]
  @docs = HelpDoc.find_for(@role)
  if params[:extension_name] != 'all'
    @doc_name = params[:extension_name].titleize
    @doc_path = HelpDoc.find_for(@role,params[:extension_name]).first
  else
    @doc_path = @docs.first
    @doc_name = @template.doc_extension_dir(@doc_path).titleize
  end
  @doc = HelpDoc.formatted_contents_from(@doc_path)
end

#indexObject

only_allow_access_to :index, :show, :new, :create, :edit, :update, :remove, :destroy,

:when => :admin,
:denied_url => { :controller => 'help', :action => 'index' },
:denied_message => 'You must have administrative privileges to perform this action.'


9
10
11
12
13
14
15
16
# File 'app/controllers/admin/help_controller.rb', line 9

def index
  @role = 'all'
  @docs = HelpDoc.find_for(:all)
  @file_not_found_page = Page.find(:first, :conditions => {:class_name => 'FileNotFoundPage'})
  @layouts = Layout.find(:all)
  @filters = TextFilter.descendants.uniq
  @cms_name = Radiant::Config['admin.title']
end

#roleObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/admin/help_controller.rb', line 18

def role
  @template_name = 'role'
  if params[:role].nil?
    @role = 'all'
    flash[:error] = "Sorry. I couldn't find any documentation for your request so you've been redirected to this page."
    redirect_to help_url
    return
  else
    if params[:role] == 'admin' or params[:role] == 'designer'
      @role = params[:role]
    else
      @role = 'other'
      @custom_role = params[:role]
    end
  end
  if File.exists?("#{HelpExtension.root}/app/views/admin/help/_#{@role}_index.html.haml")
    @docs = HelpDoc.find_for(@role)
  else
    flash[:error] = "Information for the '#{@role}' role could not be found."
    redirect_to help_url
    return
  end
end