<commit_before>{#
# @license 3-clause BSD
# @link https://github.com/QuestionKey/QuestionKey-Core
#}

{% extends 'QuestionKeyBundle::base.html.twig' %}

{% block title %}Add Library Content to {{ node.titleAdmin }} on Version {{ treeVersion.titleAdmin }} of {{  tree.titleAdmin }} | Admin{%  endblock %}

{% block main %}

  <ol class="breadcrumb">
    <li><a href="{{ path('questionkey_admin') }}">Admin</a></li>
    <li><a href="{{ path('questionkey_admin_tree_show', {'treeId':tree.publicId }) }}">Tree: {{ tree.titleAdmin}}</a></li>
    <li><a href="{{ path('questionkey_admin_tree_version_show', {'treeId':tree.publicId,'versionId':treeVersion.publicId }) }}">Version: {{ treeVersion.titleAdmin}}</a></li>
    <li><a href="{{ path('questionkey_admin_tree_version_node_show', {'treeId':tree.publicId,'versionId':treeVersion.publicId,'nodeId':node.publicId }) }}">Node: {{ node.titleAdmin }}</a></li>
    <li class="active">Edit Library Content</li>
  </ol>

  {%  if libraryContents %}

    {%  for libraryContent in libraryContents %}

      <div class="well">

        <p>Library Title: {{ libraryContent.titleAdmin }}</p>

        <p>Body Text: {{ libraryContent.bodyText | nl2br }}</p>

        <p>Body HTML: {{ libraryContent.bodyHTML | nl2br }}</p>


        {% if treeVersion.featureVariables %}
          <ul class="list-group">
            {% for nodeHasLibraryContentIfVariable in nodeHasLibraryContentIfVariables %}
              {%  if nodeHasLibraryContentIfVariable.libraryContent == libraryContent %}
                <li class="list-group-item">
                  Only show if {{ nodeHasLibraryContentIfVariable.variable.name  }} {{ nodeHasLibraryContentIfVariable.action }} {{ nodeHasLibraryContentIfVariable.value }}
                </li>
              {%  endif %}
            {%  endfor %}
          </ul>
        {%  endif %}

        <form method="post" action="#">
          <input type="hidden" name="action" value="remove">
          <input type="hidden" name="contentId" value="{{  libraryContent.publicId }}">
          <input type="submit" value="Remove Library Content" class="btn btn-warning">
        </form>

        {%  if treeVersion.featureVariables %}
          <p><a href="{{ path('questionkey_admin_tree_version_node_library_content_add_if_variable', {'treeId':tree.publicId,'versionId':treeVersion.publicId,'nodeId':node.publicId, 'libraryContentId': libraryContent.publicId }) }}" class="btn btn-warning">Add If Variable Condition</a></p>
        {%  endif %}
      </div>
    {%  endfor %}

  {%  else %}
    <div>No content currently added to this node.</div>
  {%  endif %}
<commit_msg>Style delete button and have confirmation<commit_after>{#
# @license 3-clause BSD
# @link https://github.com/QuestionKey/QuestionKey-Core
#}

{% extends 'QuestionKeyBundle::base.html.twig' %}

{% block title %}Add Library Content to {{ node.titleAdmin }} on Version {{ treeVersion.titleAdmin }} of {{  tree.titleAdmin }} | Admin{%  endblock %}

{% block main %}

  <ol class="breadcrumb">
    <li><a href="{{ path('questionkey_admin') }}">Admin</a></li>
    <li><a href="{{ path('questionkey_admin_tree_show', {'treeId':tree.publicId }) }}">Tree: {{ tree.titleAdmin}}</a></li>
    <li><a href="{{ path('questionkey_admin_tree_version_show', {'treeId':tree.publicId,'versionId':treeVersion.publicId }) }}">Version: {{ treeVersion.titleAdmin}}</a></li>
    <li><a href="{{ path('questionkey_admin_tree_version_node_show', {'treeId':tree.publicId,'versionId':treeVersion.publicId,'nodeId':node.publicId }) }}">Node: {{ node.titleAdmin }}</a></li>
    <li class="active">Edit Library Content</li>
  </ol>

  {%  if libraryContents %}

    {%  for libraryContent in libraryContents %}

      <div class="well">

        <p>Library Title: {{ libraryContent.titleAdmin }}</p>

        <p>Body Text: {{ libraryContent.bodyText | nl2br }}</p>

        <p>Body HTML: {{ libraryContent.bodyHTML | nl2br }}</p>


        {% if treeVersion.featureVariables %}
          <ul class="list-group">
            {% for nodeHasLibraryContentIfVariable in nodeHasLibraryContentIfVariables %}
              {%  if nodeHasLibraryContentIfVariable.libraryContent == libraryContent %}
                <li class="list-group-item">
                  Only show if {{ nodeHasLibraryContentIfVariable.variable.name  }} {{ nodeHasLibraryContentIfVariable.action }} {{ nodeHasLibraryContentIfVariable.value }}
                </li>
              {%  endif %}
            {%  endfor %}
          </ul>
        {%  endif %}

        <form method="post" action="#" onsubmit="return confirm('Are you sure you want to delete this?');">
          <input type="hidden" name="action" value="remove">
          <input type="hidden" name="contentId" value="{{  libraryContent.publicId }}">
          <input type="submit" value="Remove Library Content" class="btn btn-danger">
        </form>

        {%  if treeVersion.featureVariables %}
          <p><a href="{{ path('questionkey_admin_tree_version_node_library_content_add_if_variable', {'treeId':tree.publicId,'versionId':treeVersion.publicId,'nodeId':node.publicId, 'libraryContentId': libraryContent.publicId }) }}" class="btn btn-warning">Add If Variable Condition</a></p>
        {%  endif %}
      </div>
    {%  endfor %}

  {%  else %}
    <div>No content currently added to this node.</div>
  {%  endif %}

{'fraction_non_alphanumeric': 0.16962119798469863, 'fraction_numerical': 0.0011196118678857996, 'mean_word_length': 3.500419815281276, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 89, 'https://': 2, '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': '3407883', 'n_tokens_mistral': 1650, 'n_tokens_neox': 1537, 'n_words': 304}