Orbit/app/views/admin/user_attribute_models/_form.html.erb

74 lines
2.1 KiB
Plaintext

<table>
<tr>
<th><%= t('admin.key') %></th>
<% @site_valid_locales.each do |locale| %>
<th style="color:<%= colorize_in_use_locale(locale) %>"><%= locale %></th>
<% end %>
</tr>
<tr>
<td><%= is_new ? (f.text_field :key, {:style => "width:130px"}) : @user_attribute_model.key %></td>
<% @site_valid_locales.each do |locale| %>
<td>
<%= text_field_tag "user_attribute_model[i18n_variable][#{locale}]", (@i18n_variable[locale] if @i18n_variable), :style => "width:130px" %>
</td>
<% end %>
</tr>
</table>
<fieldset id='field_set_attribute_attrs'>
<legend>
<%= t('admin.attributes')%>
</legend>
<table id='attribute_attrs'>
<tr>
<th><%= t('admin.key') %></th>
<th><%= t('admin.multilingual') %></th>
<% @site_valid_locales.each do |locale| %>
<th style="color:<%= colorize_in_use_locale(locale) %>"><%= locale %></th>
<% end %>
<th><%= t('admin.type')%></th>
<th></th>
</tr>
<%= render :partial => 'attribute_attr_model', :collection => @user_attribute_model.attribute_attr_models %>
</table>
<a href="#" class="add">(<%= t(:add) %>)</a>
</fieldset>
<% content_for :page_specific_javascript do %>
<script type="text/javascript" charset="utf-8">
$('#field_set_attribute_attrs a.remove').live('click', function(){
$(this).parent().parent().remove();
});
$('#field_set_attribute_attrs a.add').click(function(){
$('#attribute_attrs').append("<%= escape_javascript(render(:partial => 'attribute_attr_model', :object => @user_attribute_model.attribute_attr_models.build)) %>");
});
$('#field_set_attribute_attrs a.remove_existing_record').click(function(){
$(this).next('.should_destroy').attr('value', 1);
$(this).parent().parent().hide();
});
$('.select_mulitlingual input').live('click', function(){
$(this).next().attr('value', this.checked);
});
$('.select_type select').live('change', function(){
if(this.value == 'select')
{
$(this).next().show();
}
else
{
$(this).next().hide();
}
});
</script>
<% end -%>