Просмотр исходного кода

fix link for template when page.path ends with '/'

Yuki Takei 7 лет назад
Родитель
Сommit
9c10b7a860
1 измененных файлов с 8 добавлено и 10 удалено
  1. 8 10
      lib/views/modal/create_template.html

+ 8 - 10
lib/views/modal/create_template.html

@@ -18,11 +18,10 @@
                   <p class="help-block text-center"><small>{{ t('template.local.desc') }}</small></p>
                 </div>
                 <div class="panel-footer text-center">
-                  {% if childrenTemplateExists %}
-                  <a href="{{ page.path }}/_template#edit-form"><button class="btn btn-sm btn-primary">{{ t('Edit') }}</button></a>
-                  {% else %}
-                  <a href="{{ page.path }}/_template#edit-form"><button class="btn btn-sm btn-primary">{{ t('Create') }}</button></a>
-                  {% endif %}
+                  <a href="{% if page.path.endsWith('/') %}{{ page.path }}{% else %}{{ page.path}}/{% endif %}_template#edit-form"
+                      class="btn btn-sm btn-primary">
+                    {% if childrenTemplateExists %}{{ t('Edit') }}{% else %}{{ t('Create') }}{% endif %}
+                  </a>
                 </div>
               </div>
             </div>
@@ -34,11 +33,10 @@
                   <p class="help-block text-center"><small>{{ t('template.global.desc') }}</small></p>
                 </div>
                 <div class="panel-footer text-center">
-                  {% if decendantsTemplateExists %}
-                  <a href="{{ page.path }}/__template#edit-form"><button class="btn btn-sm btn-primary">{{ t('Edit') }}</button></a>
-                  {% else %}
-                  <a href="{{ page.path }}/__template#edit-form"><button class="btn btn-sm btn-primary">{{ t('Create') }}</button></a>
-                  {% endif %}
+                  <a href="{% if page.path.endsWith('/') %}{{ page.path }}{% else %}{{ page.path}}/{% endif %}__template#edit-form"
+                      class="btn btn-sm btn-primary">
+                  {% if decendantsTemplateExists %}{{ t('Edit') }}{% else %}{{ t('Create') }}{% endif %}
+                  </a>
                 </div>
               </div>
             </div>