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