orbit-basic/app/views/admin/infos/_form.html.erb

70 lines
2.3 KiB
Plaintext
Raw Normal View History

2011-12-23 10:34:21 +00:00
<div class="attributes_block <%= @class %>">
2012-09-21 04:58:44 +00:00
<h2><%= t("#{@attribute_type}") %></h2>
2011-12-23 10:34:21 +00:00
<div class="info_input">
<table border="0" cellspacing="0" cellpadding="0">
<thead class="list_head">
<tr>
2012-09-12 11:12:50 +00:00
<td><%= t(:key) %></td>
2011-12-23 10:34:21 +00:00
<% @site_valid_locales.each do |locale| %>
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
<% end %>
</tr>
</thead>
<tbody>
<tr class="list_item">
<td><%= is_new ? (f.text_field :key, {:style => "width:150px"}) : @attribute.key %></td>
2012-07-25 21:58:09 +00:00
<%= f.fields_for :title_translations do |f| %>
2011-12-23 10:34:21 +00:00
<% @site_valid_locales.each do |locale| %>
2012-07-25 21:58:09 +00:00
<td><%= f.text_field locale, :style => "width:150px", :value => (@attribute.title_translations[locale] rescue nil) %></td>
2011-12-23 10:34:21 +00:00
<% end %>
<% end %>
</tr>
</tbody>
</table>
</div>
</div>
<div class="attributes_block <%= @class %>">
<h2>Attributes</h2>
<div class="info_input">
<table id='attributes' border="0" cellspacing="0" cellpadding="0">
<thead class="list_head">
<tr>
2012-11-08 10:59:19 +00:00
<td><%= t('admin.key') %></td>
<td><%= t('admin.cross_lang') %></td>
2011-12-23 10:34:21 +00:00
<% @site_valid_locales.each do |locale| %>
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
<% end %>
2012-09-12 11:12:50 +00:00
<td><%= t(:type)%></td>
2011-12-23 10:34:21 +00:00
<td>&nbsp;</td>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="6">
2011-12-23 10:34:21 +00:00
<%= hidden_field_tag 'attribute_field_count', @attribute.attribute_fields.count %>
<a href="#" class="add"><%= t(:add) %></a>
</td>
</tr>
</tfoot>
<tbody>
<% @attribute.attribute_fields.each do |attribute_field| %>
<%= render :partial => 'attribute_field', :object => attribute_field, :locals => {:f => f} %>
<% end %>
</tbody>
</table>
</div>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "attribute_form" %>
<script>
$('.attributes_block a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_attribute_fields", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$('#attributes').append(("<%= escape_javascript(add_attribute 'admin/attributes/attribute_field', f, :attribute_fields) %>").replace(old_id, new_id));
});
</script>
<% end %>