You are here

display-rule.html.twig in Popup Maker - All popup types 8

<div class="sgpm-popup-rule" data-rule-id="{{ index }}">
  <div>
    <label class="sgpm-label">Select Target</label>
    <select name="sgpm_rules[{{ index }}][param]" class="sgpm-select sgpm-rule-param">
      {% for type,nodes in displayRules %}
        {% if nodes is not empty %}
          <optgroup label="{{ type }}">
            <option data-sgpm-rule-param="{{ type }}_all"
                value="{{ type ~ '_all' }}" {% if rule.param is defined and rule.param == type ~'_all' %} selected="selected" {% endif %} >
              All {{ type }}s
            </option>
            <option data-sgpm-rule-param="{{ type }}_selected"
                value="{{ type ~ '_selected' }}" {% if rule.param is defined and rule.param == type ~ '_selected' %} selected="selected" {% endif %} >
              Selected {{ type }}s
            </option>
          </optgroup>
        {% endif %}
      {% endfor %}
    </select>
  </div>
  <div>
    <label class="sgpm-label">Operator</label>
    <select name="sgpm_rules[{{ index }}][operator]" class="sgpm-select">
      <option value="==" {% if rule.operator == '==' %}selected="selected"{% endif %}>Is</option>
      <option value="!=" {% if rule.operator == '!=' %}selected="selected"{% endif %}>Is not</option>
    </select>
  </div>
  {% for type,nodes in displayRules %}
    <div data-sgpm-rule-param="{{ type }}_selected" class="sgpm-rule-value {% if rule.param is not defined or rule.param != type ~ '_selected' %}sgpm-hide{% endif %}">
      <label class="sgpm-label">Selected {{ type }}s</label>
      <select {% if last or (rule.param is defined and rule.param == type ~ '_selected') %}name="sgpm_rules[{{ index }}][value][]"{% else %}data-name="sgpm_rules[{{ index }}][value][]"{% endif %} class="sgpm-select sgpm-popup-rule-value" multiple="multiple">
        {% for nodeId,nodeTitle in nodes %}
          <option value="{{ nodeId }}" {% if rule.param is defined and rule.param == type ~ '_selected' and nodeId in rule.value %} selected="selected" {% endif %}>{{ nodeTitle }}</option>
        {% endfor %}
      </select>
    </div>
  {% endfor %}
  <a href="#" class="sgpm-fab-btn sgpm-remove-rule">
    <svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
      <path d="M19 13H5v-2h14v2z"/>
      <path d="M0 0h24v24H0z" fill="none"/>
    </svg>
  </a>
  <a href="#" class="sgpm-fab-btn sgpm-add-rule {% if not last %}sgpm-hide{% endif %}">
    <svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
      <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
      <path d="M0 0h24v24H0z" fill="none"/>
    </svg>
  </a>
</div>

File

templates/display-rule.html.twig
View source
  1. <div class="sgpm-popup-rule" data-rule-id="{{ index }}">
  2. <div>
  3. <label class="sgpm-label">Select Target</label>
  4. <select name="sgpm_rules[{{ index }}][param]" class="sgpm-select sgpm-rule-param">
  5. {% for type,nodes in displayRules %}
  6. {% if nodes is not empty %}
  7. <optgroup label="{{ type }}">
  8. <option data-sgpm-rule-param="{{ type }}_all"
  9. value="{{ type ~ '_all' }}" {% if rule.param is defined and rule.param == type ~'_all' %} selected="selected" {% endif %} >
  10. All {{ type }}s
  11. </option>
  12. <option data-sgpm-rule-param="{{ type }}_selected"
  13. value="{{ type ~ '_selected' }}" {% if rule.param is defined and rule.param == type ~ '_selected' %} selected="selected" {% endif %} >
  14. Selected {{ type }}s
  15. </option>
  16. </optgroup>
  17. {% endif %}
  18. {% endfor %}
  19. </select>
  20. </div>
  21. <div>
  22. <label class="sgpm-label">Operator</label>
  23. <select name="sgpm_rules[{{ index }}][operator]" class="sgpm-select">
  24. <option value="==" {% if rule.operator == '==' %}selected="selected"{% endif %}>Is</option>
  25. <option value="!=" {% if rule.operator == '!=' %}selected="selected"{% endif %}>Is not</option>
  26. </select>
  27. </div>
  28. {% for type,nodes in displayRules %}
  29. <div data-sgpm-rule-param="{{ type }}_selected" class="sgpm-rule-value {% if rule.param is not defined or rule.param != type ~ '_selected' %}sgpm-hide{% endif %}">
  30. <label class="sgpm-label">Selected {{ type }}s</label>
  31. <select {% if last or (rule.param is defined and rule.param == type ~ '_selected') %}name="sgpm_rules[{{ index }}][value][]"{% else %}data-name="sgpm_rules[{{ index }}][value][]"{% endif %} class="sgpm-select sgpm-popup-rule-value" multiple="multiple">
  32. {% for nodeId,nodeTitle in nodes %}
  33. <option value="{{ nodeId }}" {% if rule.param is defined and rule.param == type ~ '_selected' and nodeId in rule.value %} selected="selected" {% endif %}>{{ nodeTitle }}</option>
  34. {% endfor %}
  35. </select>
  36. </div>
  37. {% endfor %}
  38. <a href="#" class="sgpm-fab-btn sgpm-remove-rule">
  39. <svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
  40. <path d="M19 13H5v-2h14v2z"/>
  41. <path d="M0 0h24v24H0z" fill="none"/>
  42. </svg>
  43. </a>
  44. <a href="#" class="sgpm-fab-btn sgpm-add-rule {% if not last %}sgpm-hide{% endif %}">
  45. <svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
  46. <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
  47. <path d="M0 0h24v24H0z" fill="none"/>
  48. </svg>
  49. </a>
  50. </div>