Permalink
Browse files

cleaning up support for rdoc files... still needs work

  • Loading branch information...
1 parent edcff47 commit 5bdbb10144f92463fa609902153adccdcfa0d5b1 @saturnflyer saturnflyer committed Jun 17, 2008
@@ -12,6 +12,7 @@ class Admin::HelpController < ApplicationController
:denied_message => 'You must have admin privileges to access this information.'
def index
+ @rdocs = HelpRdoc.find(:all)
@file_not_found_page = Page.find(:first, :conditions => {:class_name => 'FileNotFoundPage'})
@layouts = Layout.find(:all)
@filters = TextFilter.descendants.uniq
@@ -33,6 +34,10 @@ def show
render :action => 'unknown'
end
+ def docs
+ @rdoc = HelpRdoc.find(:all, params[:extension_name])
+ end
+
def unknown
end
View
@@ -1,16 +1,12 @@
class HelpRdoc
def self.find(which, extension_dir='**')
results = []
- rdoc_type = ""
- unless which == 'all'
- rdoc_type = "_#{which}"
+ doc_type = ''
+ unless which.to_s == 'all'
+ doc_type = "_#{which.to_s}"
end
- [:admin, :developer, :all].each do |type|
- if which.to_sym == type
- Dir["#{RAILS_ROOT}/vendor/extensions/#{extension_dir}/HELP#{rdoc_type}.rdoc"].each do |ext|
- results << ext
- end
- end
+ Dir["#{RAILS_ROOT}/vendor/extensions/#{extension_dir}/HELP#{doc_type}.rdoc"].each do |ext|
+ results << ext
end
if extension_dir == '**'
results
@@ -0,0 +1 @@
+= link_to rdoc
@@ -0,0 +1,3 @@
+%p
+ The following documents have been installed for
+ = @name
@@ -1,2 +1,3 @@
= render :partial => 'help_nav'
-= RedCloth.new(File.read(@rdoc)).to_html(:markdown)
+- r = ::RedCloth.new(File.read(@rdoc))
+= r.to_html(:markdown)
@@ -1,6 +1,3 @@
-- @rdocs.each do |ext|
- = RedCloth.new(File.read(ext)).to_html(:markdown)
-
.Help
= render :partial => 'help_nav'
%h1 Developing for Radiant
@@ -0,0 +1,3 @@
+= render :partial => 'help_nav'
+- r = ::RedCloth.new(File.read(@rdoc))
+= r.to_html(:markdown)
@@ -18,7 +18,7 @@
a:hover
:color #000
:background #fff
- .Extensions
+ .Extensions, .Rdocs
:background #eee
:border 1px solid #ccc
:float right
@@ -75,4 +75,14 @@
%h3
= link_to e.name, (help_url() + '/' + e.name)
= render :partial => 'details', :locals => {:extension => e}
+
+ - unless @rdocs.blank?
+ .Rdocs
+ %h2 Help Documents
+ - render_region :rdocs do |rdoc|
+ = rdoc.render_region :rdocs_introduction
+ - @rdocs.each do |rdoc|
+ %h3
+ - rdoc_name = rdoc[/[(\w+)]\/(\w+)\/HELP/, 1]
+ = link_to rdoc_name.camelize, help_docs_url(rdoc_name)
View
@@ -9,13 +9,14 @@ class HelpExtension < Radiant::Extension
url "http://saturnflyer.com/"
define_routes do |map|
- map.with_options :controller => 'admin/help' do |help|
- help.help 'admin/help', :action => 'index', :conditions => {:method => :get}
- help.help_developing 'admin/help/developing', :action => 'developing', :conditions => {:method => :get}
- help.help_developing_extension 'admin/help/developing/:extension_name', :action => 'developing_extension', :conditions => {:method => :get}
- help.help_administering 'admin/help/administering', :action => 'administering', :conditions => {:method => :get}
- help.help_administering_extension 'admin/help/administering/:extension_name', :action => 'administering_extension', :conditions => {:method => :get}
- help.help_unknown 'admin/help/:extension_name', :action => 'show', :conditions => {:method => :get}
+ map.with_options :controller => 'admin/help', :conditions => {:method => :get} do |help|
+ help.help 'admin/help', :action => 'index'
+ help.help_developing 'admin/help/developing', :action => 'developing'
+ help.help_developing_extension 'admin/help/developing/:extension_name', :action => 'developing_extension'
+ help.help_administering 'admin/help/administering', :action => 'administering'
+ help.help_administering_extension 'admin/help/administering/:extension_name', :action => 'administering_extension'
+ help.help_docs 'admin/help/docs/:extension_name', :action => 'docs'
+ help.help_extension 'admin/help/:extension_name', :action => 'show'
end
end
@@ -64,6 +65,7 @@ def load_default_help_regions
index.main.concat %w{introduction organizing editing}
index.filter.concat %w{filter_basics}
index.additional.concat %w{features_introduction}
+ index.rdocs.concat %w{rdocs_introduction}
end
help.show = Radiant::AdminUI::RegionSet.new do |show|
# show.

0 comments on commit 5bdbb10

Please sign in to comment.