2011-12-18 02:07:42 +00:00
|
|
|
|
|
|
|
<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><%= sub_role.new_record? ? (f.text_field :key, {:style => "width:150px"}) : sub_role.key %></td>
|
2011-12-19 13:22:26 +00:00
|
|
|
<%= f.fields_for :i18n_variable, (sub_role.new_record? ? sub_role.build_i18n_variable : sub_role.i18n_variable) do |f| %>
|
|
|
|
<% @site_valid_locales.each do |locale| %>
|
|
|
|
<td><%= f.text_field locale, :style => "width:150px" %></td>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
2011-12-18 02:07:42 +00:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div class="attributes_block <%= @class %>">
|
|
|
|
<h2>Attributes</h2>
|
|
|
|
<div class="info_input">
|
|
|
|
<table class="sub_role_attributes" border="0" cellspacing="0" cellpadding="0">
|
|
|
|
<thead class="list_head">
|
|
|
|
<tr>
|
|
|
|
<td><%= t('admin.key') %></td>
|
|
|
|
<td><%= t('admin.multilingual') %></td>
|
|
|
|
<% @site_valid_locales.each do |locale| %>
|
|
|
|
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
|
|
|
<% end %>
|
|
|
|
<td><%= t('admin.type')%></td>
|
|
|
|
<td> </td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tfoot>
|
|
|
|
<tr>
|
2011-12-19 13:22:26 +00:00
|
|
|
<td id='add_attribute' colspan="5">
|
2011-12-18 02:07:42 +00:00
|
|
|
<%= hidden_field_tag 'attribute_field_count', sub_role.attribute_fields.count %>
|
|
|
|
<a href="#" class="add"><%= t(:add) %></a>
|
2011-12-19 13:22:26 +00:00
|
|
|
<%= hidden_field_tag 'sub_role_temp_id', (i rescue 'new_sub_roles') %>
|
2011-12-18 02:07:42 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tfoot>
|
|
|
|
<tbody>
|
|
|
|
<% sub_role.attribute_fields.each do |attribute_field| %>
|
|
|
|
<%= render :partial => 'attribute_field', :object => attribute_field, :locals => {:f => f} %>
|
|
|
|
<% end %>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% content_for :page_specific_javascript do %>
|
|
|
|
<script>
|
2011-12-19 13:22:26 +00:00
|
|
|
$('#add_attribute a.add').live('click', function(){
|
2011-12-18 02:07:42 +00:00
|
|
|
var new_parent_id = $(this).next().attr('value');
|
|
|
|
var old_parent_id = new RegExp("new_sub_roles", "g");
|
|
|
|
var new_id = $(this).prev().attr('value');
|
|
|
|
var old_id = new RegExp("new_attribute_fields", "g");
|
|
|
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
2011-12-19 13:22:26 +00:00
|
|
|
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'admin/attributes/attribute_field', f, :attribute_fields) %>").replace(old_id, new_id).replace(old_parent_id, new_parent_id));
|
2011-12-18 02:07:42 +00:00
|
|
|
});
|
|
|
|
</script>
|
2011-12-19 13:22:26 +00:00
|
|
|
<% end unless !sub_role.new_record? %>
|