Module: ScaffoldLogic

Defined in:
lib/scaffold_logic.rb,
lib/scaffold_logic/helper.rb,
lib/scaffold_logic/data_import.rb,
lib/scaffold_logic/form_helper.rb,
lib/scaffold_logic/menu_helper.rb,
lib/scaffold_logic/tab_interface_helper.rb,
lib/generators/scaffold_logic/layout/layout_generator.rb,
lib/generators/scaffold_logic/scaffold/scaffold_generator.rb

Overview

Configuration

Configure your application to default to the custom form builder

In app/controllers/application_controller.rb:

class ApplicationController < ActionController::Base
ActionView::Base.default_form_builder = ScaffoldLogic::FormBuilder

Usage

Default form field with label:

<%= f.text_field :last_name -%>

Returns:

Form field with custom label:

<%= f.text_field :first_name, :label => 'Custom' -%>

Returns:

Form field with no label

<%= f.text_field :search, :label => false -%>

Returns:

Form field with inline help (? icon which reveals help content when clicked):

<%= f.password_field :password %>

Returns:

Form field with instructions (show immediately below the label):

<%= f.password_field :password_confirmation %>

Returns:

Check box with label in addition to checkbox value text

(E.g. 'Foo' appears above the checkbox, and 'Something' next to it):

<%= f.check_box :foo, :inline_label => 'Something' -%>

Returns:

Don't wrap fields in a fieldset

<%= f.text_field :query, :label => 'Search terms:', :fieldset => false -%>

Returns

Defined Under Namespace

Modules: FormHelper, Generators, Helper, MenuHelper, TabInterfaceHelper Classes: DataImport, FormBuilder

Class Method Summary collapse

Class Method Details

.mongoid_sorter_from(field, direction) ⇒ Object



179
180
181
182
183
# File 'lib/scaffold_logic.rb', line 179

def self.mongoid_sorter_from( field, direction )
  field ||= 'id'
  direction ||= 'asc'
  eval ":#{field}.#{direction}"
end