settings_index.tpl 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <script>
  2. $(document).ready(function () {
  3. $.ajax({
  4. url: '{{ web_admin_ajax_url }}?a=version',
  5. success: function (version) {
  6. $(".admin-block-version").html(version);
  7. }
  8. });
  9. {% if _u.is_admin %}
  10. (function (CKEDITOR) {
  11. CKEDITOR.replace('extra_content');
  12. var extraContentEditor = CKEDITOR.instances.extra_content;
  13. $('button.admin-edit-block').on('click', function (e) {
  14. e.preventDefault();
  15. var $self = $(this);
  16. var extraContent = $.ajax('{{ _p.web_ajax }}admin.ajax.php', {
  17. type: 'post',
  18. data: {
  19. a: 'get_extra_content',
  20. block: $self.data('id')
  21. }
  22. });
  23. $.when(extraContent).done(function (content) {
  24. extraContentEditor.setData(content);
  25. $('#extra-block').val($self.data('id'));
  26. $('#modal-extra-title').text($self.data('label'));
  27. $('#modal-extra').modal('show');
  28. });
  29. });
  30. })(window.CKEDITOR);
  31. {% endif %}
  32. });
  33. </script>
  34. <section id="settings">
  35. {% set columns = 2 %}
  36. {% for block_item in blocks %}
  37. {% if loop.first or loop.index0 is divisibleby(columns) %}
  38. <div class="row">
  39. {% endif %}
  40. <div id="tabs-{{ loop.index }}" class="col-md-6">
  41. <div class="panel panel-default {{ block_item.class }}">
  42. <div class="panel-heading">
  43. {{ block_item.icon }} {{ block_item.label }}
  44. {% if block_item.editable and _u.is_admin %}
  45. <button type="button" class="btn btn-link btn-sm admin-edit-block pull-right"
  46. data-label="{{ block_item.label }}" data-id="{{ block_item.class }}">
  47. <img src="{{ "edit.png"|icon(22) }}" width="22" height="22" alt="{{ "Edit"|get_lang }}"
  48. title="{{ "Edit"|get_lang }}"/>
  49. </button>
  50. {% endif %}
  51. </div>
  52. <div class="panel-body">
  53. <div style="display: block;">
  54. {{ block_item.search_form }}
  55. </div>
  56. {% if block_item.items is not null %}
  57. <div class="block-items-admin">
  58. <ul class="list-items-admin">
  59. {% for url in block_item.items %}
  60. <li>
  61. <a href="{{ url.url }}">
  62. {{ url.label }}
  63. </a>
  64. </li>
  65. {% endfor %}
  66. </ul>
  67. </div>
  68. {% endif %}
  69. {% if block_item.extra is not null %}
  70. <div>
  71. {{ block_item.extra }}
  72. </div>
  73. {% endif %}
  74. {% if block_item.extraContent %}
  75. <div>{{ block_item.extraContent }}</div>
  76. {% endif %}
  77. </div>
  78. </div>
  79. </div>
  80. {% if loop.last or loop.index is divisibleby(columns) %}
  81. </div>
  82. {% endif %}
  83. {% endfor %}
  84. </section>
  85. {% if _u.is_admin %}
  86. <div class="modal fade" id="modal-extra">
  87. <div class="modal-dialog">
  88. <div class="modal-content">
  89. <div class="modal-header">
  90. <button type="button" class="close" data-dismiss="modal" aria-label="{{ 'Close'|get_lang }}">
  91. <span aria-hidden="true">&times;</span>
  92. </button>
  93. <h4 class="modal-title" id="modal-extra-title">{{ 'Blocks'|get_lang }}</h4>
  94. </div>
  95. <div class="modal-body">
  96. {{ extraDataForm }}
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. {% endif %}