vendor/uvdesk/support-center-bundle/Resources/views/Knowledgebase/article.html.twig line 1

Open in your IDE?
  1. {% extends "@UVDeskSupportCenter/Templates/layout.html.twig" %}
  2. {% if article.slug %}
  3.     {% block canonical %}{{ url('helpdesk_knowledgebase_read_slug_article', {'slug':article.slug }) }}{% endblock %}
  4.     {% block ogcanonical %}{{ url('helpdesk_knowledgebase_read_slug_article', {'slug':article.slug }) }}{% endblock %}
  5. {% endif %}
  6. {% block title %}{{ article.metaTitle ? article.metaTitle : article.name }}{% endblock %}
  7. {% block ogtitle %}{{ article.metaTitle ? article.metaTitle : article.name }}{% endblock %}
  8. {% block twtitle %}{{ article.metaTitle ? article.metaTitle : article.name }}{% endblock %}
  9. {% block metaDescription %}{{ article.metaDescription ? article.metaDescription : uvdesk_service.createConentToKeywords(article.content, 255, true)|join(' ') }}{% endblock %}
  10. {% block metaKeywords %}{{ article.keywords ? : uvdesk_service.createConentToKeywords(article.content) }}{% endblock %}
  11. {% block body %}
  12.     <div class="uv-paper-article">
  13.         <div class="uv-paper-section">
  14.             <section>
  15.                 <h1 {% if article.stared %}class="uv-starred"{% endif %}>{{ article.name }}</h1>
  16.                 <p>{{ article.content |raw }}</p>
  17.                     {# Subartículos: se muestran debajo del contenido principal #}
  18.                 {% if subarticles is defined and subarticles is not empty %}
  19.                     <hr>
  20.                     <h2>{{ 'Related sections'|trans }}</h2>
  21.                     <div class="uv-subarticles-list">
  22.                         {% for sub in subarticles %}
  23.                             <article class="uv-subarticle">
  24.                                 <h3>{{ sub.name }}</h3>
  25.                                 <div class="uv-subarticle-content">
  26.                                     {{ sub.content|raw }}
  27.                                 </div>
  28.                             </article>
  29.                         {% endfor %}
  30.                     </div>
  31.                 {% endif %}
  32.                 <div class="uv-author">
  33.                     {% if articleAuthor is defined and articleAuthor is not empty %}
  34.                         <div class="uv-author-avatar">
  35.                             {% if articleAuthor.user.profileImage is defined and articleAuthor.user.profileImage %}
  36.                                 <img src="{{articleAuthor.user.profileImage}}">
  37.                             {% else %}
  38.                                 <img src="{{ asset(default_customer_image_path) }}">
  39.                             {% endif %}
  40.                         </div>
  41.                         <div class="uv-author-info">
  42.                             <p>{{ articleAuthor.firstName | capitalize }} {{ articleAuthor.lastName | capitalize }}</p>
  43.                             <p><span>{{"Published on"|trans}} -</span> {{dateAdded}}</p>
  44.                         </div>
  45.                     {% endif %}
  46.                 </div>
  47.             </section>
  48.             {% if feedbacks is defined and feedbacks.enabled == true %}
  49.                 <section id="feedbacks" class="article-feedbacks">
  50.                     {% if feedbacks.submitted == true %}
  51.                         <p>Thank you for your feedback!</p>
  52.                     {% endif %}
  53.                 </section>
  54.             {% endif %}
  55.             {# {% set companyDisqus = application_service.getCompanyDisqus() %}
  56.             {% if companyDisqus is defined and companyDisqus is not empty %}
  57.                 {% if companyDisqus.ticketConversion is defined and companyDisqus.ticketConversion == true %}
  58.                     <section class="disqus-thread">
  59.                         {{ knp_disqus_render(companyDisqus.website, {'id': "article-{{ article.id }}", 'limit': 10, 'newCommentCallbackFunctionName': 'disqusCommentCallback'}) }}
  60.                     </section>
  61.                     <script type="text/javascript">
  62.                         function disqusCommentCallback() {
  63.                             // Set delay for disqus to update comments
  64.                             setTimeout(function() {
  65.                                 $.get("{{ url('app_webhook_callback', {'applicationRouteName': 'disqus-engage'}) }}");
  66.                             }, 2000);
  67.                         }
  68.                     </script>
  69.                 {% else %}
  70.                     <section class="disqus-thread">
  71.                         {{ knp_disqus_render(companyDisqus.website, {'id': "article-{{ article.id }}", 'limit': 10}) }}
  72.                     </section>
  73.                 {% endif %}
  74.             {% endif %} #}
  75.         </div>
  76.         {% include "@UVDeskSupportCenter/Templates/sidepanel.html.twig" %}
  77.     </div>
  78.     {{ parent() }}
  79. {% endblock %}
  80. {% block footer %}
  81.     {{ parent() }}
  82.     {# Article Feedbacks #}
  83.     {% if feedbacks is defined and feedbacks.enabled == true and feedbacks.submitted == false %}
  84.         <script id="article_feedback_template" type="text/template">
  85.             <p>Was this article helpful?</p>
  86.             <ul>
  87.                 <li class="uv-btn-small article-badge-pta" data-feedback="positive">Yes</li>
  88.                 <li class="uv-btn-small article-badge-pta" data-feedback="negative">No</li>
  89.             </ul>
  90.         </script>
  91.         <script type="text/javascript">
  92.             $(function() {
  93.                 var ArticleFeedback = Backbone.View.extend({
  94.                     el: $("#feedbacks"),
  95.                     feedbacks: {positive: 0, negative: 0, collection: []},
  96.                     template: _.template($("#article_feedback_template").html()),
  97.                     events: {
  98.                         'click .article-badge-pta': 'ratingsPTA',
  99.                     },
  100.                     initialize: function() {
  101.                         {% if feedbacks is defined and feedbacks.article is not empty %}
  102.                             this.feedbacks = {{ feedbacks.article|json_encode|raw }};
  103.                         {% endif %}
  104.                         this.render();
  105.                     },
  106.                     render: function() {
  107.                         this.$el.html(this.template());
  108.                     },
  109.                     ratingsPTA: function(e) {
  110.                         var self = this;
  111.                         var feedbackType = $(e.currentTarget).data('feedback');
  112.                         $.ajax({
  113.                             url: "{{ url('helpdesk_knowledgebase_rate_article', {'articleId': article.id}) }}",
  114.                             method: 'POST',
  115.                             data: {
  116.                                 feedback: feedbackType,
  117.                             },
  118.                             success: function(response) {
  119.                                 this.$el.html('');
  120.                                 app.appView.renderResponseAlert(response);
  121.                             },
  122.                             error: function(response) {
  123.                                 response = $.parseJSON(response.responseText);
  124.                                 // app.appView.hideLoader();
  125.                                 app.appView.renderResponseAlert(response);
  126.                             }
  127.                         });
  128.                     },
  129.                 });
  130.                 var articleFeedback = new ArticleFeedback();
  131.             });
  132.         </script>
  133.     {% endif %}
  134. {% endblock %}