<commit_before><%
#render "shared/aceify_textareas", :mode => "json"
content_for :script, javascript_include_tag("js-yaml.min")
content_for :script, javascript_include_tag("json2yaml")
content_for :script, javascript_include_tag("formeditor")
is_edit = controller.action_name == "edit"
is_new = !is_edit
%>
<div id="darkened2"></div>

<%= render "form_basic", :is_edit => is_edit %>

<div>
  <h3>Graphical Form Editor</h3>

  <div id="form_editor"></div>

  <div id="form_tools">
    <h4>Tools</h4>
    <a id="save" onclick="$F().save()">Save</a>
    <a id="preview" onclick="$F().preview()">Preview</a>
    <a id="undo" class="disabled" onclick="$F().undo()">Undo <span></span></a>
    <a id="redo" class="disabled" onclick="$F().redo()">Redo <span></span></a>

    <a id="sort" onclick="$F().toggleSorting()">Enable Sorting <span>(Shows buttons for dragging or move up/down)</span></a>
    <a id="cancel-sort" onclick="$F().toggleSorting()">Disable Sorting <span>(Hides buttons, order stays)</span></a>

    <a id="delete" onclick="$F().toggleDeleting()">Enable Deleting <span>(Shows buttons that allow deletion)</span></a>
    <a id="cancel-delete" onclick="$F().toggleDeleting()">Disable Deleting <span>(Hides buttons, nothing is restored)</span></a>

    <a id="duplicate" onclick="$F().toggleDuplicating()">Enable Duplicating <span>(Shows buttons that allow duplication)</span></a>
    <a id="cancel-duplicate" onclick="$F().toggleDuplicating()">Disable Duplicating <span>(Hides buttons, duplicates stay)</span></a>

    <a id="languages" onclick="$F().setLanguagesPopup()">Set Languages <span>(Allows adding/removing available translations)</span></a>
  </div>

  <div id="form_preview"></div>
</div>

<script type="text/javascript">
  <%
    attr = {}
    attr[:PreviewUrl] = @form.id ? preview_form_path(@form) : nil
    attr[:AbstractForm] = [AbstractForm::ATTRIBUTES].flatten
    attr[:Page] = [Page::ATTRIBUTES].flatten
    attr[:Section] = [Section::ATTRIBUTES].flatten
    attr[:Visualizers] = {}
    attr[:Visualizers][:Single] = Dir.glob_files(File.join(GNT_ROOT, "tex/results", "single_*.tex.erb"))
    attr[:Visualizers][:Single].map! { |f| f.gsub(/^single_|\.tex.erb$/, "") }
    attr[:Visualizers][:Tutor] = Dir.glob_files(File.join(GNT_ROOT, "tex/results", "single_tutor_*.tex.erb"))
    attr[:Visualizers][:Tutor].map! { |f| f.gsub(/^single_|\.tex.erb$/, "") }
    # TODO: this is another artifact of the weird type handling…
    attr[:Visualizers][:Single] = attr[:Visualizers][:Single] - attr[:Visualizers][:Tutor]
    attr[:Visualizers][:Multi] = Dir.glob_files(File.join(GNT_ROOT, "tex/results", "multi_*.tex.erb"))
    attr[:Visualizers][:Multi].map! { |f| f.gsub(/^multi_|\.tex.erb$/, "") }
    attr[:Visualizers][:Text] = Dir.glob_files(File.join(GNT_ROOT, "tex/results", "comment_*.tex.erb"))
    attr[:Visualizers][:Text].map! { |f| f.gsub(/^comment_|\.tex.erb$/, "") }
  %>
  var ATTRIBUTES = <%= ActiveSupport::JSON.encode(attr).html_safe %>;
  var x = FormEditor.getInstance();
  x.setLanguages(<%= ActiveSupport::JSON.encode(@form.languages).html_safe %>, true);
</script>

<div>
  <h3>Some helpful comments</h3>
  <ul>
    <li>In questions and their answers use \linebreak to force one and avoid \\ or \newline altogether.</li>
    <li>If you want to prevent automatic line breaks place the contents inside an \mbox{}. Be aware that this might lead to texts overlapping each other.</li>
    <li>If TeX fails with error messages that are clearly not related to your code: we are not sure why they appear, but they may usually be resolved by inserting page breaks manually or by fiddling with \vspaces.</li>
    <li>Questions may need to be repeated for each lecturer or tutor while others may be valid for the whole course. Think of a course with two lecturers and two tutors. Do you like the course’s title? → course; Do you like «lecturer»? → lecturer; Do you like «tutor»? → tutor.</li>
    <li>Use \lect to refer to the lecturer’s full name and \lectLast to refer to his/her/its last name. NOTE: Only valid within repeat_for = lecturer</li>
    <li>Texts may be translated like this, e.g.
      <pre>text:
  :de: Oliver ist doof
  :en: Oliver is daft</pre>
    or not at all:
      <pre>text: Oliver ist doof</pre>
    In many cases the software will simply choose the right snippet.
    </li>
  </ul>
</div><commit_msg>remove outdated help<commit_after><%
#render "shared/aceify_textareas", :mode => "json"
content_for :script, javascript_include_tag("js-yaml.min")
content_for :script, javascript_include_tag("json2yaml")
content_for :script, javascript_include_tag("formeditor")
is_edit = controller.action_name == "edit"
is_new = !is_edit
%>
<div id="darkened2"></div>

<%= render "form_basic", :is_edit => is_edit %>

<div>
  <h3>Graphical Form Editor</h3>

  <div id="form_editor"></div>

  <div id="form_tools">
    <h4>Tools</h4>
    <a id="save" onclick="$F().save()">Save</a>
    <a id="preview" onclick="$F().preview()">Preview</a>
    <a id="undo" class="disabled" onclick="$F().undo()">Undo <span></span></a>
    <a id="redo" class="disabled" onclick="$F().redo()">Redo <span></span></a>

    <a id="sort" onclick="$F().toggleSorting()">Enable Sorting <span>(Shows buttons for dragging or move up/down)</span></a>
    <a id="cancel-sort" onclick="$F().toggleSorting()">Disable Sorting <span>(Hides buttons, order stays)</span></a>

    <a id="delete" onclick="$F().toggleDeleting()">Enable Deleting <span>(Shows buttons that allow deletion)</span></a>
    <a id="cancel-delete" onclick="$F().toggleDeleting()">Disable Deleting <span>(Hides buttons, nothing is restored)</span></a>

    <a id="duplicate" onclick="$F().toggleDuplicating()">Enable Duplicating <span>(Shows buttons that allow duplication)</span></a>
    <a id="cancel-duplicate" onclick="$F().toggleDuplicating()">Disable Duplicating <span>(Hides buttons, duplicates stay)</span></a>

    <a id="languages" onclick="$F().setLanguagesPopup()">Set Languages <span>(Allows adding/removing available translations)</span></a>
  </div>

  <div id="form_preview"></div>
</div>

<script type="text/javascript">
  <%
    attr = {}
    attr[:PreviewUrl] = @form.id ? preview_form_path(@form) : nil
    attr[:AbstractForm] = [AbstractForm::ATTRIBUTES].flatten
    attr[:Page] = [Page::ATTRIBUTES].flatten
    attr[:Section] = [Section::ATTRIBUTES].flatten
    attr[:Visualizers] = {}
    attr[:Visualizers][:Single] = Dir.glob_files(File.join(GNT_ROOT, "tex/results", "single_*.tex.erb"))
    attr[:Visualizers][:Single].map! { |f| f.gsub(/^single_|\.tex.erb$/, "") }
    attr[:Visualizers][:Tutor] = Dir.glob_files(File.join(GNT_ROOT, "tex/results", "single_tutor_*.tex.erb"))
    attr[:Visualizers][:Tutor].map! { |f| f.gsub(/^single_|\.tex.erb$/, "") }
    # TODO: this is another artifact of the weird type handling…
    attr[:Visualizers][:Single] = attr[:Visualizers][:Single] - attr[:Visualizers][:Tutor]
    attr[:Visualizers][:Multi] = Dir.glob_files(File.join(GNT_ROOT, "tex/results", "multi_*.tex.erb"))
    attr[:Visualizers][:Multi].map! { |f| f.gsub(/^multi_|\.tex.erb$/, "") }
    attr[:Visualizers][:Text] = Dir.glob_files(File.join(GNT_ROOT, "tex/results", "comment_*.tex.erb"))
    attr[:Visualizers][:Text].map! { |f| f.gsub(/^comment_|\.tex.erb$/, "") }
  %>
  var ATTRIBUTES = <%= ActiveSupport::JSON.encode(attr).html_safe %>;
  var x = FormEditor.getInstance();
  x.setLanguages(<%= ActiveSupport::JSON.encode(@form.languages).html_safe %>, true);
</script>
{'fraction_non_alphanumeric': 0.19505678022712092, 'fraction_numerical': 0.0018704074816299266, 'mean_word_length': 5.041969330104924, 'pattern_counts': {'":': 0, '<': 147, '<?xml version=': 0, '>': 151, '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': '2868834', 'n_tokens_mistral': 2594, 'n_tokens_neox': 2502, 'n_words': 560}