Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Home

winton edited this page · 19 revisions
Clone this wiki locally

What does rake app_helpers do?

  • Creates your database.yml
    • Prompts for db name
  • Generates .gitignore
    • Contains commonly ignored Rails files, vendor/plugins, and anything created by app_helpers
  • Generates config/plugins.rb
    • see plugins:update
  • Copies helper templates to app/views/app_helpers
  • Sets up app/widgets
    • Copies javascripts, which contains the latest MooTools version and other libraries/extensions
    • Copies stylesheets, which contains the Tbl helper stylesheet
    • Clones the widgets repository

Rake Tasks

db:config

Prompts for a database name and generates config/database.yml for you.

plugins:update

Clones the plugins from config/plugins.rb into vendor/plugins unless they exist.

Runs the following commands on every git repository in the project:

git checkout master
git pull origin master

Helpers

Partials

Method: block_to_partial(partial_name, options = {}, &block)

Sends the output of a block to a partial as the local variable body.

Example:

= block_to_partial ‘some_partial’, :locals => { :x => 0 } do
Two local variables will be sent to the partial; ‘x’ (0) and ‘body’ (this text).

Method: script_tag_redirect_to(url)

Renders an HTML javascript tag with the code window.location=url.

Tbl

Method:
tbl(type, name, unit=:px, *widths, &block)

Uses the partials in app/views/app_helpers/tbl to generate CSS tables (rows of content with specific column widths).

Include the following in your site-wide SASS:

.row
:overflow hidden
.parent
:float left
:display block

The view:

- tbl :row, :your_identifier, :px, 100, 200, 300 do
– tbl :cell, :your_identifier do
Row 1, Cell 1
– tbl :cell, :your_identifier do
Row 1, Cell 2
– tbl :cell, :your_identifier do
Row 1, Cell 3
– tbl :cell, :your_identifier do
Row 2, Cell 1
– tbl :cell, :your_identifier do
Row 2, Cell 2
– tbl :cell, :your_identifier do
Row 2, Cell 3

Note: Change :px to '%' for percentage widths.

See [rails_widget](https://github.com/winton/rails_widget) for a javascript implementation of Tbl.

Truncate

Method: better_truncate(text, length = 80, truncate_string = "...")

Like truncate, but does the job without cutting words in half.

Something went wrong with that request. Please try again.