<%= semantic_form_for @latest_edition, :url => admin_answer_edition_path(@answer, @latest_edition), :as => :edition do |f| %>
  <%= f.inputs do %>
    <%= f.input :title, :label => "Name of answer" %>
    <%= f.input :body, :as => :text %>
  <% end %>
<% end %>


<% content_for :extra_javascript do %>
<script type="text/javascript">
  $(function () {
    $('#edition_title')[0].focus();
    $('input.title').
      live('change', function () {
        var elem = $(this);
        var header = elem.closest('fieldset').prev('h3').find('a');
        header.text(elem.val());
      }).
      live('change', function () {
        var title_field = $(this);
        var slug_field = title_field.closest('.part').find('.slug');
        console.log(title_field, slug_field);
        if (slug_field.text() == '') {
          slug_field.val(GovUKGuideUtils.convertToSlug(title_field.val()));
        }
      });
  });
</script>
<% end %>
<%= semantic_form_for @latest_edition, :url => admin_answer_edition_path(@answer, @latest_edition), :as => :edition do |f| %>
  <%= f.inputs do %>
    <%= f.input :title, :label => "Name of answer" %>
    <%= f.input :body, :as => :text %>
  <% end %>
<% end %>


<% content_for :extra_javascript do %>
<script type="text/javascript">
  $(function () {
    $('#edition_title')[0].focus();
    $('input.title').
      live('change', function () {
        var title_field = $(this);
        var slug_field = title_field.closest('.part').find('.slug');
        if (slug_field.text() == '') {
          slug_field.val(GovUKGuideUtils.convertToSlug(title_field.val()));
        }
      });
  });
</script>
<% end %>
Remove some unneeded JS from answers editing
Remove some unneeded JS from answers editing
