<commit_before>%h2.header
  .scope-field
    %label{:for => "scope"}= t('scope', :scope => 'admin.releaf_translations') + ":"
    %input#scope{:name => "translation_group[scope]", :size => "50", :type => "text", :value => @resource.scope}/

.body.inset_box.no_shadow

  -#TODO: improve style/html
  -if f.object.errors.any?
    #error_explanation
      %strong= "#{pluralize(f.object.errors.count, "error")} prohibited this news from being saved:"
      %ul
        - f.object.errors.full_messages.each do |msg|
          %li= msg

  .nested_wrap{:'data-name' => 'translations'}
    %table.table{:cellpadding => "0", :cellspacing => "0"}
      %thead
        %tr
          %th.code_header= t('key', :scope => 'admin.releaf_translations')
          - locales.each do |locale|
            %th.language_header{"data-locale" => locale}
              %span.name= locale
          %th.delete_header  
      %tbody#variables.list
        - f.object.translations.each_with_index do |translation, index|
          %tr.item{ :id => "translation_#{translation.id}", :'data-name' => 'translations', :'data-index' => index }
            %td.translation_name.codeColumn{:title => translation.plain_key}
              .wrap
                %input{:type=>"hidden", :name=>"translations[#{translation.id}][id]",  :value=>"#{translation.id}"}/
                %input{:type=>"text",   :name=>"translations[#{translation.id}][key]", :value=>"#{translation.plain_key}"}/
            - locales.each do |locale|

              %td.translationCell{"data-locale" => locale, :title => translation.locales[locale]}
                .wrap
                  %input{:type=>"text", :name=>"translations[#{translation.id}][localization][#{locale}]", :value=>translation.locales[locale]}/
            %td.delete_column
              %button.remove_nested_item{:type => 'button'}
                %i.icon-remove

    %table{:style => "display:none;"}
      %tbody
        %tr.template.item{:id => "translation__template_", :'data-name' => 'translations' }
          %td.translation_name.codeColumn
            .wrap
              %input{:type=>"text",   :name=>"translations[_template_][key]", :value=>""}/
          - locales.each do |locale|
            %td.translationCell{"data-locale" => locale}
              .wrap
                %input{:type=>"text", :name=>"translations[_template_][localization][#{locale}]", :value=>""}/
          %td.delete_column
            %button.remove_nested_item{:type => 'button'}
              %i.icon-remove

    %button.add_nested_item(type='button')
      %i.icon-plus
      %span= t('new', :scope => 'admin.releaf_translations')<commit_msg>corrected nested fields code in translations edit<commit_after>%h2.header
  .scope-field
    %label{:for => "scope"}= t('scope', :scope => 'admin.releaf_translations') + ":"
    %input#scope{:name => "translation_group[scope]", :size => "50", :type => "text", :value => @resource.scope}/

.body.inset_box.no_shadow

  -#TODO: improve style/html
  -if f.object.errors.any?
    #error_explanation
      %strong= "#{pluralize(f.object.errors.count, "error")} prohibited this news from being saved:"
      %ul
        - f.object.errors.full_messages.each do |msg|
          %li= msg

  .nested-wrap{:'data-name' => 'translations'}
    %table.table{:cellpadding => "0", :cellspacing => "0"}
      %thead
        %tr
          %th.code_header= t('key', :scope => 'admin.releaf_translations')
          - locales.each do |locale|
            %th.language_header{"data-locale" => locale}
              %span.name= locale
          %th.delete_header  
      %tbody#variables.list
        - f.object.translations.each_with_index do |translation, index|
          %tr.item{ :id => "translation_#{translation.id}", :'data-name' => 'translations', :'data-index' => index }
            %td.translation_name.codeColumn{:title => translation.plain_key}
              .wrap
                %input{:type=>"hidden", :name=>"translations[#{translation.id}][id]",  :value=>"#{translation.id}"}/
                %input{:type=>"text",   :name=>"translations[#{translation.id}][key]", :value=>"#{translation.plain_key}"}/
            - locales.each do |locale|

              %td.translationCell{"data-locale" => locale, :title => translation.locales[locale]}
                .wrap
                  %input{:type=>"text", :name=>"translations[#{translation.id}][localization][#{locale}]", :value=>translation.locales[locale]}/
            %td.delete_column
              %button.remove-nested-item{:type => 'button',  :title => t('Remove item', :scope => 'admin.releaf_translations')}
                %i.icon-remove

    %table{:style => "display:none;"}
      %tbody
        %tr.template.item{:id => "translation__template_", :'data-name' => 'translations' }
          %td.translation_name.codeColumn
            .wrap
              %input{:type=>"text",   :name=>"translations[_template_][key]", :value=>""}/
          - locales.each do |locale|
            %td.translationCell{"data-locale" => locale}
              .wrap
                %input{:type=>"text", :name=>"translations[_template_][localization][#{locale}]", :value=>""}/
          %td.delete_column
            %button.remove-nested-item{:type => 'button', :title => t('Remove item', :scope => 'admin.releaf_translations')}
              %i.icon-remove

    %button.button.add-nested-item{:type => 'button'}
      %i.icon-plus
      = t('Add item', :scope => 'admin.releaf_translations')

{'fraction_non_alphanumeric': 0.18429223744292236, 'fraction_numerical': 0.0018264840182648401, 'mean_word_length': 2.7, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 86, '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': '1210217', 'n_tokens_mistral': 1725, 'n_tokens_neox': 1711, 'n_words': 264}