Sotaro KARASAWA 9 ani în urmă
părinte
comite
d4e7010031

+ 0 - 25
lib/views/_form.html

@@ -61,29 +61,4 @@
   <div class="file-module hidden">
   </div>
 </div>
-
-<div class="modal fade page-warning-modal" id="page-warning-modal">
-  <div class="modal-dialog">
-    <div class="modal-content">
-
-      <div class="modal-header">
-        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
-        <h4 class="modal-title">ページ名に関するヒント</h4>
-      </div>
-      <div class="modal-body alert alert-danger">
-
-        <strong>Warning!</strong><br>
-
-        <p>
-        スラッシュ <code>/</code> で区切られていない、日付の入ったページ名をつけようとしていませんか?<br>
-        ページ名に日付を入れる場合、スラッシュ <code>/</code> で区切ることが推奨されています。<br>
-        <br>
-        推奨されるページ名で作成する場合、<br>
-        <a href="{{ path|normalizeDateInPath }}">{{ path|normalizeDateInPath }}</a> から作成をはじめてください。
-        </p>
-
-      </div>
-    </div>
-  </div>
-</div>
 <script src="/js/form{% if env  == 'production' %}.min{% endif %}.js"></script>

+ 1 - 1
lib/views/modal/widget_create_page.html

@@ -34,7 +34,7 @@
               <h4><code>{{ parentPath(path) }}</code>以下に作成</h4>
             </div>
             <div class="col-xs-10">
-              <input type="text" value="{{ parentPath(path) }}" class="page-name-input form-control " id="" name="" placeholder="ページ名を入力">
+              <input type="text" value="{{ parentPath(path) }}" class="page-name-input form-control " placeholder="ページ名を入力" required>
             </div>
             <div class="col-xs-2">
               <button type="submit" class="btn btn-primary">作成</button>

+ 28 - 0
lib/views/modal/widget_page_name_warning.html

@@ -0,0 +1,28 @@
+<div class="modal page-warning-modal" id="page-warning-modal">
+  <div class="modal-dialog">
+    <div class="modal-content">
+
+      <div class="modal-header">
+        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+        <h4 class="modal-title">ページ名に関するヒント</h4>
+      </div>
+      <div class="modal-body alert alert-danger">
+
+        <strong>Warning!</strong><br>
+
+        <p>
+        スラッシュ <code>/</code> で区切られていない、日付の入ったページ名をつけようとしていませんか?<br>
+        ページ名に日付を入れる場合、スラッシュ <code>/</code> で区切ることが推奨されています。<br>
+        <br>
+        推奨されるページ名で作成する場合、<br>
+        <a href="{{ path|normalizeDateInPath }}">{{ path|normalizeDateInPath }}</a> から作成をはじめてください。
+        </p>
+
+      </div>
+
+      <div class="modal-footer">
+        <input type="submit" class="btn btn-primary" value="Rename!">
+      </div>
+    </div>
+  </div>
+</div>

+ 3 - 0
lib/views/page.html

@@ -202,6 +202,7 @@
 {% block content_footer %}
 
 
+{% if page %}
 <div class="page-attachments meta">
   <p>Attachments</p>
   <ul>
@@ -219,6 +220,7 @@
   {# /for BC #}
   Created at {{ page.createdAt|datetz('Y-m-d H:i:s') }} by <img src="{{ page.creator|default(page.creator)|picture }}" class="picture picture-rounded"> {{ page.creator.name }}<br>
 </p>
+{% endif %}
 
 {% endblock %}
 
@@ -243,4 +245,5 @@
   <div id="presentation-layer" class="fullscreen-layer">
     <div id="presentation-container"></div>
   </div>
+  {% include 'modal/widget_page_name_warning.html' %}
 {% endblock %}

+ 2 - 2
resource/css/_form.scss

@@ -2,7 +2,7 @@
   padding: 0;
 
   position: fixed;
-  z-index: 1060;
+  z-index: 1050;
   background: #fff;
   top: 0;
   left: 0;
@@ -19,7 +19,7 @@
     bottom: 58px;
     padding: 0 12px;
     position: absolute;
-    z-index: 1061;
+    z-index: 1051;
     left: 0;
     right: 0;
     margin-top: 4px;

+ 8 - 0
resource/css/crowi.scss

@@ -83,7 +83,11 @@ footer {
   }
 }
 
+.modal-backdrop {
+  z-index: 1060;
+}
 .modal {
+  z-index: 1061;
   p {
     font-size: 1em;
   }
@@ -93,6 +97,10 @@ footer {
     margin: 0;
   }
 }
+.modal-body.alert {
+  margin-bottom: 0;
+  border-radius: 0;
+}
 
 .modal.create-page {
   .modal-body {

+ 18 - 0
test.js

@@ -0,0 +1,18 @@
+
+const body = `# ほげ
+
+検診 <- これは highlight
+<a href="検診">検診</a>
+
+[検診](検診) <- non highlight
+
+ほげ(検診)ほげ <- highlight
+ほげ[検診]ほげ <- highlight
+
+<a href="検診">検診</a> 検診 <- nhl hl hl
+`;
+
+const k = '検診'; //keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+const keywordExp = new RegExp(`(${k}(?!(.*?\]|.*?\\)|.*?"|.*?>)))`, 'ig');
+
+console.log(body.replace(keywordExp, '<em class="highlighted">$&</em>'));