<fieldset class="box tabular"><legend><%= l(:field_visible) %></legend>
  <label class="block">
    <%= radio_button_tag 'custom_field[visible]', 1, @custom_field.visible?, :id => 'custom_field_visible_on',
          :data => {:disables => '.custom_field_role input'} %>
    <%= l(:label_visibility_public) %>
  </label>
  <label class="block">
    <%= radio_button_tag 'custom_field[visible]', 0, !@custom_field.visible?, :id => 'custom_field_visible_off',
          :data => {:enables => '.custom_field_role input'} %>
    <%= l(:label_visibility_roles) %>:
  </label>
  <% role_ids = @custom_field.role_ids %>
  <% Role.givable.sorted.each do |role| %>
    <label class="block custom_field_role" style="padding-left:2em;">
      <%= check_box_tag 'custom_field[role_ids][]', role.id, role_ids.include?(role.id), :id => nil %>
      <%= role.name %>
    </label>
  <% end %>
  <%= hidden_field_tag 'custom_field[role_ids][]', '' %>
</fieldset>
