<commit_before>= simple_form_for([:broker, @region], html: { novalidate: true }) do |f|

  - if notification = f.error_notification
    .alert.alert-danger
      = notification

  %fieldset
    %legend
      = t('legends.region')
      %i.fa.fa-2x.fa-home.pull-right
    .form-actions.section-margins
      = f.button :submit, t('common.edit'), class: 'btn btn-primary'

    .form-inputs.section-margins
      = f.input :name, required: true, label: 'Name der Region'


    %div.row.section-margins
      %div.col-xs-12
        %label
          Einzugsgebiet

      %div.col-xs-3.section-margins
        = autocomplete_field_tag 'zip_name', '', autocomplete_place_zip_broker_places_path, :size => 75,
            'data-auto-focus' => true, class: 'js-places-autocomplete form-control search-field', placeholder: 'PLZ oder Ortschaft'
        %span
          %i.fa.fa-2x.fa-search.delete-icon
      %div.col-xs-12.js-places-tags
        - @places.each do |place|
          %span.place-tag
            %i.fa.fa-times-circle.js-delete-from-region{data: {id: place.id}}
            = "#{place.zip} #{place.name}"

    = render 'broker/organizations/list.html.haml'
    = render 'broker/list.html.haml'

    - if ENV['JI_ENABLED']
      %label
        %div
          = t('brokers.region.edit.ji_label')
      .row
        .col-xs-4
          = f.input :ji_location_id, collection: @ji_locations, include_blank: false, as: :select, label: false


    %label
      %div
        Logo
    .row
      .col-xs-4
        - if @region.logo.present?
          = image_tag @region.logo, class: 'img-responsive js-remove-img'
        = f.file_field :logo
        - if @region.logo.present?
          %i.fa.fa-trash.fa-2x.js-delete-region-icon.delete-region-icon

        %div.help-block
          Empfohlene Grösse ist 100x100 Pixels
    %label
      %div
        Website Kontakt
    .row
      .col-xs-12
        = f.text_area :contact_content, class: 'tinymce-js'

    %label
      %div
        Website Inhalt
    .row
      .col-xs-12
        %textarea.tinymce-js.invisible{name: 'region[content]'}


  .form-actions
    = f.button :submit, t('common.edit'), class: 'btn btn-primary'


%ul.nav.nav-pills
  %li= link_to t('common.back'), broker_dashboard_path

= render 'broker/brokers/new.html.haml'
= render 'broker/region_organizations/new.html.haml'

:javascript
  jQuery.railsAutocomplete.options.noMatchesLabel = "#{t('messages.place.not_found')}";
  $(document).on("keydown", "form", function(event) {
    return event.key != "Enter";
  });
  $('.js-places-autocomplete').bind('railsAutocomplete.select', function(event, data){
    $.ajax({
      url: "#{add_place_to_region_broker_places_path}",
      type: 'POST',
      data: {id: data.item.id},
      success: function(result) {
        $('.js-places-tags').prepend("<span class=\"place-tag\"><i class=\"fa fa-times-circle js-delete-from-region\" data-id="+data.item.id+"></i>&nbsp"+data.item.value+"</span>")
      },
      error: function(result){
        alert(result.responseJSON.error)
      }
    });
  });
  $(document).on('click', '.js-delete-from-region', function(){
    id = $(this).data('id')
    that = $(this)
    confirmText = "Möchten Sie diesen Ort wirklich aus einer Region löschen?";
    if(confirm(confirmText)) {
      $.ajax({
        url: "#{remove_from_region_broker_places_path}",
        type: 'DELETE',
        data: {id: id},
        success: function(result) {
          that.closest('.place-tag').remove();
        },
        error: function(result){
          alert(result.responseJSON.error);
        }
      });
    }
  });
  $(document).on('click', '.js-delete-region-icon', function(){
    that = $(this)
    $.ajax({
      url: "#{destroy_logo_broker_region_path}",
      type: 'DELETE',
      success: function(result) {
        $('.js-remove-img').remove();
        that.remove();
      },
      error: function(result){
        alert(result.responseJSON.error);
      }
    });
  })
<commit_msg>removed: invisible class from textarea region[content]<commit_after>= simple_form_for([:broker, @region], html: { novalidate: true }) do |f|

  - if notification = f.error_notification
    .alert.alert-danger
      = notification

  %fieldset
    %legend
      = t('legends.region')
      %i.fa.fa-2x.fa-home.pull-right
    .form-actions.section-margins
      = f.button :submit, t('common.edit'), class: 'btn btn-primary'

    .form-inputs.section-margins
      = f.input :name, required: true, label: 'Name der Region'


    %div.row.section-margins
      %div.col-xs-12
        %label
          Einzugsgebiet

      %div.col-xs-3.section-margins
        = autocomplete_field_tag 'zip_name', '', autocomplete_place_zip_broker_places_path, :size => 75,
            'data-auto-focus' => true, class: 'js-places-autocomplete form-control search-field', placeholder: 'PLZ oder Ortschaft'
        %span
          %i.fa.fa-2x.fa-search.delete-icon
      %div.col-xs-12.js-places-tags
        - @places.each do |place|
          %span.place-tag
            %i.fa.fa-times-circle.js-delete-from-region{data: {id: place.id}}
            = "#{place.zip} #{place.name}"

    = render 'broker/organizations/list.html.haml'
    = render 'broker/list.html.haml'

    - if ENV['JI_ENABLED']
      %label
        %div
          = t('brokers.region.edit.ji_label')
      .row
        .col-xs-4
          = f.input :ji_location_id, collection: @ji_locations, include_blank: false, as: :select, label: false


    %label
      %div
        Logo
    .row
      .col-xs-4
        - if @region.logo.present?
          = image_tag @region.logo, class: 'img-responsive js-remove-img'
        = f.file_field :logo
        - if @region.logo.present?
          %i.fa.fa-trash.fa-2x.js-delete-region-icon.delete-region-icon

        %div.help-block
          Empfohlene Grösse ist 100x100 Pixels
    %label
      %div
        Website Kontakt
    .row
      .col-xs-12
        = f.text_area :contact_content, class: 'tinymce-js'

    %label
      %div
        Website Inhalt
    .row
      .col-xs-12
        %textarea.tinymce-js{name: 'region[content]'}


  .form-actions
    = f.button :submit, t('common.edit'), class: 'btn btn-primary'


%ul.nav.nav-pills
  %li= link_to t('common.back'), broker_dashboard_path

= render 'broker/brokers/new.html.haml'
= render 'broker/region_organizations/new.html.haml'

:javascript
  jQuery.railsAutocomplete.options.noMatchesLabel = "#{t('messages.place.not_found')}";
  $(document).on("keydown", "form", function(event) {
    return event.key != "Enter";
  });
  $('.js-places-autocomplete').bind('railsAutocomplete.select', function(event, data){
    $.ajax({
      url: "#{add_place_to_region_broker_places_path}",
      type: 'POST',
      data: {id: data.item.id},
      success: function(result) {
        $('.js-places-tags').prepend("<span class=\"place-tag\"><i class=\"fa fa-times-circle js-delete-from-region\" data-id="+data.item.id+"></i>&nbsp"+data.item.value+"</span>")
      },
      error: function(result){
        alert(result.responseJSON.error)
      }
    });
  });
  $(document).on('click', '.js-delete-from-region', function(){
    id = $(this).data('id')
    that = $(this)
    confirmText = "Möchten Sie diesen Ort wirklich aus einer Region löschen?";
    if(confirm(confirmText)) {
      $.ajax({
        url: "#{remove_from_region_broker_places_path}",
        type: 'DELETE',
        data: {id: id},
        success: function(result) {
          that.closest('.place-tag').remove();
        },
        error: function(result){
          alert(result.responseJSON.error);
        }
      });
    }
  });
  $(document).on('click', '.js-delete-region-icon', function(){
    that = $(this)
    $.ajax({
      url: "#{destroy_logo_broker_region_path}",
      type: 'DELETE',
      success: function(result) {
        $('.js-remove-img').remove();
        that.remove();
      },
      error: function(result){
        alert(result.responseJSON.error);
      }
    });
  })

{'fraction_non_alphanumeric': 0.1641847077962708, 'fraction_numerical': 0.005506194468777374, 'mean_word_length': 2.408102345415778, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3505200', 'n_tokens_mistral': 2787, 'n_tokens_neox': 2701, 'n_words': 451}