templates/Slivki/sale/sale.html.twig line 262

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block stylesheets %}
  3.     {{ parent() }}
  4.     <style type="text/css">
  5.         #sidebarShowMore{display:none;}
  6.     </style>
  7.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.css" />
  8. {% endblock %}
  9. {% block header %}
  10.     {% if isMobileDevice() %}
  11.         {% include 'header_sales_mobile.html.twig' %}
  12.     {% else %}
  13.         {% include 'header_sales.html.twig' with {'withSearch': true} %}
  14.     {% endif %}
  15. {% endblock %}
  16. {% block ogimage %}
  17.     <meta property="og:image" content="{{ app.request.getSchemeAndHttpHost() }}{{ getImageURL(sale.getIcon(), 338, 220)|url_encode|replace({'%2F': '/'}) }}" />
  18.     <meta property="og:image:width" content="338"/>
  19.     <meta property="og:image:height" content="220"/>
  20. {% endblock %}
  21. {% block left_sidebar %}
  22.     {% if not isFlier %}
  23.         {% include 'left_sidebar.html.twig' %}
  24.     {% endif %}
  25. {% endblock %}
  26. {% block mainColumnClass %}
  27.     {% if isFlier %}{{ parent() }} one-column{% else %}{{ parent() }}{{ saleVersion.getDescriptionBackgroundUrl() ? ' sale-with-background' }}{% endif %}
  28. {% endblock %}
  29. {% block mainColumnParameters %}
  30.     {% if not isMobileDevice() %}
  31.         {{ saleVersion.getDescriptionBackgroundUrl() ? 'style=background:url(' ~ saleVersion.getDescriptionBackgroundUrl()  ~ ')' }}
  32.     {% endif %}
  33. {% endblock %}
  34. {% block main_content %}
  35.     {% if parentCategoryList and saleVersion.getDescriptionBackgroundUrl() == '' %}
  36.         {% include 'Slivki/breadcrumbs.html.twig' with { 'parentCategoryList': parentCategoryList } only %}
  37.     {% endif %}
  38.     <div class="clearfix"></div>
  39.     {% set ratingWithCount = getEntityRatingWithCount(constant('Slivki\\Entity\\Category::SALE_CATEGORY_ID'), sale.getID()) %}
  40.     <div class="saleDetail">
  41.         {% if sale.getID() == 280659 %}
  42.             <img height="1" width="1" src="https://mc.admetrica.ru/show?cmn_id=10141&plt_id=27346&crv_id=69064&evt_t=render&ad_type=banner&rnd=%system.random%" style="display:none;">
  43.         {% endif %}
  44.         {% if saleVersion.getDescriptionTitleBackgroundUrl() %}
  45.             <div id="saleTitleBlock" class="with-share-block" data-pixel={{ sale.getID() == constant('Slivki\\Entity\\Offer::BETERA_SALE_NEWS_ID') ? 'https://amc.yandex.ru/show?cmn_id=26372&plt_id=194140&crv_id=464044&evt_t=render&ad_type=banner&rnd=%system.random%' }}>
  46.                 {% include 'Slivki/share_block.html.twig' %}
  47.                 <img src="{{ saleVersion.getDescriptionTitleBackgroundUrl() }}" />
  48.                 <a href="{{ base_url }}/am-fotogid">Фотогиды</a>
  49.                 <h1>
  50.                     {% if sale.getID() == 287031  %}
  51.                         Стань агентом банка! <br> Рекомендуй другу карточку <nobr>«1-2-3»</nobr> и оба получите по <nobr>5 рублей!</nobr>
  52.                     {% else %}
  53.                         {{ sale.getTitle() }}
  54.                     {% endif %}
  55.                 </h1>
  56.                 <div>
  57.                     {{ sale.getSince()|date('d.m.Y') }}
  58.                     <i class="slivki-icon-eye"></i>{{ visitCount }}
  59.                     {% if commentsAmount > 5  %}
  60.                         <i class="slivki-icon-comment-empty"></i>{{ commentsAmount }}
  61.                     {% endif %}
  62.                 </div>
  63.             </div>
  64.         {% else %}
  65.             {% set ratingPercentage =  ratingWithCount.rating * 100 / 5 %}
  66.             <div class="float-right text-muted" style="margin-left: 5px">
  67.                 <div class="star-ratings-css">
  68.                     <div class="star-ratings-css-top" style="width: {{ ratingPercentage }}%"><span>★</span><span>★</span><span>★</span><span>★</span><span>★</span></div>
  69.                     <div class="star-ratings-css-bottom"><span>★</span><span>★</span><span>★</span><span>★</span><span>★</span></div>
  70.                 </div>
  71.                 ({{ ratingWithCount.amount }})
  72.             </div>
  73.             <div class="text-muted float-right">
  74.                 {{ sale.getSince()|date('d.m.Y') }}
  75.                 <i class="slivki-icon-eye"></i>{{ visitCount }}
  76.                 {% if commentsAmount > 5  %}
  77.                     <i class="slivki-icon-comment-empty"></i>{{ commentsAmount }}
  78.                 {% endif %}
  79.             </div>
  80.             <div class="clear"></div>
  81.         {% endif %}
  82.         {% if saleVersion.getFancyDescription() and saleVersion.getFancyDescription().getDescription()|raw != '' %}
  83.             <div id="saleFancyDescriptionBlock">
  84.                 {{ saleVersion.getFancyDescription().getDescription()|raw }}
  85.             </div>
  86.             <div id="saleCurledPage"><span>&nbsp;</span><i></i></div>
  87.         {% endif %}
  88.         <div class="saleBody" data-oid="{{ sale.getID() }}">
  89.             {% if saleVersion.getDescriptionBackgroundUrl() != '' %}
  90.                 {% include 'Slivki/breadcrumbs.html.twig' with { 'parentCategoryList': parentCategoryList } only %}
  91.                 <div class="clear"></div>
  92.             {% endif %}
  93.             {{ descriptions|raw }}
  94.             {% set gazurl = sale.getGszurl() %}
  95.             {% if gazurl is not null %}
  96.                 <p><b>Общереспубликанский банк вакансий: </b> <a href="{{ gazurl }}" rel="nofollow">{{ gazurl }}</a></p>
  97.             {% endif %}
  98.             {% if sale.isShowMap() %}
  99.                 <div id="saleGeoLocationData" data-json="{{ saleGeoLocationData }}"></div>
  100.                 <div id="saleDetailsMapWrapper" class="category-map-wrapper">
  101.                     <div id="saleDetailsMap" class="category-map"></div>
  102.                     <div id="zoomIn"></div>
  103.                     <div id="zoomOut"></div>
  104.                     <a id="setUserLocationBtn" href="#" class="capsuled">Указать местоположение</a>
  105.                     <a id="mapEnterFullscreen" href="#" class="fullscreen-map-button">Развернуть</a>
  106.                     <a id="mapExitFullscreen" href="#" class="fullscreen-map-button">Свернуть</a>
  107.                 </div>
  108.             {% endif %}
  109.             <div class="saleFooterDetail">
  110.                 {% include 'Slivki/share_stat.html.twig' %}
  111.                 <div class="date">
  112.                     {{ sale.getSince()|date('d.m.Y') }}
  113.                     <span data-toggle="tooltip" data-placement="top" data-original-title='Просмотров за {{ daysFromStart }} {{ ['день', 'дня', 'дней']|plural(daysFromStart) }}'>
  114.                         <i class="slivki-icon-eye"></i>{{ visitCount }} ({{ dayVisitCount }} за сутки)
  115.                     </span>
  116.                 </div>
  117.                 {% if app.user %}
  118.                     <div class="vote-entity-block">
  119.                         {% if userVote == 0 %}
  120.                             <div class="vote-pls">Оцените, пожалуйста, эту статью:</div>
  121.                         {% endif %}
  122.                         <div class="your-vote {{ userVote == 0 ? ' hidden' }}">Ваша оценка: <span id="yourVote">{{ userVote }}</span></div>
  123.                         {% set ratingWithCount = getEntityRatingWithCount(constant('Slivki\\Entity\\Category::SALE_CATEGORY_ID'), sale.getID()) %}
  124.                         {% set ratingPercentage =  userVote == 0 ? 0 : ratingWithCount.rating * 100 / 5 %}
  125.                         {% apply spaceless %}
  126.                             <div class="star-ratings-css">
  127.                                 <div class="star-ratings-css-top" style="width: {{ ratingPercentage }}%">
  128.                                     {% for i in 1..5 %}
  129.                                         <span data-id="{{ i }}">★</span>
  130.                                     {% endfor %}
  131.                                 </div>
  132.                                 <div class="star-ratings-css-bottom">
  133.                                     {% for i in 1..5 %}
  134.                                         <span data-id="{{ i }}">☆</span>
  135.                                     {% endfor %}
  136.                                 </div>
  137.                             </div>
  138.                         {% endapply %}
  139.                         <span class="vote-avg-rating {{ userVote == 0 ? ' hidden' }}">(<span id="avgSaleRating">{{ ratingWithCount.rating|number_format(1) }}</span>)</span>
  140.                         <div class="total-votes {{ userVote == 0 ? ' hidden' }}">Всего голосов: <span id="totalSaleVotesCnt">{{ ratingWithCount.ratingCount }}</span></div>
  141.                     </div>
  142.                 {% endif %}
  143.                 <div id="readabilityCheckpoint"></div>
  144.                 {% if commentsAmount > 0 %}
  145.                     <a href="javascript:void(0)" id="showSaleCommentsButton" class="button">Отзывы ({{ commentsAmount }})</a>
  146.                 {% else %}
  147.                     <span class="addVoteLink button mb-1" id="addVoteLink" data-oid="{{ sale.getID() }}" data-type="{{ constant('Slivki\\Entity\\Comment::TYPE_SALE_COMMENT') }}" data-action="comment_add" data-toggle="modal" data-target="{{ app.user ? '#addVoteBox' : '#onlyRegistered' }}" >Добавить отзыв</span>
  148.                 {% endif %}
  149.                 {% if not isMobileDevice() and sale.getVersions().count() > 1 %}
  150.                     <div id="saleHistory">
  151.                         <a class="selected" href="javascript:void(0)">{{ isFlier ? 'Архив листовок' : 'Архив новости' }}</a>
  152.                         <span></span>
  153.                         <div id="saleHistoryBox">
  154.                             <div class="sale-history-arrow-box sale-history-box">
  155.                                 {% for version in sale.getVersions() %}
  156.                                     <a {{ version.getID() == saleVersion.getID() ? 'class=active' }} href="{{ app.request.pathInfo }}?version={{ version.getID() }}">{{ version.getName() }}</a>
  157.                                 {% endfor %}
  158.                             </div>
  159.                         </div>
  160.                     </div>
  161.                 {% endif %}
  162.                 {% if director %}
  163.                     <p class="director-info"><span> {{ director.getLegalEntity()}} УНП: {{ director.getTaxID() }} </span> </p>
  164.                 {% endif %}
  165.                 {% include 'Slivki/subscribe_block.html.twig' %}
  166.                 {% include 'Slivki/breadcrumbs_footer.html.twig' with { 'parentCategoryList': parentCategoryList, 'title': sale.getTitle() } only %}
  167.                 <div class="clear"></div>
  168.             </div>
  169.         </div>
  170.     </div>
  171.     <input id="stock-id" value="{{ sale.getID() }}">
  172.     <input type="hidden" id="saleVersionID" value="{{ saleVersion.getID() }}">
  173. {% endblock %}
  174. {% block javascripts %}
  175.     {{ parent() }}
  176.     <script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.js"></script>
  177.     <script src="/js/readability.js?v=4" type="text/javascript"></script>
  178.     <script src="//api-maps.yandex.ru/2.1.73/?lang=ru-RU" type="text/javascript"></script>
  179.     <script type="text/javascript">
  180.         $(document).ready(function () {
  181.             $(document).off( "click", "#sidebarShowMoreWrap");
  182.             {% if commentsAmount > 0 %}
  183.                 $(document).on("click", "#showSaleCommentsButton", function() {
  184.                     if ($('.votes').length) {
  185.                         $('html,body').animate({scrollTop: $("#saleCommentsBlock").offset().top - 100}, 'slow');
  186.                         return false;
  187.                     }
  188.                     return false;
  189.                 });
  190.             {% endif %}
  191.             $.get("/get_comment_box/{{ constant('Slivki\\Entity\\Comment::TYPE_SALE_COMMENT') }}/{{ sale.getID() }}", function (data) {
  192.                 $('#saleCommentsBlock').html(data);
  193.                 $('#saleCommentsBlock').css('visibility', 'visible');
  194.                 initVoteBox(true);
  195.                 initTooltip();
  196.                 proceedComments({{ app.user ? app.user.getID() : 0 }});
  197.                 uploadPhoto('/comment/image_upload', '/comment/image_remove');
  198.             });
  199.             {% if app.user %}
  200.             $('.vote-entity-block .star-ratings-css span').click(function () {
  201.                 var rating = $(this).attr('data-id');
  202.                 var starRatingBlock = $('.vote-entity-block .star-ratings-css');
  203.                 $('.vote-entity-block .star-ratings-css-top').css('width', rating * 20 + '%');
  204.                 $.get('/profile/vote_sale/' + {{ sale.getID }} + '/' + rating, function (data) {
  205.                     $('#yourVote').html(rating);
  206.                     $('#avgSaleRating').html(parseFloat(data.rating).toFixed(1));
  207.                     $('#totalSaleVotesCnt').html(data.ratingCount);
  208.                     $('.vote-pls').remove();
  209.                     $('.vote-avg-rating').removeClass('hidden');
  210.                     $('.total-votes').removeClass('hidden');
  211.                     $('.your-vote').removeClass('hidden');
  212.                 });
  213.                 return false;
  214.             });
  215.             {% endif %}
  216.         });
  217.     </script>
  218. {% endblock %}
  219. {% block popups %}
  220.     {{ parent() }}
  221.     {% if not isMobileDevice() %}
  222.         {% if app.user %}
  223.             {% include 'Slivki/popups/add_comment_popup.html.twig' with {'id': 'addVoteBox'} %}
  224.             {% include 'Slivki/popups/edit_comment_popup.html.twig' with {'id': 'editVoteBox'} %}
  225.         {% else %}
  226.             {% include 'Slivki/popups/comment_only_registered_popup.html.twig' with {'id': 'onlyRegistered'} %}
  227.         {% endif %}
  228.     {% endif %}
  229.     {% include 'Slivki/popups/video_guide_popup.html.twig' %}
  230. {% endblock %}
  231. {% block assetsBottom %}
  232.     {{ parent() }}
  233.     <script type="text/javascript" src="//yastatic.net/share2/share.js" charset="utf-8"></script>
  234. {% endblock %}
  235. {% block bottomContentBlock %}
  236.     <div class="clear"></div>
  237.     <div class="after-content-block content">
  238.         <div class="sale-relations-block-list">
  239.             {% apply spaceless %}
  240.                 {% include 'Slivki/sale/sale_relations_block.html.twig' with {'title': 'Еще по теме', 'saleList': relatedSales|last} %}
  241.                 {% include 'Slivki/sale/sale_relations_block.html.twig' with {'title': 'Популярные', 'saleList': relatedSales[constant('Slivki\\Repository\\SaleRepository::POPULAR_SALE_CATEGORY_ID')] } %}
  242.                 {% include 'Slivki/sale/sale_relations_block.html.twig' with {'title': 'Смотрите также', 'saleList': relatedSales[constant('Slivki\\Entity\\Category::SALE_VIDEO_GUIDE_CATEGORY_ID')]} %}
  243.             {% endapply %}
  244.         </div>
  245.         <div id="saleCommentsBlock" style="visibility: hidden"></div>
  246.     </div>
  247. {% endblock %}