50 lines
1.8 KiB
Plaintext
50 lines
1.8 KiB
Plaintext
<div class="attributes_block <%= @class %>">
|
|
<h2><%= t("admin.#{@attribute_type}") %></h2>
|
|
<div class="info_input">
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
<thead class="list_head">
|
|
<tr>
|
|
<td><%= t('admin.key') %></td>
|
|
<% @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>
|
|
<%= f.fields_for :i18n_variable, (@attribute.new_record? ? @attribute.build_i18n_variable : @attribute.i18n_variable) do |f| %>
|
|
<% @site_valid_locales.each do |locale| %>
|
|
<td><%= f.text_field locale, :style => "width:150px" %></td>
|
|
<% end %>
|
|
<% end %>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<div id='sub_roles' class="attributes_block <%= @class %>">
|
|
<h2>Sub roles</h2>
|
|
<% @attribute.sub_roles.each_with_index do |sub_role, i| %>
|
|
<%= render :partial => 'form_sub', :object => sub_role, :locals => {:f => f, :i => i} %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div id='add_sub_role' class="info_input attributes_block">
|
|
<%= hidden_field_tag 'attribute_field_count', @attribute.sub_roles.count %>
|
|
<a href="#" class="add"><%= t(:add) %></a>
|
|
</div>
|
|
|
|
<% content_for :page_specific_javascript do %>
|
|
<%= javascript_include_tag "attribute_form" %>
|
|
<script>
|
|
$('#add_sub_role a.add').live('click', function(){
|
|
var new_id = $(this).prev().attr('value');
|
|
var old_id = new RegExp("new_sub_roles", "g");
|
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
|
$('#sub_roles').append(("<%= escape_javascript(add_attribute 'admin/roles/sub_role', f, :sub_roles) %>").replace(old_id, new_id));
|
|
});
|
|
</script>
|
|
<% end %> |