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

80 lines
2.4 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_attributes'>
<legend>
<%= t('admin.attributes')%>
</legend>
<table id='attributes'>
<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 => 'admin/user_attribute_models/attribute_model', :collection => @user_attribute_model.attribute_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_attributes a.remove').live('click', function(){
$(this).parent().parent().remove();
});
$('#field_set_attributes a.add').click(function(){
$('#attributes').append("<%= escape_javascript(render(:partial => 'admin/user_attribute_models/attribute_model', :object => @user_attribute_model.attribute_models.build)) %>");
});
$('#field_set_attributes a.remove_existing_record').click(function(){
$(this).next('.should_destroy').attr('value', 1);
$(this).parent().parent().hide();
});
$('#field_set_attributes a.change_built_in').click(function(){
$(this).children().toggle();
var $am = $(this).next('.built_in_state')
$am.attr('value', ($am.attr('value') == "false") ? "true" : "false");
});
$('.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 -%>