OSDN Git Service

template: fix comment related problem
authorhylom <hylom@users.sourceforge.jp>
Thu, 22 Nov 2018 11:55:33 +0000 (20:55 +0900)
committerhylom <hylom@users.sourceforge.jp>
Thu, 22 Nov 2018 11:55:33 +0000 (20:55 +0900)
src/newslash_web/templates/common/comment/comment_header.html.tt2
src/newslash_web/templates/common/components/comment_tree.html.tt2
src/newslash_web/templates/common/single.html.tt2

index 63cb745..e69de29 100644 (file)
@@ -1,81 +0,0 @@
-<div id="comment-header">
-  <div v-if="archived" class="alert alert-info">
-    この議論は賞味期限が切れたので、アーカイブ化されています。 新たにコメントを付けることはできません。
-  </div>
-  <div v-else-if="!commentAllowed" class="alert alert-info">
-    設定によりコメント投稿は許可されていません。
-  </div>
-  <form class="form">
-    [%#
-    <button type="button" class="btn btn-default form-control">コメント元ページを表示</button>
-    %]
-    <button type="button" class="btn btn-default form-control" v-if="commentAllowed && !archived">
-      <span class="glyphicon glyphicon-comment"></span>
-      <span class="btn-text"> コメントを書く</span>
-    </button>
-    <select id="comment-filter" name="comment-filter" class="form-control" v-model="userConfig.show_threshold">
-      <option value="-1">全コメントを表示</option>
-      <option value="0">スコア0以上のコメントのみ表示</option>
-      <option value="1">スコア1以上のコメントのみ表示</option>
-      <option value="2">スコア2以上のコメントのみ表示</option>
-      <option value="3">スコア3以上のコメントのみ表示</option>
-      <option value="4">スコア4以上のコメントのみ表示</option>
-      <option value="5">スコア5以上のコメントのみ表示</option>
-    </select>
-    
-    <select id="body-filter" name="body-filter" class="form-control" v-model="userConfig.fold_threshold">
-      <option value="-1">すべての本文を表示</option>
-      <option value="0">スコア0未満のコメントは抜粋表示</option>
-      <option value="1">スコア1未満のコメントは抜粋表示</option>
-      <option value="2">スコア2未満のコメントは抜粋表示</option>
-      <option value="3">スコア3未満のコメントは抜粋表示</option>
-      <option value="4">スコア4未満のコメントは抜粋表示</option>
-      <option value="5">スコア5未満のコメントは抜粋表示</option>
-    </select>
-
-    <button type="button" class="btn btn-default form-control" aria-label="表示設定"
-            v-on:click="isConfigVisible=!isConfigVisible" :class="{active: isConfigVisible}">
-      <span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
-      <span class="btn-text">表示設定</span>
-    </button>
-    
-  </form>
-
-  <form class="form" id="comment-header-advanced" v-show="isConfigVisible">
-    <div class="checkbox">
-      <label>
-        <input type="checkbox" id="enable-hotkey" name="enable-hotkey" value="1" v-model="userConfig.enable_hotkey" />
-        ショートカットキーの割り当てを有効にする
-      </label>
-    </div>
-
-    <div class="checkbox">
-      <label>
-        <input type="checkbox" id="auto-fold" name="auto-fold" value="1" v-model="userConfig.auto_fold" />
-        既読コメントを折りたたむ
-      </label>
-    </div>
-
-    <div class="checkbox">
-      <label>
-        <input type="checkbox" id="hide-signature" name="hide-signature" value="1" v-model="userConfig.hide_signature" />
-        署名を非表示
-      </label>
-    </div>
-
-    <div class="checkbox">
-      <label>
-        <input type="checkbox" id="hide-score" name="hide-score" value="1" v-model="userConfig.hide_score" />
-        スコアを非表示
-      </label>
-    </div>
-
-    <div class="form-inline">
-      <button type="button" class="btn form-control btn-default"
-              v-on:click="saveConfig()" :class="{disabled: !savable}">
-        現在の表示設定をデフォルトとして保存
-      </button>
-    </div>
-  </form>
-
-</div>
index bc7149f..0bc79b1 100644 (file)
@@ -1,5 +1,83 @@
 <script type="text/x-template" id="comment-header-template">
-  [%- INCLUDE common/comment/comment_header -%]
+  <div id="comment-header">
+    <div v-if="archived" class="alert alert-info">
+      この議論は賞味期限が切れたので、アーカイブ化されています。 新たにコメントを付けることはできません。
+    </div>
+    <div v-else-if="!commentAllowed" class="alert alert-info">
+      設定によりコメント投稿は許可されていません。
+    </div>
+    <form class="form">
+      [%#
+      <button type="button" class="btn btn-default form-control">コメント元ページを表示</button>
+      %]
+      <button type="button" class="btn btn-default form-control" v-if="commentAllowed && !archived">
+        <span class="glyphicon glyphicon-comment"></span>
+        <span class="btn-text"> コメントを書く</span>
+      </button>
+      <select id="comment-filter" name="comment-filter" class="form-control" v-model="config.show_threshold">
+        <option value="-1">全コメントを表示</option>
+        <option value="0">スコア0以上のコメントのみ表示</option>
+        <option value="1">スコア1以上のコメントのみ表示</option>
+        <option value="2">スコア2以上のコメントのみ表示</option>
+        <option value="3">スコア3以上のコメントのみ表示</option>
+        <option value="4">スコア4以上のコメントのみ表示</option>
+        <option value="5">スコア5以上のコメントのみ表示</option>
+      </select>
+    
+      <select id="body-filter" name="body-filter" class="form-control" v-model="config.fold_threshold">
+        <option value="-1">すべての本文を表示</option>
+        <option value="0">スコア0未満のコメントは抜粋表示</option>
+        <option value="1">スコア1未満のコメントは抜粋表示</option>
+        <option value="2">スコア2未満のコメントは抜粋表示</option>
+        <option value="3">スコア3未満のコメントは抜粋表示</option>
+        <option value="4">スコア4未満のコメントは抜粋表示</option>
+        <option value="5">スコア5未満のコメントは抜粋表示</option>
+      </select>
+
+      <button type="button" class="btn btn-default form-control" aria-label="表示設定"
+              v-on:click="showPrefs=!showPrefs" :class="{active: showPrefs}">
+        <span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
+        <span class="btn-text">表示設定</span>
+      </button>
+    </form>
+
+    <form class="form" id="comment-header-advanced" v-show="showPrefs">
+      <div class="checkbox">
+        <label>
+          <input type="checkbox" id="enable-hotkey" name="enable-hotkey" value="1" v-model="config.enable_hotkey" />
+          ショートカットキーの割り当てを有効にする
+        </label>
+      </div>
+      
+      <div class="checkbox">
+        <label>
+          <input type="checkbox" id="auto-fold" name="auto-fold" value="1" v-model="config.auto_fold" />
+          既読コメントを折りたたむ
+        </label>
+      </div>
+      
+      <div class="checkbox">
+        <label>
+          <input type="checkbox" id="hide-signature" name="hide-signature" value="1" v-model="config.hide_signature" />
+          署名を非表示
+        </label>
+      </div>
+      
+      <div class="checkbox">
+        <label>
+          <input type="checkbox" id="hide-score" name="hide-score" value="1" v-model="config.hide_score" />
+          スコアを非表示
+        </label>
+      </div>
+      
+      <div class="form-inline">
+        <button type="button" class="btn form-control btn-default"
+                v-on:click="saveConfig()" :class="{disabled: !savable}">
+          現在の表示設定をデフォルトとして保存
+        </button>
+      </div>
+    </form>
+  </div>
 </script>
 
 <script type="text/x-template" id="comment-tree-template">
@@ -9,7 +87,7 @@
     </div>
     <div class="comment-tree-body">
       <ol>
-        <li v-for="comment in comments" v-if="!comment.pid || comment.pid == rootID">
+        <li v-for="comment in comments" v-if="!comment.pid || comment.pid == rootId">
           <comment :comment="comment"></comment>
         </li>
       </ol>
 
 
 [% helpers.load_js("comment-tree.js") %]
-[%# <script src="/js/comment-tree.js" ></script> %]
 
index b68c984..f47b99f 100644 (file)
@@ -10,7 +10,7 @@
     <div class="[% page.type %] [% page.content_type %] main-contents">
       [%- IF page.content_type == "comment" && page.type == "single" -%]
       <div class="content-notice alert alert-info">
-        <p>このコンテンツは、
+        このコンテンツは、
           [%- IF discussion.kind == "story" -%]
           「<span><a href="/story/[% discussion.sid %]">[% parent_item.title %]</a></span>」記事
           [%- ELSIF discussion.kind == "journal-story" -%]
           [%- ELSE -%]
           「<span>[% discussion.title %]</span>」記事
           [%- END -%]に対するコメントです。
-        </p>
-        
         [%- IF parent -%]
-        <p>親コメントは「<span><a href="/comment/[% parent.cid %]">[% parent.title %]</a></span>」です。</p>
+        親コメントは「<span><a href="/comment/[% parent.cid %]">[% parent.title %]</a></span>」です。
         [%- END -%]
       </div>
       [%- END -%]
 <div id="comments">
   <comment-tree></comment-tree>
 </div>
-<script>commentTree.run({el:'#comments'});</script>
-
+<script>
+  commentTree.run({
+  el:'#comments',
+  userConfig: userConfig,
+  siteConfig: siteConfig,
+  pageInfo: page,
+  user: user,
+  });
+</script>
 [%- IF item.content_type == 'journal' && item.uid == user.uid -%]
 <script>articleItem.addTrigger("#activate-journal-editor", {el: '#content-body'});</script>
 [%- END -%]