sou пре 7 година
родитељ
комит
e0da90bc07

+ 4 - 4
lib/views/modal/create_page.html

@@ -82,10 +82,10 @@
   };
 
   $.get(`/_api/pages.templates?path=${pagePath}`)
-  .then(templateInfo => {
-    buttonTextChildren = templateInfo.childrenTemplateExists ? '{{ t('Edit') }}' : '{{ t('Create') }}';
-    buttonTextDecendants = templateInfo.decendantsTemplateExists ? '{{ t('Edit') }}' : '{{ t('Create') }}';
-  });
+    .then(templateInfo => {
+      buttonTextChildren = templateInfo.childrenTemplateExists ? '{{ t('Edit') }}' : '{{ t('Create') }}';
+      buttonTextDecendants = templateInfo.decendantsTemplateExists ? '{{ t('Edit') }}' : '{{ t('Create') }}';
+    });
 
   $("#create-template").ready(() => {
     $('#template-button-children').text(buttonTextChildren);

+ 1 - 1
lib/views/widget/page_list.html

@@ -20,7 +20,7 @@
     {% endif  %}
 
     {% if page.isTemplate() %}
-      <span class="label label-info">TMPLT</span>
+      <span class="label label-info">TMPL</span>
     {% endif  %}
 
     {% if page.commentCount > 0 %}

+ 3 - 10
resource/js/components/PageList/PageListMeta.js

@@ -11,17 +11,10 @@ export default class PageListMeta extends React.Component {
     return false;
   }
 
-  isTemplatePath(path) {
-    if (path.match(/.*\/_{1,2}template$/)) {
-      return true;
-    }
-
-    return false;
-  }
-
   render() {
     // TODO isPortal()
     const page = this.props.page;
+    const templateChecker = require('../../util/templateChecker');
 
     // portal check
     let PortalLabel;
@@ -31,8 +24,8 @@ export default class PageListMeta extends React.Component {
 
     // template check
     let TemplateLabel;
-    if (this.isPortalPath(page.path)) {
-      TemplateLabel = <span className="label label-info">TMPLT</span>;
+    if (templateChecker(page.path)) {
+      TemplateLabel = <span className="label label-info">TMPL</span>;
     }
 
     let CommentCount;

+ 13 - 0
resource/js/util/templateChecker.js

@@ -0,0 +1,13 @@
+/**
+ * templateChecker
+ */
+
+module.exports = function(path) {
+  'use strict';
+
+  if (path.match(/.*\/_{1,2}template$/)) {
+    return true;
+  }
+
+  return false;
+};