Module: Admin::HelpHelper

Defined in:
app/helpers/admin/help_helper.rb

Instance Method Summary collapse

Instance Method Details

#admin_help(&block) ⇒ Object

This code doesn’t work… ready for more roles when they appear in Radiant %developer.each do |role|

define_method("#{role}_help") do |block|
   yield block if "#{role}?"
end

end



10
11
12
# File 'app/helpers/admin/help_helper.rb', line 10

def admin_help(&block)
  yield if admin?
end

#all_tagsObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/helpers/admin/help_helper.rb', line 27

def all_tags
  tags = {}
  page_classes = [Page.descendants, Page].flatten
  page_classes.each do |page_class| 
    page_class.tag_descriptions.each do |name, details| 
      if tags[name]
        tags[name][:classes] << page_class.to_s
      else
        tags[name] = {:description => details, :classes => [page_class.to_s]}
      end
    end
  end
  tags
end

#designer_help(&block) ⇒ Object



14
15
16
# File 'app/helpers/admin/help_helper.rb', line 14

def designer_help(&block)
  yield if designer?
end

#doc_extension_dir(doc) ⇒ Object



18
19
20
21
22
23
24
25
# File 'app/helpers/admin/help_helper.rb', line 18

def doc_extension_dir(doc)
  dir = doc[/[(\w+)]\/(\w+)\/HELP/, 1] # vendored
  if dir.blank?                        # gemified
    path_ary = doc.split('/')
    dir = path_ary[path_ary.count-2].sub('radiant-','').sub(/-extension-.*/,'')
  end
  dir
end