Sha256: 203982ccffb84294f49e6b33e82d5e4ca664944e1e06a16087c741289f75346a

Contents?: true

Size: 1.25 KB

Versions: 21

Compression:

Stored size: 1.25 KB

Contents

<% has_many_model = model.reflections[field.to_s].klass %>
<% @locales ||= MyAdmin::Locale.all %>
<div class="tabs">
  <ul>
  <% @locales.each do |locale| %>
    <li class="locale_<%= locale.acronym %>">
      <a href="#locale_<%= locale.acronym %>">
        <%= locale.name %>
      </a>
    </li>
  <% end %>
  </ul>

  <% 
    @locales.each do |locale|
      item = nil
      object.send(field.to_sym).each do |obj|
        item = obj if obj.locale_id == locale.id
      end 
      if item.blank?
        item = object.send(field.to_sym).build 
        item.locale = locale
      end
  %>
    <div id="locale_<%= locale.acronym %>">
      <%= form.fields_for(field, item) do |has_many_form| %>
        <%= has_many_form.hidden_field :locale_id %>
        <% has_many_model.my_admin.fieldsets.each do |has_many_fieldset| %>
      		<%= content_tag(:fieldset) do %>
      			<%= content_tag(:legend, fieldset_title(application, has_many_model, has_many_fieldset[:name])) if has_many_fieldset.has_key? :name %>
      			<% has_many_fieldset[:fields].each do |has_many_field| %>
      			  <%= edit_field_struct(application, has_many_model, has_many_field, item, has_many_form ) %>
      			<% end %>
      		<% end %>
      	<% end %>
      <% end %>
    </div>
  
  <% end %>
</div>

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
my_admin-0.1.13 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.1.12 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.1.11 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.1.10 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.1.9 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.1.8 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.1.7 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.1.6 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.1.5 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.1.4 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.1.3 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.1.2 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.1.1 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.0.12 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.0.11 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.0.10 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.0.9 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.0.8 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.0.7 app/views/my_admin/fields/edit/type/has_many_locale.html.erb
my_admin-0.0.6 app/views/my_admin/fields/edit/type/has_many_locale.html.erb