| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <div class="modal create-page" id="create-page">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header bg-primary">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
- <div class="modal-title">{{ t('New Page') }}</div>
- </div>
- <div class="modal-body">
- <form class="row form-horizontal" id="create-page-today" role="form">
- <fieldset class="col-xs-12">
- <legend>{{ t("Create today's") }}</legend>
- <div class="d-flex create-page-input-container">
- <div class="create-page-input-row d-flex align-items-center">
- <span class="page-today-prefix">{{ userPageRoot(user) }}/</span>
- <input type="text" data-prefix="{{ userPageRoot(user) }}/" class="page-today-input1 form-control text-center" value="{{ t('Memo') }}" id="" name="">
- <span class="page-today-suffix">/{{ now|datetz('Y/m/d') }}/</span>
- <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)') }}">
- </div>
- <div class="create-page-button-container">
- <button type="submit" class="fcbtn btn btn-outline btn-rounded btn-primary btn-1b"><i class="icon-fw icon-doc"></i>{{ t('Create') }}</button>
- </div>
- </div>
- </fieldset>
- </form>
- <form class="row form-horizontal m-t-15" id="create-page-under-tree" role="form">
- <fieldset class="col-xs-12">
- <legend>{{ t('Create under') }}</legend>
- <div class="d-flex create-page-input-container">
- <div class="create-page-input-row d-flex align-items-center">
- {% if searchConfigured() %}
- <div id="page-name-inputter"></div>
- {% else %}
- <input type="text" value="{{ parentPath(path) }}" class="page-name-input form-control " placeholder="{{ t('Input page name') }}" required />
- {% endif %}
- </div>
- <div class="create-page-button-container">
- <button type="submit" class="fcbtn btn btn-outline btn-rounded btn-primary btn-1b"><i class="icon-fw icon-doc"></i>{{ t('Create') }}</button>
- </div>
- </div>
- </fieldset>
- </form>
- <div id = "template-form" class="row form-horizontal m-t-15">
- <fieldset class="col-xs-12">
- <legend>{{ t('template.modal_label.Create template under', parentPath(path)) }}</legend>
- <div class="d-flex create-page-input-container">
- <div class="create-page-input-row d-flex align-items-center">
- <select id="template-type" class="page-name-input form-control">
- <option value="" disabled selected>{{ t('template.option_label.select') }}</option>
- <option value="children">{{ t('template.children.label') }}(_template) - {{ t('template.children.desc') }}</option>
- <option value="decentants">{{ t('template.decendants.label') }}(__template) - {{ t('template.decendants.desc') }}</option>
- </select>
- </div>
- <div class="create-page-button-container">
- <a id="link-to-template" href="{{ page.path || path }}">
- <button class="fcbtn btn btn-outline btn-rounded btn-primary btn-1b">
- <i class="icon-fw icon-doc"></i>
- <span id="template-button">{{ t('Create') }}/{{ t('Edit') }}</span>
- </button>
- </a>
- </div>
- </div>
- </fieldset>
- </div>
- </div><!-- /.modal-body -->
- </div><!-- /.modal-content -->
- </div><!-- /.modal-dialog -->
- </div><!-- /.modal -->
- <script>
- let buttonTextChildren;
- let buttonTextDecendants;
- let pagePath = $("#link-to-template").attr("href");
- if (pagePath.endsWith("/")) {
- pagePath = pagePath.slice(0, -1);
- };
- $.get(`/_api/pages.templates?path=${pagePath}`)
- .then(templateInfo => {
- buttonTextChildren = templateInfo.childrenTemplateExists ? '{{ t('Edit') }}' : '{{ t('Create') }}';
- buttonTextDecendants = templateInfo.decendantsTemplateExists ? '{{ t('Edit') }}' : '{{ t('Create') }}';
- });
- $("#create-template").ready(() => {
- $('#template-button-children').text(buttonTextChildren);
- $('#template-button-decendants').text(buttonTextDecendants);
- });
- $("#template-type").on("change", () => {
- if ($("#template-type").val() === "children") {
- href = pagePath + "/_template#edit-form";
- $("#link-to-template").attr("href", href);
- $('#template-button').text(buttonTextChildren);
- }
- else if ($("#template-type").val() === "decentants") {
- href = pagePath + "/__template#edit-form";
- $("#link-to-template").attr("href", href);
- $('#template-button').text(buttonTextDecendants);
- };
- });
- </script>
|