<commit_before><!DOCTYPE html>
<html>
  <head>
  	<meta charset="utf-8">
    <title>Katalogisering</title>
    <style type="text/css">
      *           { box-sizing: border-box; }
      body        { margin: 40px auto; max-width: 1050px; line-height: 1.6; padding: 0 10px;
                    font-family: sans-serif; font-size: 18px; color: #222; }
      h1, h2, h3  { line-height: 1.2 }
      fieldset    { border: 0; background: #eee;}
      input       { width: 300px; padding: 3px; margin: 0 }
      label       { font-family: monospace; text-align: right; width: 160px; display: inline-block; }

      #errors     { background: #F77F00; color: #fff; font-weight: bold; }
      #errors p   { padding: 4px; }

      #save-stat  { text-align: right; color: #888; margin: 0 4px; display: block; }
      #save-stat:before  { content: "status: ";}

      .prop-input   { clear:both ;}
      .prop-details { width: 20%; float: left; text-align: right;}
      .prop-values  { padding-left: 1em; max-width: 80%; float:left;}

      .invalid-input { border: 1px solid #F77F00;}
      .invalid-msg   { color: #F77F00; font-size: 12px;}

    </style>
    <script src="lib.js"></script>
  </head>
  <body>
    <div id="#container"></div>
    <script id="template" type="text/ractive">
      <h2>Katalogisering av verk</h2>
      <div id="errors">{{#errors}}<p>{{.}}</p>{{/errors}}</div>
      <div id="save-stat">{{save_status}}</div>
      <fieldset>
        <div class="prop-input">
          <div class="prop-details">
            <label>URI</label>
          </div>
          <div class="prop-values">
            <input disabled="disabled" data-automation-id="work_uri" value="{{work_uri}}"/>
          </div>
        </div>
        {{#each inputs}}
          <div class="prop-input {{predicate}}">
            <div class="prop-details">
              <button on-click="addValue">+</button>
              <label>{{label}}</label>
            </div>
            <div class="prop-values">
              {{#each values}}
                {{#range === "http://www.w3.org/2001/XMLSchema#string"}}
                  {{>input-lang-string}}
                {{elseif range === "http://www.w3.org/2001/XMLSchema#gYear"}}
                  {{>input-gYear}}
                {{elseif range === "http://www.w3.org/2001/XMLSchema#nonNegativeInteger"}}
                  {{>input-nonNegativeInteger}}
                {{else}}
                  {{>input-string}}
                {{/}}
                <br/>
                <div class="invalid-msg">{{#error}}{{error}}{{/error}}</div>
              {{/each}}
            </div>
          </div>
        {{/each}}
      </fieldset>

      {{#partial input-string}}
          <input
            on-blur='patchResource:{{predicate}}'
            on-keyup="countdownToSave"
            on-change="countdownToSave"
            data-automation-id="{{predicate}}_{{@index}}"
            value="{{current.value}}" />
      {{/partial}}

      {{#partial input-lang-string}}
          <input
            on-blur='patchResource:{{predicate}}'
            on-keyup="countdownToSave"
            on-change="countdownToSave"
            data-automation-id="{{predicate}}_{{@index}}"
            value="{{current.value}}" />
            {{#range === "http://www.w3.org/2001/XMLSchema#string"}}
              <select value="{{current.lang}}"
                      on-change='patchResource:{{predicate}}'
                      class="select_lang">
                <option value="">velg språk</option>
                <option value="no">norsk</option>
                <option value="en">engelsk</option>
                <option value="fr">fransk</option>
              </select>
            {{/}}
      {{/partial}}

      {{#partial input-gYear}}
          <input
            class="{{#error}}invalid-input{{else}}valid{{/error}}"
            on-blur='patchResource:{{predicate}}'
            on-keyup="countdownToSave"
            data-automation-id="{{predicate}}_{{@index}}"
            value="{{current.value}}" />
      {{/partial}}

      {{#partial input-nonNegativeInteger}}
          <input
            on-blur='patchResource:{{predicate}}'
            on-keyup="countdownToSave"
            on-change="countdownToSave"
            data-automation-id="{{predicate}}_{{@index}}"
            value="{{current.value}}" />
      {{/partial}}
    </script>
    <script src="http://cdn.ractivejs.org/latest/ractive.min.js"></script>
    <script>
      var errors = [];
      var ractive = new Ractive({
        el: "#container",
        lang: "no",
        template: "#template",
        data: {
          errors: errors,
          work_uri: "",
          inputs: {},
          ontology: null,
          save_status: "nytt verk"
        },
      });

      // Event handling functions responding to UI interactions:
      listener = ractive.on({
        countdownToSave: function( event ) {<commit_msg>Add CSS error class to all invalid inputs<commit_after><!DOCTYPE html>
<html>
  <head>
  	<meta charset="utf-8">
    <title>Katalogisering</title>
    <style type="text/css">
      *           { box-sizing: border-box; }
      body        { margin: 40px auto; max-width: 1050px; line-height: 1.6; padding: 0 10px;
                    font-family: sans-serif; font-size: 18px; color: #222; }
      h1, h2, h3  { line-height: 1.2 }
      fieldset    { border: 0; background: #eee;}
      input       { width: 300px; padding: 3px; margin: 0 }
      label       { font-family: monospace; text-align: right; width: 160px; display: inline-block; }

      #errors     { background: #F77F00; color: #fff; font-weight: bold; }
      #errors p   { padding: 4px; }

      #save-stat  { text-align: right; color: #888; margin: 0 4px; display: block; }
      #save-stat:before  { content: "status: ";}

      .prop-input   { clear:both ;}
      .prop-details { width: 20%; float: left; text-align: right;}
      .prop-values  { padding-left: 1em; max-width: 80%; float:left;}

      .invalid-input { border: 1px solid #F77F00;}
      .invalid-msg   { color: #F77F00; font-size: 12px;}

    </style>
    <script src="lib.js"></script>
  </head>
  <body>
    <div id="#container"></div>
    <script id="template" type="text/ractive">
      <h2>Katalogisering av verk</h2>
      <div id="errors">{{#errors}}<p>{{.}}</p>{{/errors}}</div>
      <div id="save-stat">{{save_status}}</div>
      <fieldset>
        <div class="prop-input">
          <div class="prop-details">
            <label>URI</label>
          </div>
          <div class="prop-values">
            <input disabled="disabled" data-automation-id="work_uri" value="{{work_uri}}"/>
          </div>
        </div>
        {{#each inputs}}
          <div class="prop-input {{predicate}}">
            <div class="prop-details">
              <button on-click="addValue">+</button>
              <label>{{label}}</label>
            </div>
            <div class="prop-values">
              {{#each values}}
                {{#range === "http://www.w3.org/2001/XMLSchema#string"}}
                  {{>input-lang-string}}
                {{elseif range === "http://www.w3.org/2001/XMLSchema#gYear"}}
                  {{>input-gYear}}
                {{elseif range === "http://www.w3.org/2001/XMLSchema#nonNegativeInteger"}}
                  {{>input-nonNegativeInteger}}
                {{else}}
                  {{>input-string}}
                {{/}}
                <br/>
                <div class="invalid-msg">{{#error}}{{error}}{{/error}}</div>
              {{/each}}
            </div>
          </div>
        {{/each}}
      </fieldset>

      {{#partial input-string}}
          <input
            class="{{#error}}invalid-input{{else}}valid{{/error}}"
            on-blur='patchResource:{{predicate}}'
            on-keyup="countdownToSave"
            on-change="countdownToSave"
            data-automation-id="{{predicate}}_{{@index}}"
            value="{{current.value}}" />
      {{/partial}}

      {{#partial input-lang-string}}
          <input
            class="{{#error}}invalid-input{{else}}valid{{/error}}"
            on-blur='patchResource:{{predicate}}'
            on-keyup="countdownToSave"
            on-change="countdownToSave"
            data-automation-id="{{predicate}}_{{@index}}"
            value="{{current.value}}" />
            {{#range === "http://www.w3.org/2001/XMLSchema#string"}}
              <select value="{{current.lang}}"
                      on-change='patchResource:{{predicate}}'
                      class="select_lang">
                <option value="">velg språk</option>
                <option value="no">norsk</option>
                <option value="en">engelsk</option>
                <option value="fr">fransk</option>
              </select>
            {{/}}
      {{/partial}}

      {{#partial input-gYear}}
          <input
            class="{{#error}}invalid-input{{else}}valid{{/error}}"
            on-blur='patchResource:{{predicate}}'
            on-keyup="countdownToSave"
            data-automation-id="{{predicate}}_{{@index}}"
            value="{{current.value}}" />
      {{/partial}}

      {{#partial input-nonNegativeInteger}}
          <input
            class="{{#error}}invalid-input{{else}}valid{{/error}}"
            on-blur='patchResource:{{predicate}}'
            on-keyup="countdownToSave"
            on-change="countdownToSave"
            data-automation-id="{{predicate}}_{{@index}}"
            value="{{current.value}}" />
      {{/partial}}
    </script>
    <script src="http://cdn.ractivejs.org/latest/ractive.min.js"></script>
    <script>
      var errors = [];
      var ractive = new Ractive({
        el: "#container",
        lang: "no",
        template: "#template",
        data: {
          errors: errors,
          work_uri: "",
          inputs: {},
          ontology: null,
          save_status: "nytt verk"
        },
      });

      // Event handling functions responding to UI interactions:
      listener = ractive.on({
        countdownToSave: function( event ) {
{'fraction_non_alphanumeric': 0.18039137776894804, 'fraction_numerical': 0.01569484454157147, 'mean_word_length': 1.8642958748221905, 'pattern_counts': {'":': 0, '<': 133, '<?xml version=': 0, '>': 141, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, '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': '4546103', 'n_tokens_mistral': 3207, 'n_tokens_neox': 2996, 'n_words': 532}