templates/common/campaign/view.html.twig line 1

Open in your IDE?
  1. {% extends '@Public/common/general-layout.html.twig' %}
  2. {% set user = campaign.user %}
  3. {% set profile = user.profile %}
  4. {% set share_text = generate_share_text(user)|trans %}
  5. {% set page_url = url(constant('FMT\\Application\\Controller\\Common\\CampaignController::ROUTE_VIEW'), {id: campaign.id}) %}
  6. {% set avatar = asset(get_user_avatar(user)) %}
  7. {% set fb_share_link = generate_share_link({'u': page_url,}, 'fb') %}
  8. {% set tw_share_link = generate_share_link({'url': page_url, 'text': share_text}, 'tw') %}
  9. {% set endDate = campaign.endDate ? campaign.endDate|textual_month_format : 'fmt.widgets.campaign.header.not_set'|trans %}
  10. {% set page_dicription = 'fmt.widgets.campaign.header.goal'|trans({'%price%': campaign.estimatedCost|price}) %}
  11. {% set page_dicription = page_dicription ~ ' ' ~ 'fmt.widgets.campaign.header.ends'|trans({'%date%': endDate}) %}
  12. {% set page_dicription = page_dicription ~ ' ' ~ 'fmt.widgets.campaign.header.progress'|trans({'%percent%': campaign.percentOfFunded|percent}) %}
  13. {% block meta %}
  14.     {% include '@Public/common/campaign/_sharing_meta.html.twig' %}
  15. {% endblock meta %}
  16. {% block content %}
  17. <section class="content campaign">
  18.     {% include '@Public/common/campaign/_paused_banner.html.twig' with {campaign: campaign} %}
  19.     <div class="row">
  20.         <div class="col-md-8">
  21.             {% include '@Public/components/campaign/studentInfoFull.html.twig' %}
  22.         </div>
  23.         <div class="col-md-4">
  24.             {% include '@Public/components/campaign/widget.html.twig' with {showAllBooks: true} %}
  25.             <div class="share-buttons-box">
  26.                 {% if is_granted(constant('FMT\\Application\\Voter\\CampaignVoter::CAN_SHARE_FB'), campaign) %}
  27.                     <a href="{{ fb_share_link }}"
  28.                        class="btn btn-primary facebook-button share-button"
  29.                        role="button"
  30.                        target="_blank"
  31.                        data-social="share"
  32.                     >
  33.                         <i class="fa fa-facebook-official"></i> {{ 'fmt.widgets.campaign.social.facebook'|trans }}
  34.                     </a>
  35.                 {% endif %}
  36.                 {% if is_granted(constant('FMT\\Application\\Voter\\CampaignVoter::CAN_SHARE_TW'), campaign) %}
  37.                     <a href="{{ tw_share_link }}"
  38.                        class="btn btn-info twitter-button share-button"
  39.                        role="button"
  40.                        target="_blank"
  41.                        data-social="share"
  42.                     >
  43.                         <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" style="margin-bottom: -3px; fill: #fff; display: inline-block; height: 16px;">
  44.                             <path d="M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm297.1 84L257.3 234.6 379.4 396H283.8L209 298.1 123.3 396H75.8l111-126.9L69.7 116h98l67.7 89.5L313.6 116h47.5zM323.3 367.6L153.4 142.9H125.1L296.9 367.6h26.3z"/>
  45.                         </svg>
  46.                         {{ 'fmt.widgets.campaign.social.twitter'|trans }}
  47.                     </a>
  48.                 {% endif %}
  49.             </div>
  50.         </div>
  51.     </div>
  52.     <div class="box box-primary books-box books-box-view">
  53.         <div class="box-header with-border">
  54.             <div class="row">
  55.                 <div class="col-xs-12 col-sm-10 margin-bottom-10">
  56.                     <h3 class="box-title">
  57.                     {{ 'fmt.campaign.textbooks.title'|trans }}
  58.                     {% if campaign.endDate|date('U') < "now"|date('U') %}
  59.                     
  60.                         <small>Campaign has ended.</small>
  61.                    
  62.                     {% else %}
  63.                    
  64.                         <small>{{ 'fmt.campaign.textbooks.title_small'|trans }}</small>
  65.                     
  66.                     {% endif %}
  67.                     </h3>
  68.                    
  69.                 </div>
  70.                 <div class="col-xs-2">
  71.                     <div class="pull-right box-tools">
  72.                         {% if is_granted(constant('FMT\\Application\\Voter\\CampaignVoter::CAN_FUND'), campaign) and
  73.                             campaign.isActive and (userIsNotStudent or user.id == activeUserId or app.user == null) %}
  74.                             <a class="btn btn-primary btn-sm btn-fix-text fmt-lightgreen" href="{{ donate_user_link(user) }}">
  75.                                 {{ campaign|fund_student_name|trans({'%name%': campaign.user.profile.firstName}) }}
  76.                             </a>
  77.                         {% endif %}
  78.                     </div>
  79.                 </div>
  80.             </div>
  81.         </div>
  82.         <div class="box-body">
  83.             <div class="table-responsive no-padding">
  84.                 <table class="table table-striped">
  85.                     <thead>
  86.                     <tr>
  87.                         <th style="width: 10px">#</th>
  88.                         <th>{{ 'fmt.campaign.textbooks.table.header.title'|trans }}</th>
  89.                         
  90.                         <th class="mobile-hide">Item Number</th>
  91.                         <th class="text-right">{{ 'fmt.campaign.textbooks.table.header.cost'|trans }}</th>
  92.                        <th class="text-right">{{ 'fmt.campaign.textbooks.table.header.tax'|trans }}</th>
  93.                     </tr>
  94.                     </thead>
  95.                     <tbody>
  96.                     {% for key, book in campaign.books %}
  97.                         {{ include('@Public/components/campaign/bookRow.html.twig', {'item': book, 'key': key + 1}) }}
  98.                     {% endfor %}
  99.                     </tbody>
  100.                     {% if is_granted(constant('FMT\\Application\\Voter\\CampaignVoter::CAN_SEE_SUMMARY'), campaign) %}
  101.                         <tfoot class="summary">
  102.                         <!--
  103.                         <tr>
  104.                             <td></td>
  105.                             <td colspan="3" class="mobile-hide"></td>
  106.                             <td class="text-right">{{ 'fmt.campaign.textbooks.table.footer.shipping'|trans }}: {{ campaign.shippingName }}</td>
  107.                             <td class="text-right">{{ campaign.estimatedShipping|price }}</td>
  108.                         </tr>
  109.                        
  110.                         <tr>
  111.                             <td></td>
  112.                             <td colspan="3" class="mobile-hide"></td>
  113.                             <td class="text-right">{{ 'fmt.campaign.textbooks.table.footer.tax'|trans }}</td>
  114.                             <td data-field="estimated-tax" class="text-right">{{ campaign.estimatedTax|price }}</td>
  115.                             <td></td>
  116.                         </tr>
  117.                          -->
  118.                         <tr>
  119.                             
  120.                             <td colspan="3" class="mobile-hide"></td>
  121.                             <td colspan="2" class="text-right">{{ 'fmt.campaign.textbooks.table.footer.total'|trans }}</td>
  122.                             <td class="text-right">{{ campaign.estimatedCost|price }}</td>
  123.                         </tr>
  124.                         <!--
  125.                         <tr>
  126.                             <td></td>
  127.                             <td colspan="3" class="mobile-hide"></td>
  128.                             <td class="text-right">{{ 'fmt.campaign.textbooks.table.footer.purchased'|trans }}</td>
  129.                             <td class="text-right">{{ campaign.purchasedTotal|price }}</td>
  130.                         </tr>
  131.                         
  132.                         <tr>
  133.                             <td></td>
  134.                             <td colspan="3" class="mobile-hide"></td>
  135.                             <td class="text-right">{{ 'fmt.campaign.textbooks.table.footer.funded'|trans }}</td>
  136.                             <td class="text-right">{{ campaign.fundedTotal|price }}</td>
  137.                         </tr>
  138.                         -->
  139.                         <tr>
  140.                             
  141.                             <td colspan="3" class="mobile-hide"></td>
  142.                             <td colspan="2" class="text-right">{{ 'fmt.campaign.textbooks.table.footer.remaining'|trans }}</td>
  143.                             <td class="text-right">{{ campaign.allowedDonateAmount|price }}</td>
  144.                         </tr>
  145.                         <!--
  146.                         <tr>
  147.                             <td></td>
  148.                             <td colspan="3" class="mobile-hide"></td>
  149.                             <td colspan="3"><small>{{ 'fmt.campaign.textbooks.table.note.shipping'|trans|raw }}</small></td>
  150.                         </tr>
  151.                         -->
  152.                         </tfoot>
  153.                     {% endif %}
  154.                 </table>
  155.             </div>
  156.         </div>
  157.     </div>
  158. </section>
  159. {% endblock content %}
  160. {% block footer_scripts %}
  161.     {#    TODO recheck template#}
  162.     {{ encore_entry_script_tags('common.campaign.view') }}
  163.     {{ encore_entry_script_tags('common.campaign.view_cart') }}
  164. {% endblock footer_scripts %}