pages.html.twig 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. {% extends 'partials/base.html.twig' %}
  2. {% macro spanToggle(input, length) %}
  3. {{ (repeat('  ', (length - input|length) / 2) ~ input ~ repeat('  ', (length - input|length) / 2))|raw }}
  4. {% endmacro %}
  5. {% macro loop(page, depth, twig_vars) %}
  6. {% import _self as self %}
  7. {% set config = twig_vars['config'] %}
  8. {% set separator = config.system.param_sep %}
  9. {% set display_field = config.plugins.admin.pages_list_display_field %}
  10. {% set base_url = twig_vars['base_url_relative'] %}
  11. {% set base_url_relative_frontend = twig_vars['base_url_relative_frontend'] %}
  12. {% set base_url_simple = twig_vars['base_url_simple'] %}
  13. {% set admin_route = twig_vars['admin_route'] %}
  14. {% set admin_lang = twig_vars['admin_lang'] %}
  15. {% set warn = twig_vars['warn'] %}
  16. {% set uri = twig_vars['uri'] %}
  17. {% if page.header.admin.children_display_order == 'collection' and page.header.content.order.by %}
  18. {% if page.header.content.order.custom %}
  19. {% set pcol = page.children().order(page.header.content.order.by, page.header.content.order.dir|default('asc'), page.header.content.order.custom) %}
  20. {% else %}
  21. {% set pcol = page.children().order(page.header.content.order.by, page.header.content.order.dir|default('asc')) %}
  22. {% endif %}
  23. {% else %}
  24. {% set pcol = page.children() %}
  25. {% endif %}
  26. {% for p in pcol %}
  27. {% set description = (not p.page ? "PLUGIN_ADMIN.FOLDER"|tu ~ ' • ' : "PLUGIN_ADMIN.PAGE"|tu ~ ' • ') ~
  28. (p.modular ? "PLUGIN_ADMIN.MODULAR"|tu ~ ' • ' : '') ~
  29. (p.routable ? "PLUGIN_ADMIN.ROUTABLE"|tu ~ ' • ' : "PLUGIN_ADMIN.NON_ROUTABLE"|tu ~ ' • ') ~
  30. (p.visible ? "PLUGIN_ADMIN.VISIBLE"|tu ~ ' • ' : "PLUGIN_ADMIN.NON_VISIBLE"|tu ~ ' • ') ~
  31. (p.published ? "PLUGIN_ADMIN.PUBLISHED"|tu ~ ' • ' : "PLUGIN_ADMIN.NON_PUBLISHED"|tu ~ ' • ') %}
  32. {% set page_url = getPageUrl(p) %}
  33. <li class="page-item" data-nav-id="{{ p.route }}">
  34. <div class="row page-item__row">
  35. <span class="page-item__toggle" {{ p.children(0).count > 0 ? 'data-toggle="children"' : ''}}>
  36. <i class="page-icon fa fa-fw fa-circle-o {{ p.children(0).count > 0 ? 'children-closed' : ''}} {{ p.modular ? 'modular' : (not p.routable ? 'not-routable' : (not p.visible ? 'not-visible' : (not p.page ? 'folder' : ''))) }}"></i>
  37. </span>
  38. <div class="page-item__content">
  39. <div class="page-item__content-name">
  40. <span data-hint="{{ description|trim(' &bull; ')|raw }}" class="hint--top page-item__content-hint">
  41. {% set page_label = attribute(p.header, display_field)|defined(attribute(p, display_field))|defined(p.title)|default(p.slug|titleize) %}
  42. <a href="{{ page_url }}" class="page-edit">{{ page_label|e }}</a>
  43. </span>
  44. {% if p.language %}
  45. <span class="badge lang {% if p.language == admin_lang %}info{% endif %}">{{p.language}}</span>
  46. {% endif %}
  47. {% if p.home %}
  48. <span class="page-home"><i class="fa fa-home"></i></span>
  49. {% endif %}
  50. </div>
  51. <p class="page-route">{{ p.header.routes.default ?: p.route }} <span class="spacer"><i class="fa fa-long-arrow-right"></i></span> {{ p.template() }}</p>
  52. </div>
  53. <span class="page-item__tools">
  54. {% if config.plugins.admin.frontend_preview_target != 'inline' %}
  55. {% set preview_target = config.plugins.admin.frontend_preview_target %}
  56. {% set preview_html = (base_url_relative_frontend|rtrim('/') ~ (p.home ? '' : p.route)) ?: '/' %}
  57. {% set preview_link = p.routable ? '<a class="page-view" target="' ~ preview_target ~ '" href="' ~ preview_html ~ '" title="' ~ "PLUGIN_ADMIN.PREVIEW"|tu ~ '"> <i class="fa fa-fw fa-eye"></i></a>' : '' %}
  58. {% else %}
  59. {% set preview_html = (base_url|rtrim('/') ~ '/preview' ~ (p.home ? '' : p.route)) ?: '/' %}
  60. {% set preview_link = p.routable ? '<a class="page-view" href="' ~ preview_html ~ '" title="' ~ "PLUGIN_ADMIN.PREVIEW"|tu ~ '"> <i class="fa fa-fw fa-eye"></i></a>' : '' %}
  61. {% endif %}
  62. {{ preview_link|raw }}
  63. {% if warn %}
  64. <a href="#delete" data-remodal-target="delete" data-delete-url="{{ uri.addNonce(page_url ~ '/task' ~ separator ~ 'delete', 'admin-form', 'admin-nonce') }}" class="page-delete" ><i class="fa fa-close"></i></a>
  65. {% else %}
  66. <a href="{{ uri.addNonce(page_url ~ '/task' ~ separator ~ 'delete', 'admin-form', 'admin-nonce') }}" class="page-delete" ><i class="fa fa-close"></i></a>
  67. {% endif %}
  68. </span>
  69. </div>
  70. {% if p.children().count > 0 %}
  71. <ul class="depth-{{ depth + 1 }}" style="display:none;">
  72. {{ self.loop(p, depth + 1, twig_vars) }}
  73. </ul>
  74. {% endif %}
  75. </li>
  76. {% endfor %}
  77. {% endmacro %}
  78. {% import _self as macro %}
  79. {% if admin.route %}
  80. {% set context = admin.page(true) %}
  81. {% endif %}
  82. {% if uri.param('new') %}
  83. {% set mode = 'new' %}
  84. {% elseif context %}
  85. {% set mode = 'edit' %}
  86. {% if context.exists %}
  87. {% set page_url = base_url ~ '/pages' ~ (context.header.routes.default ?: context.rawRoute) %}
  88. {% set exists = true %}
  89. {% set title = (context.exists ? "PLUGIN_ADMIN.EDIT"|tu : "PLUGIN_ADMIN.CREATE"|tu ) ~ " " ~ (context.header.title ?: context.title) %}
  90. {% else %}
  91. {% set title = "PLUGIN_ADMIN.ADD_PAGE"|tu %}
  92. {% endif %}
  93. {% else %}
  94. {% set mode = 'list' %}
  95. {% set title = "PLUGIN_ADMIN.PAGES"|tu %}
  96. {% endif %}
  97. {% set modular = context.modular ? 'modular_' : '' %}
  98. {% set warn = config.plugins.admin.warnings.delete_page %}
  99. {% set secure_delete = config.plugins.admin.warnings.secure_delete %}
  100. {% set admin_lang = admin.session.admin_lang ?: 'en' %}
  101. {% set page_lang = context.language %}
  102. {% set type = 'page' %}
  103. {% block stylesheets %}
  104. {% if mode == 'edit' %}
  105. {% do assets.addCss(theme_url~'/css/codemirror/codemirror.css') %}
  106. {% endif %}
  107. {{ parent() }}
  108. {% endblock %}
  109. {% block javascripts %}
  110. {{ parent() }}
  111. {% endblock %}
  112. {% if config.plugins.admin.frontend_preview_target != 'inline' %}
  113. {% set preview_html = (base_url_relative_frontend|rtrim('/') ~ (context.home ? '' : context.route)) ?: '/' %}
  114. {% set preview_target = config.plugins.admin.frontend_preview_target %}
  115. {% set preview_link = context.routable ? '<a class="button" target="' ~ preview_target ~ '" href="' ~ preview_html ~ '" title="' ~ "PLUGIN_ADMIN.PREVIEW"|tu ~ '"> <i class="fa fa-fw fa-eye" style="font-size:18px;margin-right:0;"></i></a>' : '' %}
  116. {% else %}
  117. {% set preview_html = (base_url|rtrim('/') ~ '/preview' ~ (context.home ? '' : context.route)) ?: '/' %}
  118. {% set preview_link = context.routable ? '<a class="button" href="' ~ preview_html ~ '" title="' ~ "PLUGIN_ADMIN.PREVIEW"|tu ~ '"> <i class="fa fa-fw fa-eye" style="font-size:18px;margin-right:0;"></i></a>' : '' %}
  119. {% endif %}
  120. {% block titlebar %}
  121. <div class="button-bar">
  122. {% if mode == 'list' %}
  123. <a class="button" href="{{ base_url }}"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|tu }}</a>
  124. {% for key, add_modal in config.plugins.admin.add_modals %}
  125. {% if add_modal.show_in|defined('bar') == 'bar' %}
  126. <a class="button {{ add_modal.link_classes }}" href="#modal-add_modal-{{ key }}" data-remodal-target="modal-add_modal-{{ key }}"><i class="fa fa-plus"></i> {{ add_modal.label|tu }}</a>
  127. {% endif %}
  128. {% endfor %}
  129. <div class="button-group">
  130. <button type="button" class="button disabled" href="#modal" data-remodal-target="modal">
  131. <i class="fa fa-plus"></i> {{ "PLUGIN_ADMIN.ADD"|tu }}
  132. </button>
  133. <button type="button" class="button dropdown-toggle" data-toggle="dropdown">
  134. <i class="fa fa-caret-down"></i>
  135. </button>
  136. <ul class="dropdown-menu">
  137. <li><a class="button" href="#modal" data-remodal-target="modal">{{ "PLUGIN_ADMIN.ADD_PAGE"|tu }}</a></li>
  138. <li><a class="button" href="#modal-folder" data-remodal-target="modal-folder">{{ "PLUGIN_ADMIN.ADD_FOLDER"|tu }}</a></li>
  139. {% if admin.modularTypes is not empty %}
  140. <li><a class="button" href="#modular" data-remodal-target="modular">{{ "PLUGIN_ADMIN.ADD_MODULAR"|tu }}</a></li>
  141. {% endif %}
  142. {% for key, add_modal in config.plugins.admin.add_modals %}
  143. {% if add_modal.show_in|defined('bar') == 'dropdown' %}
  144. <li><a class="button {{ add_modal.link_classes }}" href="#modal-add_modal-{{ key }}" data-remodal-target="modal-add_modal-{{ key }}">{{ add_modal.label|tu }}</a></li>
  145. {% endif %}
  146. {% endfor %}
  147. </ul>
  148. </div>
  149. {% if admin.multilang %}
  150. <div class="button-group">
  151. <button type="button" class="button disabled">
  152. <i class="fa fa-flag-o"></i>
  153. {% set langName = admin.siteLanguages[admin_lang] %}
  154. {{ langName[:1]|upper ~ langName[1:] }}
  155. </button>
  156. {% if admin.languages_enabled|length > 1 %}
  157. <button type="button" class="button dropdown-toggle" data-toggle="dropdown">
  158. <i class="fa fa-caret-down"></i>
  159. </button>
  160. <ul class="dropdown-menu language-switcher">
  161. {% for langCode in admin.languages_enabled %}
  162. {% set langName = admin.siteLanguages[langCode] %}
  163. {% if langCode != admin_lang %}
  164. <li><a href="{{ uri.addNonce(base_url_relative ~ theme.slug ~ '/pages/task' ~ config.system.param_sep ~ 'switchlanguage/lang' ~ config.system.param_sep ~ langCode, 'admin-form', 'admin-nonce') }}">{{ langName[:1]|upper ~ langName[1:] }}</a></li>
  165. {% endif %}
  166. {% endfor %}
  167. </ul>
  168. {% endif %}
  169. </div>
  170. {% endif %}
  171. {% elseif mode == 'edit' %}
  172. {{ preview_link|raw }}
  173. <a class="button" href="{{ base_url }}/pages" title="{{ "PLUGIN_ADMIN.BACK"|tu }}"><i class="fa fa-reply"></i></a>
  174. {% set siblings = context.parent().children() %}
  175. {% if not siblings.isFirst(context.path) %}
  176. {% set sib = siblings.nextSibling(context.path) %}
  177. {% set sib_url = base_url ~ '/pages' ~ (sib.header.routes.default ?: sib.rawRoute) %}
  178. <a class="button hidden-mobile" href="{{ sib_url }}" title="{{ "PLUGIN_ADMIN.PREVIOUS"|tu }}"><i class="fa fa-chevron-left"></i></a>
  179. {% endif %}
  180. {% if not siblings.isLast(context.path) %}
  181. {% set sib = siblings.prevSibling(context.path) %}
  182. {% set sib_url = base_url ~ '/pages' ~ (sib.header.routes.default ?: sib.rawRoute) %}
  183. <a class="button hidden-mobile" href="{{ sib_url }}" title="{{ "PLUGIN_ADMIN.NEXT"|tu }}"><i class="fa fa-chevron-right"></i></a>
  184. {% endif %}
  185. {% if exists %}
  186. <div class="button-group">
  187. <button type="button" class="button disabled" href="#modal" data-remodal-target="modal">
  188. <i class="fa fa-plus"></i> {{ "PLUGIN_ADMIN.ADD"|tu }}
  189. </button>
  190. <button type="button" class="button dropdown-toggle" data-toggle="dropdown">
  191. <i class="fa fa-caret-down"></i>
  192. </button>
  193. <ul class="dropdown-menu">
  194. <li><a class="button" href="#modal" data-remodal-target="modal">{{ "PLUGIN_ADMIN.ADD_PAGE"|tu }}</a></li>
  195. <li><a class="button" href="#modal-folder" data-remodal-target="modal-folder">{{ "PLUGIN_ADMIN.ADD_FOLDER"|tu }}</a></li>
  196. {% if admin.modularTypes is not empty %}
  197. <li><a class="button" href="#modular" data-remodal-target="modular">{{ "PLUGIN_ADMIN.ADD_MODULAR"|tu }}</a></li>
  198. {% endif %}
  199. </ul>
  200. </div>
  201. <a class="button disable-after-click" href="{{ uri.addNonce(page_url ~ '/task' ~ config.system.param_sep ~ 'copy', 'admin-form', 'admin-nonce') }}" class="page-copy" ><i class="fa fa-copy"></i> {{ "PLUGIN_ADMIN.COPY"|tu }}</a>
  202. <a class="button" href="#" data-remodal-target="move"><i class="fa fa-arrows"></i> {{ "PLUGIN_ADMIN.MOVE"|tu }}</a>
  203. {% if config.plugins['admin-pro'].enabled %}
  204. <a class="button" href="#" data-remodal-target="revisions"><i class="fa fa-history"></i> {{ "PLUGIN_ADMIN_PRO.REVISIONS"|tu }}</a>
  205. {% endif %}
  206. {% if warn %}
  207. <a class="button" href="#delete" data-remodal-target="delete" data-delete-url="{{ uri.addNonce(page_url ~ '/task' ~ config.system.param_sep ~ 'delete', 'admin-form', 'admin-nonce') }}"><i class="fa fa-close"></i> {{ "PLUGIN_ADMIN.DELETE"|tu }}</a>
  208. {% else %}
  209. <a class="button disable-after-click" href="{{ uri.addNonce(uri.route(true) ~ '/task' ~ config.system.param_sep ~ 'delete', 'admin-form', 'admin-nonce') }}" class="page-delete" ><i class="fa fa-close"></i></a>
  210. {% endif %}
  211. {% endif %}
  212. <div class="button-group">
  213. <button class="button" name="task" value="save" form="blueprints" type="submit"><i class="fa fa-check"></i> {{ "PLUGIN_ADMIN.SAVE"|tu }}</button>
  214. {% if exists and admin.multilang %}
  215. {% if context.untranslatedLanguages %}
  216. <button type="button" class="button dropdown-toggle" data-toggle="dropdown">
  217. <i class="fa fa-caret-down"></i>
  218. </button>
  219. <ul class="dropdown-menu lang-switcher">
  220. {% for langCode in context.untranslatedLanguages %}
  221. {% set langName = admin.siteLanguages[langCode] %}
  222. {% if langCode != page_lang %}
  223. <li><button class="button task" name="task" value="saveas" lang="{{langCode}}" form="blueprints" type="submit">{{ "PLUGIN_ADMIN.SAVE_AS"|tu }} {{ langName[:1]|upper ~ langName[1:] }}</button></li>
  224. {% endif %}
  225. {% endfor %}
  226. </ul>
  227. {% endif %}
  228. {% endif %}
  229. </div>
  230. {% endif %}
  231. </div>
  232. {% if mode == 'new' %}
  233. <h1><i class="fa fa-fw fa-file-text-o"></i> {{ "PLUGIN_ADMIN.ADD_PAGE"|tu }}</h1>
  234. {% elseif mode == 'edit' %}
  235. <h1><i class="fa fa-fw fa-file-text-o"></i>
  236. {{ context.title }}
  237. </h1>
  238. {% else %}
  239. <h1><i class="fa fa-fw fa-file-text-o"></i> {{ "PLUGIN_ADMIN.MANAGE_PAGES"|tu }}</h1>
  240. {% endif %}
  241. {% endblock %}
  242. {% block content %}
  243. <div class="clear admin-pages">
  244. {% if mode == 'new' %}
  245. {% include 'partials/blueprints-new.html.twig' with { blueprints: admin.blueprints('pages/page'), data: context } %}
  246. {% elseif mode == 'edit' %}
  247. <div class="admin-form-wrapper">
  248. <div id="admin-topbar">
  249. {% if admin.multilang and page_lang %}
  250. <div id="admin-lang-toggle" class="button-group">
  251. <button type="button" class="button disabled">
  252. {% if exists %}
  253. {{ page_lang }}
  254. {% else %}
  255. {{ admin_lang }}
  256. {% endif %}
  257. </button>
  258. {% if exists and context.translatedLanguages|length > 1 %}
  259. <button type="button" class="button dropdown-toggle" data-toggle="dropdown">
  260. <i class="fa fa-caret-down"></i>
  261. </button>
  262. <ul class="dropdown-menu language-switcher">
  263. {% for language, route in context.translatedLanguages %}
  264. {% if language != page_lang %}
  265. <li><button class="task" name="task" value="switchlanguage" lang="{{language}}" redirect="{{context.rawRoute|trim('/')}}" form="blueprints">{{ language }}</button></li>
  266. {% endif %}
  267. {% endfor %}
  268. </ul>
  269. {% endif %}
  270. </div>
  271. {% endif %}
  272. {% if context.blueprints.fields %}
  273. {% set normalText = "PLUGIN_ADMIN.NORMAL"|tu %}
  274. {% set expertText = "PLUGIN_ADMIN.EXPERT"|tu %}
  275. {% set maxLen = max([normalText|length, expertText|length]) %}
  276. {% set normalText = macro.spanToggle(normalText, maxLen) %}
  277. {% set expertText = macro.spanToggle(expertText, maxLen) %}
  278. <form id="admin-mode-toggle">
  279. <div class="switch-toggle switch-grav">
  280. <input type="radio" value="normal" data-leave-url="{{ base_url }}/pages/{{ admin.route|trim('/') }}/mode{{ config.system.param_sep }}normal" id="normal" name="mode-switch" class="highlight" {% if admin.session.expert == '0' %} checked="checked"{% endif %}>
  281. <label for="normal">{{ normalText|raw }}</label>
  282. <input type="radio" value="expert" data-leave-url="{{ base_url }}/pages/{{ admin.route|trim('/') }}/mode{{ config.system.param_sep }}expert" id="expert" name="mode-switch" class="highlight" {% if admin.session.expert == '1' %} checked="checked"{% endif %}>
  283. <label for="expert">{{ expertText|raw }}</label>
  284. <a></a>
  285. </div>
  286. </form>
  287. {% endif %}
  288. </div>
  289. {# Set current form data back into page content #}
  290. {% if current_form_data %}
  291. {% do context.header(current_form_data.header) %}
  292. {% do context.content(current_form_data.content) %}
  293. {% endif %}
  294. {% if context.blueprints.fields and admin.session.expert == '0' %}
  295. {% include 'partials/blueprints.html.twig' with { blueprints: context.blueprints, data: context } %}
  296. {% else %}
  297. {% include 'partials/blueprints-raw.html.twig' with { blueprints: admin.blueprints('admin/pages/'~modular~'raw'), data: context } %}
  298. {% endif %}
  299. </div>
  300. {% else %}
  301. <form id="page-filtering">
  302. <div class="page-filters">
  303. <input type="text" data-filter-labels="{{ [{'id': 'mode', 'name': 'PLUGIN_ADMIN.PAGE_MODES'|tu}, {'id': 'type', 'name': 'PLUGIN_ADMIN.PAGE_TYPES'|tu}, {'id': 'access', 'name': 'PLUGIN_ADMIN.ACCESS_LEVELS'|tu}] |json_encode|e('html_attr')}}" data-filter-types="{{ admin.types|merge(admin.modularTypes)|json_encode|e('html_attr') }}" data-filter-access-levels="{{ admin.accessLevels|json_encode|e('html_attr') }}" placeholder="{{ "PLUGIN_ADMIN.ADD_FILTERS"|tu }}" class="page-filter" name="page-filter" />
  304. </div>
  305. <div class="page-search">
  306. <input type="text" placeholder="{{ "PLUGIN_ADMIN.SEARCH_PAGES"|tu }}" name="page-search" />
  307. </div>
  308. <div class="page-shortcuts">
  309. <span class="button button-x-small" data-page-toggleall="expand"><i class="fa fa-fw fa-plus-circle"></i> {{ "PLUGIN_ADMIN.EXPAND_ALL"|tu }}</span>
  310. <span class="button button-x-small" data-page-toggleall="collapse"><i class="fa fa-fw fa-minus-circle"></i> {{ "PLUGIN_ADMIN.COLLAPSE_ALL"|tu }}</span>
  311. </div>
  312. </form>
  313. <div class="pages-list">
  314. <ul class="depth-0">
  315. {{ macro.loop(pages, 0, _context) }}
  316. </ul>
  317. {% include 'partials/page-legend.html.twig' %}
  318. </div>
  319. {% endif %}
  320. </div>
  321. {% if context %}
  322. {% set obj_data = clone(context) %}
  323. {% if mode == 'edit' %}
  324. {% do obj_data.folder('') %}
  325. {% endif %}
  326. {% endif %}
  327. {% if mode == 'list' or mode == 'edit' %}
  328. <div class="remodal" data-remodal-id="modal" data-remodal-options="hashTracking: false">
  329. {% include 'partials/blueprints-new.html.twig' with { blueprints: admin.blueprints('admin/pages/new'), data: obj_data, form_id:'new-page' } %}
  330. </div>
  331. <div class="remodal" data-remodal-id="modal-folder" data-remodal-options="hashTracking: false">
  332. {% include 'partials/blueprints-new-folder.html.twig' with { blueprints: admin.blueprints('admin/pages/new_folder'), data: obj_data, form_id:'new-folder' } %}
  333. </div>
  334. <div class="remodal" data-remodal-id="modular" data-remodal-options="hashTracking: false">
  335. {% include 'partials/blueprints-new.html.twig' with { blueprints: admin.blueprints('admin/pages/modular_new'), data: obj_data, form_id:'new-modular' } %}
  336. </div>
  337. {% for key, add_modal in config.plugins.admin.add_modals %}
  338. <div class="remodal {{ add_modal.modal_classes|defined('') }}" data-remodal-id="modal-add_modal-{{ key }}" data-remodal-options="hashTracking: false">
  339. {% include add_modal.template|defined('partials/blueprints-new.html.twig') with { blueprints: admin.blueprints(add_modal.blueprint), data: context, form_id:'add-modal' }|merge(add_modal.with|defined({})) %}
  340. </div>
  341. {% endfor %}
  342. {% endif %}
  343. {% if mode == 'edit' %}
  344. <div class="remodal" data-remodal-id="move" data-remodal-options="hashTracking: false">
  345. {% include 'partials/page-move.html.twig' with { blueprints: admin.blueprints('admin/pages/move'), data: context } %}
  346. </div>
  347. <div class="remodal" data-remodal-id="revisions" data-remodal-options="hashTracking: false">
  348. {% include ['partials/page-revisions.html.twig', 'empty.html.twig'] ignore missing with { data: context } %}
  349. </div>
  350. {% endif %}
  351. {% include 'partials/modal-changes-detected.html.twig' %}
  352. <div class="remodal" data-remodal-id="delete" data-remodal-options="hashTracking: false">
  353. <form>
  354. <h1>{{ "PLUGIN_ADMIN.MODAL_DELETE_PAGE_CONFIRMATION_REQUIRED_TITLE"|tu }}</h1>
  355. <p class="bigger">
  356. {% if context %}
  357. <strong>{{ "PLUGIN_ADMIN.PAGE"|tu }}: {{ context.title }}</strong>
  358. {% endif %}
  359. </p>
  360. <p class="bigger">
  361. {{ "PLUGIN_ADMIN.MODAL_DELETE_PAGE_CONFIRMATION_REQUIRED_DESC"|tu }}
  362. </p>
  363. {% if secure_delete %}
  364. <p class="form-secure-delete">
  365. <input id="secure-delete-field" autofocus type="text" placeholder="{{ "PLUGIN_ADMIN.SECURE_DELETE_DESC"|tu }}" />
  366. </p>
  367. {% endif %}
  368. <br>
  369. <div class="button-bar">
  370. <button data-remodal-action="cancel" class="button secondary remodal-cancel"><i class="fa fa-fw fa-close"></i> {{ "PLUGIN_ADMIN.CANCEL"|tu }}</button>
  371. {% if secure_delete %}
  372. <button id="secure-delete-btn" disabled="true" class="button danger disable-after-click" data-delete-action><i class="fa fa-fw fa-check"></i> {{ "PLUGIN_ADMIN.CONFIRM"|tu }}</button>
  373. {% else %}
  374. <a class="button danger disable-after-click" data-delete-action href="#"><i class="fa fa-fw fa-check"></i> {{ "PLUGIN_ADMIN.CONTINUE"|tu }}</a>
  375. {% endif %}
  376. </div>
  377. </form>
  378. </div>
  379. {% include 'partials/admin-pro-pages-addons.html.twig' ignore missing %}
  380. {% endblock %}
  381. {% block bottom %}
  382. {{ parent() }}
  383. <script>
  384. $('.admin-pages .form-tabs .tabs-nav').css('margin-right', ($('#admin-topbar').width() + 20) + 'px');
  385. {% if secure_delete %}
  386. $('#secure-delete-field').keyup(function () {
  387. var inputValue = $(this).val();
  388. if (inputValue == 'DELETE') {
  389. $('#secure-delete-btn').attr('disabled', false);
  390. }else{
  391. $('#secure-delete-btn').attr('disabled', true);
  392. }
  393. });
  394. $(document).on('closing', '.remodal', function () {
  395. $('#secure-delete-field').val('');
  396. });
  397. {% endif %}
  398. </script>
  399. {% endblock %}