create_page.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <!-- TODO GW-2362 remove after adjust layout -->
  2. <div class="modal create-page" id="create-page">
  3. <div class="modal-dialog modal-lg">
  4. <div class="modal-content">
  5. <div class="modal-header bg-primary text-light">
  6. <div class="modal-title">{{ t('New Page') }}</div>
  7. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  8. </div>
  9. <div class="modal-body">
  10. <form id="create-page-today" role="form">
  11. <div class="row form-group">
  12. <fieldset class="col-12 mb-4">
  13. <h3 class="grw-modal-head pb-2">{{ t("Create today's") }}</h3>
  14. <div class="d-flex create-page-input-container">
  15. <div class="create-page-input-row d-flex align-items-center">
  16. <span class="page-today-prefix">{{ userPageRoot(user) }}/</span>
  17. <input type="text" data-prefix="{{ userPageRoot(user) }}/" class="page-today-input1 form-control text-center" value="{{ t('Memo') }}" id="" name="">
  18. <span class="page-today-suffix">/{{ now|datetz('Y/m/d') }}/</span>
  19. <input type="text" data-prefix="/{{ now|datetz('Y/m/d') }}/" class="page-today-input2 form-control" id="page-today-input2" name="" placeholder="{{ t('Input page name (optional)') }}">
  20. </div>
  21. <div class="create-page-button-container">
  22. <button type="submit" class="btn btn-outline-primary rounded-pill"><i class="icon-fw icon-doc"></i>{{ t('Create') }}</button>
  23. </div>
  24. </div>
  25. </fieldset>
  26. </div>
  27. </form>
  28. {% if !isTrashPage() %}
  29. <form id="create-page-under-tree" role="form">
  30. <div class="row form-group">
  31. <fieldset class="col-12 mb-4">
  32. <h3 class="grw-modal-head pb-2">{{ t('Create under') }}</h3>
  33. <div class="d-flex create-page-input-container">
  34. <div class="create-page-input-row d-flex align-items-center">
  35. {% if isSearchServiceConfigured() %}
  36. <div id="create-page-name-input" class="page-name-input"></div>
  37. {% else %}
  38. <input type="text" value="{{ parentPath(path) }}" class="page-name-input form-control " placeholder="{{ t('Input page name') }}" required />
  39. {% endif %}
  40. </div>
  41. <div class="create-page-button-container">
  42. <button type="submit" class="btn btn-outline-primary rounded-pill"><i class="icon-fw icon-doc"></i>{{ t('Create') }}</button>
  43. </div>
  44. </div>
  45. </fieldset>
  46. </div>
  47. </form>
  48. {% set templateParentPath = parentPath(path | preventXss | escape) %}
  49. <div id="template-form" class="row form-group">
  50. <fieldset class="col-12">
  51. <h3 class="grw-modal-head pb-2">{{ t('template.modal_label.Create template under') }}<br><code>{{ templateParentPath }}</code></h3>
  52. <div class="d-flex create-page-input-container">
  53. <div class="create-page-input-row d-flex align-items-center">
  54. <div id="dd-template-type" class="dropdown w-100">
  55. <a type="button" class="btn btn-secondary btn-block dropdown-toggle d-flex align-items-center justify-content-between"
  56. id="template-type" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  57. {{ t('template.option_label.select') }}
  58. </a>
  59. <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
  60. <button class="dropdown-item" type="button" data-template-type="children">
  61. {{ t('template.children.label') }} (_template)<br class="d-block d-md-none" /><small class="text-muted text-wrap">- {{ t('template.children.desc') }}</small>
  62. </button>
  63. <button class="dropdown-item" type="button" data-template-type="decentants">
  64. {{ t('template.decendants.label') }} (__template) <br class="d-block d-md-none" /><small class="text-muted">- {{ t('template.decendants.desc') }}</small>
  65. </button>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="create-page-button-container">
  70. <a id="link-to-template" href="{{ page.path || path }}" class="btn btn-outline-primary rounded-pill disabled">
  71. <i class="icon-fw icon-doc"></i>
  72. <span id="create-template-button-link">{{ t('Edit') }}</span>
  73. </a>
  74. </div>
  75. </div>
  76. </fieldset>
  77. </div>
  78. {% endif %}
  79. <script>
  80. $('#dd-template-type .dropdown-item').on('click', function() {
  81. const value = $(this).data('template-type');
  82. // modify label
  83. const label = (value === 'children')
  84. ? '{{ t("template.children.label") }} (__template)'
  85. : '{{ t("template.decendants.label") }} (__template)';
  86. $('#dd-template-type .dropdown-toggle').text(label);
  87. // modify href
  88. const pageName = (value === 'children') ? '_template' : '__template';
  89. const parentPath = '{{templateParentPath}}';
  90. const link = parentPath + pageName + '#edit-form';
  91. $('#link-to-template').attr('href', link);
  92. // enable button
  93. $('#link-to-template').removeClass('disabled');
  94. });
  95. </script>
  96. </div><!-- /.modal-body -->
  97. </div><!-- /.modal-content -->
  98. </div><!-- /.modal-dialog -->
  99. </div><!-- /.modal -->