<% text_areas = attributes.reject{|a| a.field_type.to_s != 'text_area'} generated_text_areas = false -%> <%%= form_for [refinery, :<%= namespacing.underscore %>_admin, @<%= singular_name %>] do |f| -%> <%%= render '/refinery/admin/error_messages', :object => @<%= singular_name %>, :include_object_name => true %> <% if localized? %> <%%= render "locale_picker", :current_locale => Thread.current[:globalize_locale] if Refinery.i18n_enabled? %> <% end %> <% attributes.each_with_index do |attribute, index| %> <% if attribute.field_type.to_s != 'text_area' -%>
<%%= f.label :<%= attribute.name %> -%> <% end -%> <% if attribute.type.to_s == 'image' -%> <%%= render '/refinery/admin/image_picker', :f => f, :field => :<%= "#{attribute.name}_id".gsub("_id_id", "_id") %>, :image => @<%= singular_name %>.<%= attribute.name.gsub("_id", "") %>, :toggle_image_display => false %> <% elsif attribute.type.to_s == 'resource' -%> <%%= render '/refinery/admin/resource_picker', :f => f, :field => :<%= "#{attribute.name}_id".gsub("_id_id", "_id") %>, :resource => @<%= singular_name %>.<%= attribute.name.gsub("_id", "") %> %> <% elsif attribute.field_type.to_s == "text_area" and !generated_text_areas -%>
    <%% <%= text_areas.map{|t| t.name.to_sym}.inspect -%>.each_with_index do |part, part_index| %>
  • '> <%%= link_to t("#{part}", :scope => "activerecord.attributes.refinery/<%= namespacing.underscore %>/<%= singular_name %>", :default => part.to_s.titleize), "##{part}" %>
  • <%% end %>
<%% <%= text_areas.map{|t| t.name.to_sym}.inspect -%>.each do |part| %>
<%%= f.text_area part, :rows => 20, :class => 'wymeditor widest' -%>
<%% end %>
<% generated_text_areas = true -%> <% elsif attribute.field_type.to_s != 'text_area' -%> <%%= f.<%= attribute.field_type -%> :<%= attribute.name -%><%= ", :class => 'larger widest'" if (index == 0 && attribute.field_type == :text_field) -%><%= ", :checked => @#{singular_name}[:#{attribute.name}]" if attribute.field_type == :check_box %> -%> <% end -%>
<% end %> <%%= render '/refinery/admin/form_actions', :f => f, :continue_editing => false, :delete_title => t('delete', :scope => 'refinery.<%= plural_name %>.admin.<%= plural_name %>.<%= singular_name %>'), :delete_confirmation => t('message', :scope => 'refinery.admin.delete'<% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? %>, :title => @<%= singular_name %>.<%= title.name %><% end %>) %> <%% end -%> <% if text_areas.any? -%> <%% content_for :javascripts do %> <%% end %> <% end -%>