Skip to content

Instantly share code, notes, and snippets.

@esneko
Created March 16, 2011 23:50
Show Gist options
  • Save esneko/873568 to your computer and use it in GitHub Desktop.
Save esneko/873568 to your computer and use it in GitHub Desktop.
Taxonomy Globalize Accessors
<% if(Taxonomy.easy_accessors.blank?) %>
<%= f.field_container :name do %>
<%= f.label :name, t("name") %> <span class="required">*</span><br />
<%= error_message_on :taxonomy, :name, :class => 'fullwidth title' %>
<%= text_field :taxonomy, :name %>
<% end %>
<% else %>
<%- Taxonomy.easy_accessors.each do |locale| %>
<% fieldsym = "name_#{locale}".to_sym %>
<%= f.field_container fieldsym do %>
<%= f.label fieldsym, t(fieldsym.to_s) %> <span class="required">*</span><br />
<%= f.error_message_on fieldsym, :class => 'fullwidth title' %>
<%= f.text_field fieldsym %>
<% end %>
<% end %>
<% end %>
class GlobalizeSpreeHooks < Spree::ThemeSupport::HookListener
# custom hooks go here
replace :admin_product_form_left, 'admin/shared/product_globalize_form_left'
replace :admin_inside_taxon_form, 'admin/shared/taxon_globalize_form_inside'
replace :admin_inside_taxonomy_form, 'admin/shared/taxonomy_globalize_form_inside'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment