For my own Radiant installation I’ve extended all filters to include a
“help” method that returns a piece of text which gets inserted into the
relevant views to form a set of help links for filter types. They get
listed next to the pop-up filter menu. Ajaxian people might prefer to
have something a bit more lively, perhaps popping up only when a
specific filter is selected; anyway, it looks like this:
In lib/generators/filter/templates/model.rb.template:
Producing the whole link rather than, say, just returning the URL,
is done so that help() methods could insert more advanced links if
they so wish. This includes JavaScript which could tailor the size
of the pop-up window; useful, for example, for the Textile quick
help page which restricts its help text within a narrow table.
In app/views/admin/page/_part.rhtml and
app/views/admin/snippet/new.rhtml, the following has been added
after the ERB select_tag() call creating the filter menu (yes, the
hyphen hefore “Filter help” is intentional as a hacky separator
between the text and the selection menu):
Either way, the code probably ought to go into a helper method rather
than be copied verbatim in two view files. All in all it works, but it’s
quick and dirty so is not an immediate candidate for a patch. Does the
idea deserve further work, though, or is it something that’s really too
specific to my installation?
Either way, the code probably ought to go into a helper method
I seem to make a living out of replying to my own messages. Talking to
myself can only mean one thing…
In app/helpers/application_helper.rb:
def filter_help_links
# Find all filters creating an array; run ‘help’ on each item to
# create a new array; join the array items to form a string. Allow
# filters that don’t have help and cope with the case where no
# registered filters provide it.
That does the trick nicely. Might want to modify the “no help” return
value for more cunning template use than just bunging the links next to
the menu.
Either way, the code probably ought to go into a helper method rather
than be copied verbatim in two view files. All in all it works, but it’s
quick and dirty so is not an immediate candidate for a patch. Does the
idea deserve further work, though, or is it something that’s really too
specific to my installation?
It’s a good idea. I’ve wanted to implement something similar for tags
too. This way you could click an “Available Tags” link and it would show
you descriptions of all available Radius tags for that page (including
tags added by the selected behavior). See:
register 'My Filter'
description %{
Rdoc formatted description that is displayed when you click
the "My Filter" link.
}
def filter(text)
# filter text here...
end
On 13-Jul-2006 13:15 -0400, John W. Long was heard to say:
It’s a good idea. I’ve wanted to implement something similar for tags
too. This way you could click an “Available Tags” link and it would show
you descriptions of all available Radius tags for that page (including
tags added by the selected behavior). See:
In some distance future and maybe some other life I envision a
JavaScript/AJAX-based code-completion
Yah. All we need is someone to implement TextMate in javascript.
On 13-Jul-2006 13:15 -0400, John W. Long was heard to say:
It’s a good idea. I’ve wanted to implement something similar for tags
too. This way you could click an “Available Tags” link and it would show
you descriptions of all available Radius tags for that page (including
tags added by the selected behavior). See:
In some distance future and maybe some other life I envision a
JavaScript/AJAX-based code-completion
Oliver
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.