Sha256: 052cab05760a7b613e6d45ef47cc21b28e6cc59e93227e8d3776c7812ccde6d4
Contents?: true
Size: 1.23 KB
Versions: 22
Compression:
Stored size: 1.23 KB
Contents
class <%= plural_name.camelize %>::New < Mustache::Rails <%# TODO: extract errors_display settings to to module methods -%> def errors_display_div return "" unless <%= singular_name %>.errors.any? content_tag("div", :id=>"errorExplanation", :class=>"errorExplanation") do content_tag("h2", error_header) + content_tag("ul") do <%= singular_name %>.errors.full_messages.inject("") do |memo,msg| memo += content_tag("li", msg) end end end end def <%= singular_name %>_form_tag form_tag(create_path, :class => "<%= singular_name %>_form", :id => "edit_<%= singular_name %>_#{<%= singular_name %>.id}_form") end <% for attribute in attributes -%> def <%= attribute.name %>_label label :<%= singular_name %>, :<%= attribute.name %> end <%# TODO: Different fields for different attribute types -%> def <%= attribute.name %>_text_field text_field(:<%= singular_name %>, :<%= attribute.name %>, :id => "<%= attribute.name %>_text_field") end <% end -%> def form_submit submit_tag "Create" end def index_path <%= plural_name %>_path end private def create_path <%= plural_name %>_path end def error_header "u r dong it rong" end end
Version data entries
22 entries across 22 versions & 2 rubygems