app/Resources/BaitPollBundle/views/Poll/poll.html.twig line 1

Open in your IDE?
  1. {% if answerSaved is defined and result is not defined %}
  2.     <div class="convert-to-alert">
  3.         {% if poll.msgSent %}
  4.             <h2 class="text-center button-text font-bold mid-section-pb">{{ poll.msgSent }}</h2>
  5.         {% else %}
  6.             <h2 class="text-center button-text font-bold mid-section-pb">{{'poll success'|trans}}</h2>
  7.         {% endif %}
  8.     </div>
  9. {% endif %}
  10. <poll-form-wrapper
  11.     label="{{ poll.msgOpenButton ?: 'Show poll'|trans }}"
  12.     {% if poll.displayType == 'onclick' and answerSaved is not defined %}
  13.         :show-button="true"
  14.     {% endif %}
  15.     :server-errors="JSON.parse('{{ inputErrors|json_encode|e('js') }}')"
  16. >
  17.     <section
  18.         {% if poll.displayType == 'onclick' and answerSaved is not defined %}
  19.             class="hidden"
  20.         {% endif %}
  21.     >
  22.         {% if poll.dateStart|date('U', 'UTC') > 'now'|date('U', 'UTC') %}
  23.             <h2 class="text-center button-text font-bold mid-section-pb">{{poll.msgNotStarted}}</h2>
  24.         {% elseif poll.dateEnd|date('U', 'UTC') < 'now'|date('U', 'UTC') %}
  25.             <h2 class="text-center button-text font-bold mid-section-pb">{{poll.msgEnded}}</h2>
  26.         {% elseif answerSaved is not defined %}
  27.             {% if alreadyAnswered is defined and alreadyAnswered %}
  28.                 {% if alreadyAnswered.created is defined %}
  29.                     <h2 class="text-center button-text font-bold mid-section-pb">
  30.                         {{'You have answered this poll at'|trans}} {{alreadyAnswered.created|date('d. m. Y')}}
  31.                     </h2>
  32.                 {% else %}
  33.                     <h2 class="text-center button-text font-bold mid-section-pb">{{'You have already answered this poll anoynmously.'|trans}}</h2>
  34.                 {% endif %}
  35.             {% else %}
  36.                 <form class="container mx-auto" method="post" enctype="multipart/form-data">
  37.                     {% for question in poll.questions %}
  38.                         {% set hasDropdownAnswer = false %}
  39.                         {% set hasCheckboxAnswer = false %}
  40.                         {% set hasRadioAnswer = false %}
  41.                         {% set hasRequiredAnswer = false %}
  42.                         {% for answer in question.answers %}
  43.                             {% if answer.type == 'dropdown' %}
  44.                                 {% set hasDropdownAnswer = true %}
  45.                             {% endif %}
  46.                             {% if answer.type == 'checkbox' %}
  47.                                 {% set hasCheckboxAnswer = true %}
  48.                             {% endif %}
  49.                             {% if answer.type == 'radio' %}
  50.                                 {% set hasRadioAnswer = true %}
  51.                             {% endif %}
  52.                             {% if answer.required %}
  53.                                 {% set hasRequiredAnswer = true %}
  54.                             {% endif %}
  55.                         {% endfor %}
  56.                         <div class="flex flex-col items-center {% if loop.last %}last{% endif %}">
  57.                             <p class="flex items-center justify-center font-bold text-center
  58.                                   gap-x-2 lg:gap-x-5 mb-10 font-bold sm-text-card"
  59.                             >
  60.                                 {{question.title}}
  61.                                 {% if hasRequiredAnswer %}
  62.                                     <span class="text-frMagenta">*</span>
  63.                                 {% endif %}
  64.                             </p>
  65.                             {% if question.description %}
  66.                                 <div class="poll-content-desc mb-10 sm-text-card">
  67.                                     {{ question.description|raw }}
  68.                                 </div>
  69.                             {% endif %}
  70.                             {% include 'BaitPollBundle:Poll:fragments/photo.html.twig' with {'photo': question.photo, 'source': question.photoSource, 'link': question.photoSourceLink} %}
  71.                             {% if question.embed %}
  72.                                 <div class="embed-responsive card-rounded mb-15">
  73.                                     <iframe class="embed-responsive__item" width="560" height="315" src="{{ question.embed }}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  74.                                 </div>
  75.                             {% endif %}
  76.                             {% if hasDropdownAnswer %}
  77.                                 {% include 'BaitPollBundle:Poll:fragments/dropdown.html.twig' %}
  78.                             {% endif %}
  79.                             {% if hasCheckboxAnswer %}
  80.                                 {% include 'BaitPollBundle:Poll:fragments/checkbox.html.twig' %}
  81.                             {% endif %}
  82.                             {% if hasRadioAnswer %}
  83.                                 {% include 'BaitPollBundle:Poll:fragments/radio.html.twig' %}
  84.                             {% endif %}
  85.                             {% for answer in question.answers if answer.type != 'dropdown' and answer.type != 'checkbox' and answer.type != 'radio' %}
  86.                                 {% if answer.embed %}
  87.                                     <div class="embed-responsive card-rounded mb-15">
  88.                                         <iframe class="embed-responsive__item" width="560" height="315" src="{{ answer.embed }}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  89.                                     </div>
  90.                                 {% endif %}
  91.                                 {% include 'BaitPollBundle:Poll:fragments/photo.html.twig' with {'photo': answer.photo, 'source': answer.photoSource, 'link': answer.photoSourceLink} %}
  92.                                 {% include 'BaitPollBundle:Poll:fragments/' ~ answer.type ~ '.html.twig' ignore missing %}
  93.                                 {{answer.trackingCode|raw}}
  94.                             {% endfor %}
  95.                         </div>
  96.                     {% endfor %}
  97.                     {% if poll.multiEntry and poll.multiEntryInterval == 'without_limit'  %}
  98.                         <div id="recaptcha-{{poll.id}}" style="width: 304px; margin: 0 auto 16px;"></div>
  99.                     {% endif %}
  100.                     <div class="flex justify-center mid-section-pb">
  101.                         <input type="hidden" name="submit" value="{{ poll.id }}">
  102.                         <button
  103.                             type="submit"
  104.                             id="{{ poll.id }}"
  105.                             {% if poll.multiEntry and poll.multiEntryInterval == 'without_limit' %}
  106.                                 disabled
  107.                                 data-recaptcha="{{ poll.id }}"
  108.                             {% endif %}
  109.                             class="flex items-center justify-center
  110.                                    px-15 lg:px-25 h-[32px] lg:h-[50px]
  111.                                    bg-frMagenta border-frMagenta rounded-full
  112.                                    hover:bg-frDarkBlue hover:border-frDarkBlue
  113.                                    transition duration-300 font-bold gap-x-10 lg:gap-x-15"
  114.                         >
  115.                             <span class="flex items-center h-full text-white sm-text-card !leading-none">
  116.                                 {{ 'Submit'|trans }}
  117.                             </span>
  118.                             <img
  119.                                 src="{{ asset('vue/icons/arrow-link-white.svg', 'img') }}"
  120.                                 alt="Send"
  121.                                 class="w-12 h-12 lg:w-20 lg:h-20"
  122.                             />
  123.                         </button>
  124.                     </div>
  125.                 </form>
  126.             {% endif %}
  127.         {% endif %}
  128.     </section>
  129. </poll-form-wrapper>
  130. {# quiz result #}
  131. {% if result is defined %}
  132. <div class="flex flex-col items-center mid-section-pb sm-text-card">
  133.     <div class="{{ "funradio" in site_url ? "container" : "" }}">
  134.         <h2 class="text-center button-text font-bold mid-section-pb">{{'quiz result'|trans}}</h2>
  135.         {% if result.embed %}
  136.             <div class="embed">
  137.                 <div class="youtube">
  138.                     {{ result.embed|raw }}
  139.                 </div>
  140.             </div>
  141.         {% endif %}
  142.         {% include 'BaitPollBundle:Poll:fragments/photo.html.twig' with {'photo': result.photo, 'source': result.photoSource, 'link': result.photoSourceLink} %}
  143.         <h2 style="padding-top:1em; font-weight:normal; text-align: center">
  144.             {{ result.description|raw}}
  145.         </h2>
  146.     </div>
  147. </div>
  148. {% endif %}