<commit_before>:javascript
  jQuery(function($) {
    $("#mkdir_form, #value_form").hide();
    $("#mkdir_form, #value_form").removeClass("hidden");

    $("#open_mkdir_form").click(function() {
      $("#mkdir_form").show();
      $("#value_form").hide();
      $("#mkdir_form .form-control:first").focus();
    });
    $("#open_value_form").click(function() {
      $("#mkdir_form").hide();
      $("#value_form").show();
      $("#value_form .form-control:first").focus();
    });
  });

- if etcvault?
  :javascript
    jQuery(function($) {
      if (sessionStorage.getItem('secretVisibility') == null)
        sessionStorage.setItem('secretVisibility', '1');

      updateSecretVisibility = function() {
        if (sessionStorage.getItem('secretVisibility') == '1') {
          $(".etcvault_value").show();

          $("#show_secret").hide();
          $("#hide_secret").show();
        } else {
          $(".etcvault_value").hide();

          $("#show_secret").show();
          $("#hide_secret").hide();
        }
      };

      $("#hide_secret").click(function() {
        sessionStorage.setItem('secretVisibility', '0');
        updateSecretVisibility();
      });
      $("#show_secret").click(function() {
        sessionStorage.setItem('secretVisibility', '1');
        updateSecretVisibility();
      });

      updateSecretVisibility();
      $("#secret_visibility_buttons").removeClass('hidden');
    });

.row
  .col-md-10
    %p
      %button#open_mkdir_form.btn.btn-default
        %span.glyphicon.glyphicon-folder-close{'aria-hidden' => true}
        New directory
      %button#open_value_form.btn.btn-default
        %span.glyphicon.glyphicon-plus{'aria-hidden' => true}
        New value

  .col-md-2
    %p#secret_visibility_buttons.hidden
      %button#show_secret.btn.btn-default
        %span.glyphicon.glyphicon-eye-open{'aria-hidden' => true}
        Show secrets
      %button#hide_secret.btn.btn-default
        %span.glyphicon.glyphicon-eye-close{'aria-hidden' => true}
        Hide secrets

.row
  .col-md-12
    - action = "/keys#{node.key}"
    - action = "/keys/" if action == "/keys"
    .hidden.panel.panel-default#mkdir_form
      .panel-heading New directory
      .panel-body
        %form.form{action: action, method: 'POST'}
          %input{type: 'hidden', name: '_method', value: 'PUT'}
          %input{type: 'hidden', name: 'dir', value: '1'}
          .form-group
            %input.form-control{type: 'text', name: 'child', placeholder: 'new key name'}
          .form-group
            %button.btn.btn-primary{type: 'submit'} Create

    .hidden.panel.panel-default#value_form
      .panel-heading New value
      .panel-body
        %form.form{action: action, method: 'POST'}
          %input{type: 'hidden', name: '_method', value: 'PUT'}
          .form-group
            %input.form-control{type: 'text', name: 'child', placeholder: 'new key name'}
          .form-group
            %textarea.form-control{name: 'value', row: '2', placeholder: 'value'}
          .form-group
              .row
                - if etcvault?
                  .col-md-4
                    != haml :etcvault_keys_select
                .col-md-1
                  %button.btn.btn-primary{type: 'submit'} Create
                .col-md-4
                  %button.btn.btn-default{type: 'submit', name: 'continue', value: '1'} Create and Continue

.row
  .col-md-12
    - if node.children.empty?
      %p (empty directory)
    .list-group
      - node.children.sort_by(&:key).each do |child|
        - name = child.key.split(?/).last
        %a.list-group-item{href: "/keys#{child.key}"} 
          .row
            - if child.dir
              .col-md-5
                #{name}/
              .col-md-7
                %span.glyphicon.glyphicon-folder-open{'aria-hidden' => true}
            - else
              .col-md-4= name
              .col-md-1.text-right
                - if child.etcvault
                  = child.etcvault['container'] && child.etcvault['container']['KeyName']
                  %span.glyphicon.glyphicon-briefcase{'aria-hidden' => true}
                - elsif child.etcvault_error
                  %span.text-danger.glyphicon.glyphicon-briefcase{'aria-hidden' => true}
              .col-md-7
                %code{class: child.etcvault ? 'etcvault_value' : nil}= child.value
.row
  .col-md-12
    %form.form-inline{action: "/keys#{node.key}", method: 'POST', onsubmit: 'javascript:return confirm("Sure?")'}
      %input{type: 'hidden', name: '_method', value: 'DELETE'}
      %button.btn.btn-danger{type: 'submit'} Destroy
      .checkbox
        %label
          %input{type: 'checkbox', name: 'recursive', value: '1', checked: false}
          Recursive


<commit_msg>this only works when etcvault enabled<commit_after>:javascript
  jQuery(function($) {
    $("#mkdir_form, #value_form").hide();
    $("#mkdir_form, #value_form").removeClass("hidden");

    $("#open_mkdir_form").click(function() {
      $("#mkdir_form").show();
      $("#value_form").hide();
      $("#mkdir_form .form-control:first").focus();
    });
    $("#open_value_form").click(function() {
      $("#mkdir_form").hide();
      $("#value_form").show();
      $("#value_form .form-control:first").focus();
    });
  });

- if etcvault?
  :javascript
    jQuery(function($) {
      if (sessionStorage.getItem('secretVisibility') == null)
        sessionStorage.setItem('secretVisibility', '1');

      updateSecretVisibility = function() {
        if (sessionStorage.getItem('secretVisibility') == '1') {
          $(".etcvault_value").show();

          $("#show_secret").hide();
          $("#hide_secret").show();
        } else {
          $(".etcvault_value").hide();

          $("#show_secret").show();
          $("#hide_secret").hide();
        }
      };

      $("#hide_secret").click(function() {
        sessionStorage.setItem('secretVisibility', '0');
        updateSecretVisibility();
      });
      $("#show_secret").click(function() {
        sessionStorage.setItem('secretVisibility', '1');
        updateSecretVisibility();
      });

      updateSecretVisibility();
      $("#secret_visibility_buttons").removeClass('hidden');
    });

.row
  .col-md-10
    %p
      %button#open_mkdir_form.btn.btn-default
        %span.glyphicon.glyphicon-folder-close{'aria-hidden' => true}
        New directory
      %button#open_value_form.btn.btn-default
        %span.glyphicon.glyphicon-plus{'aria-hidden' => true}
        New value

  .col-md-2
    - etcvault?
      %p#secret_visibility_buttons.hidden
        %button#show_secret.btn.btn-default
          %span.glyphicon.glyphicon-eye-open{'aria-hidden' => true}
          Show secrets
        %button#hide_secret.btn.btn-default
          %span.glyphicon.glyphicon-eye-close{'aria-hidden' => true}
          Hide secrets

.row
  .col-md-12
    - action = "/keys#{node.key}"
    - action = "/keys/" if action == "/keys"
    .hidden.panel.panel-default#mkdir_form
      .panel-heading New directory
      .panel-body
        %form.form{action: action, method: 'POST'}
          %input{type: 'hidden', name: '_method', value: 'PUT'}
          %input{type: 'hidden', name: 'dir', value: '1'}
          .form-group
            %input.form-control{type: 'text', name: 'child', placeholder: 'new key name'}
          .form-group
            %button.btn.btn-primary{type: 'submit'} Create

    .hidden.panel.panel-default#value_form
      .panel-heading New value
      .panel-body
        %form.form{action: action, method: 'POST'}
          %input{type: 'hidden', name: '_method', value: 'PUT'}
          .form-group
            %input.form-control{type: 'text', name: 'child', placeholder: 'new key name'}
          .form-group
            %textarea.form-control{name: 'value', row: '2', placeholder: 'value'}
          .form-group
              .row
                - if etcvault?
                  .col-md-4
                    != haml :etcvault_keys_select
                .col-md-1
                  %button.btn.btn-primary{type: 'submit'} Create
                .col-md-4
                  %button.btn.btn-default{type: 'submit', name: 'continue', value: '1'} Create and Continue

.row
  .col-md-12
    - if node.children.empty?
      %p (empty directory)
    .list-group
      - node.children.sort_by(&:key).each do |child|
        - name = child.key.split(?/).last
        %a.list-group-item{href: "/keys#{child.key}"} 
          .row
            - if child.dir
              .col-md-5
                #{name}/
              .col-md-7
                %span.glyphicon.glyphicon-folder-open{'aria-hidden' => true}
            - else
              .col-md-4= name
              .col-md-1.text-right
                - if child.etcvault
                  = child.etcvault['container'] && child.etcvault['container']['KeyName']
                  %span.glyphicon.glyphicon-briefcase{'aria-hidden' => true}
                - elsif child.etcvault_error
                  %span.text-danger.glyphicon.glyphicon-briefcase{'aria-hidden' => true}
              .col-md-7
                %code{class: child.etcvault ? 'etcvault_value' : nil}= child.value
.row
  .col-md-12
    %form.form-inline{action: "/keys#{node.key}", method: 'POST', onsubmit: 'javascript:return confirm("Sure?")'}
      %input{type: 'hidden', name: '_method', value: 'DELETE'}
      %button.btn.btn-danger{type: 'submit'} Destroy
      .checkbox
        %label
          %input{type: 'checkbox', name: 'recursive', value: '1', checked: false}
          Recursive



{'fraction_non_alphanumeric': 0.16981132075471697, 'fraction_numerical': 0.005241090146750524, 'mean_word_length': 2.1128874388254486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '4356917', 'n_tokens_mistral': 2957, 'n_tokens_neox': 2883, 'n_words': 484}