<!-- layouts/_successor_field.html.erb Start -->
<%= controller.successor_select(id) %>

<div>
  <%= select_tag('predecessor', options_for_select(successor_possibs)) %>

  <%= filter_link(id, 'get_successor_possibs_json', 'predecessor', show_all, 'Vorgänger') %>

  <button id="show_all_successors" type="button" title="<%= show_all == 'true' ? 'nur dazugehörige' : 'alle' %> Bundesländer zeigen" onclick="<%=makeOnClick('successor-view', 'show_successor_fields', nil, {'id' => id, :show_all => show_all == 'false'}) %>">
    <%= show_all == 'true' ? 'nur dazugehörige' : 'alle' %> Bundesländer zeigen
  </button>

</div>

<div>
  <button type="button" id="add-successor" title="Anlage zur Liste hinzufügen.">Hinzufügen</button>
  <button type="button" id="hide_successor_field" title="Anlage nicht zur Liste hinzufügen." onclick="<%=makeOnClick('successor-view', 'hide_successor_fields', nil, 'id' => id) %>">Abbrechen</button>
</div>

<!-- layouts/_successor_field.html.erb Ende -->

<script  type="text/javascript" language="javascript">
    $("#add-successor").click(function(event){
        event.preventDefault();
        $.ajax({
            url: '<%= url_for({:action => 'add_successor', :succ_id => id}) %>',
            data: 'pre_id=' + $('#predecessor').val(),
            type: "GET",
            dataType: "html",
            success: function (text) {
                $("#successor-view").html(text)
            }
        })
    });
</script>