Understanding Rails in general
A nice article regarding Rails from the designers standpoint.
Books, Cheat sheets, etc.
There are a lot of rake tasks available for rails in general, and several for mx in particular. To see all the tasks available do
Rake tasks specific to mx are in the 'mx' namespace ("mx:"). To see only those type
rake --tasks mx
See Rake tasks for a description of these tasks.
The application follows the traditional Rails layout.
There are two different approaches to making your data public. Both approaches require a layout.rhtml.
- just use the shared public controllers
- create a "home" controller
At present there are 3 locations where a project-specific set of public accessible files may reside:
/app/controllers/public/site/foo /app/views/public/site/foo /public/site/foo
Well try and mock up and include a basic site named 'foo' and include it in the source shortly.
Controllers that sit at the base of
are shared by all projects. Controllers in
are specific to a project. In the above example 'foo' is the same as the unix-name that you give your project when you click 'settings' while logged in mx. Using a public controller is straightforward- all you need to do is point your link in your layout to that controller, for instance you could add something like this to your layout:
<tr> <td class="menu" valign="top"> <a href="http://your_url.blah/public/ref/list_by_author">references</a> <a href="http://your_url.blah/public/ref">bibliography</a> <a href="http://your_url.blah/public/taxon_name/browse?family=">taxa</a> <a href="http://your_url.blah/public/repository">repositories</a> <a href="http://your_url.blah/public/taxon_name">search</a> <a href="http://your_url.blah/public/clave">keys</a> <a href="http://your_url.blah/site/evaniid/about_authors.html">about</a> <a href="http://your_url.blah">home</a> </td> </tr>
In the above example the controllers that you are accessing are prefixed with public. For instance
/public/ref /public/taxon_name /public/repository
are all shared controllers.
You'll also notice that some links have
following the URL. These are links static html files that are found in
The 'home' controller
If you want a little more control or customization you can create a home_controller.rb file in
With this approach you can essentially ignore the
folder, instead placing all layout files, static or otherwise in
A home_controller.rb file for a project with unix name 'foo' and might look something like this:
class Public::Site::Foo::HomeController < ApplicationController layout 'public/site/Foo/layout' def index # grab some random images to display on our hompage @ids = ImageDescription.random_set(1, 3, 1) end def about # these actions simply render the file in the given layout with the same name, for example: # /app/views/public/site/foo/about.rhtml # would be rendered calling this link end
def links # see above end
def keys # here we grab information from project 1 redirect_to "/projects/1/public/clave/list" end
def images redirect_to "/projects/1/public/image/list" end
def taxon_pages redirect_to "/projects/1/public/public_content/list" end
def association # and here we grab information from project 4 redirect_to "/projects/4/public/association" end end
How To Scenarios
How To Scenarios is a place to post specific questions, answers and tips that may be helpful for other developers