create_page.html 5.3 KB

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