Sha256: 7a4dc839a98147e65d90a47bf0450a9121f5843e0d32179d0f4339011671a7b5

Contents?: true

Size: 1.88 KB

Versions: 5

Compression:

Stored size: 1.88 KB

Contents

<%% content_for :body_content_left do %>
  <div class='<%= plural_name %>'>
    <%%=raw @page.content_for(Refinery::Pages.default_parts.first.to_sym) %>

    <%%= form_for [refinery, :<%= namespacing.underscore %>, @<%= singular_name %>] do |f| %>
      <%%= render '/refinery/admin/error_messages',
                 :object => @<%= singular_name %>,
                 :include_object_name => true  %>
<% string_fields = attributes.map{ |a| a.name if a.type.to_s =~ /string|text/ }.compact.uniq -%>
      <% attributes.each do |attribute| %>
      <div class='field <%= attribute.name %>_field <%= attribute.type %>_field'>
        <%%= f.<%= 'required_' if string_fields.any? && attribute.name == string_fields.first %>label :<%= attribute.name %> %>
<% case attribute.type
   when :string -%>
        <%%= f.text_field :<%= attribute.name %> %>
<% when :text -%>
        <%%= f.text_area :<%= attribute.name %>, :rows => 8 %>
<% when :radio -%>
        <%% <%= class_name %>::<%= attribute.name.pluralize.upcase %>.each do |value, name| %>
          <%%= f.radio_button :<%= attribute.name %>, (name || value), :value => value %>
          <%%= f.label :"<%= attribute.name %>_#{(name || value)}", value.humanize %>
        <%% end %>
<% when :checkbox -%>
        <%%= f.check_box :<%= attribute.name %> %>
<% when :select -%>
        <%%= f.select :<%= attribute.name %>, Refinery::<%= namespacing %>::<%= class_name %>::<%= attribute.name.pluralize.upcase %>,
                      :include_blank => true %>
<% when :datetime -%>
        <%%= f.datetime_select :<%= attribute.name %> %>
<% when :date -%>
        <%%= f.date_select :<%= attribute.name %> %>
<% when :time -%>
        <%%= f.time_select :<%= attribute.name %> %>
<% end -%>
      </div>
      <% end %>
      <div class='actions'>
        <%%= f.submit t('.send') %>
      </div>
    <%% end %>
  </div>
<%% end %>
<%%= render '/refinery/content_page' %>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
refinerycms-core-2.0.4 lib/generators/refinery/form/templates/app/views/refinery/namespace/plural_name/new.html.erb
refinerycms-core-2.0.3 lib/generators/refinery/form/templates/app/views/refinery/namespace/plural_name/new.html.erb
refinerycms-core-2.0.2 lib/generators/refinery/form/templates/app/views/refinery/namespace/plural_name/new.html.erb
refinerycms-core-2.0.1 lib/generators/refinery/form/templates/app/views/refinery/namespace/plural_name/new.html.erb
refinerycms-core-2.0.0 lib/generators/refinery/form/templates/app/views/refinery/namespace/plural_name/new.html.erb