OSDN Git Service

aggregate and re-layout templates
authorhylom <hylom@users.sourceforge.jp>
Fri, 27 Oct 2017 10:22:09 +0000 (19:22 +0900)
committerhylom <hylom@users.sourceforge.jp>
Fri, 27 Oct 2017 10:22:09 +0000 (19:22 +0900)
18 files changed:
src/newslash_web/lib/Newslash/Web.pm
src/newslash_web/lib/Newslash/Web/Controller/Archive.pm
src/newslash_web/lib/Newslash/Web/Controller/Comment.pm
src/newslash_web/lib/Newslash/Web/Controller/Journal.pm
src/newslash_web/lib/Newslash/Web/Controller/Poll.pm
src/newslash_web/lib/Newslash/Web/Controller/Story.pm
src/newslash_web/lib/Newslash/Web/Controller/Submission.pm
src/newslash_web/lib/Newslash/Web/Controller/Timeline.pm
src/newslash_web/lib/Newslash/Web/Controller/User.pm
src/newslash_web/templates/archive/index.html.tt2
src/newslash_web/templates/archive/index_header.html.tt2
src/newslash_web/templates/common/article/article.html.tt2
src/newslash_web/templates/common/components/article_item.html.tt2
src/newslash_web/templates/common/poll/poll_body.html.tt2
src/newslash_web/templates/common/sidebar.html.tt2
src/newslash_web/templates/common/single.html.tt2 [new file with mode: 0644]
src/newslash_web/templates/timeline/base.html.tt2
src/newslash_web/templates/user/base.html.tt2

index b6c2d64..f4c790f 100644 (file)
@@ -201,18 +201,18 @@ sub startup {
 
     # story page
     $r->get('/story/:sid/' => [sid => qr|\d\d/\d\d/\d\d/\d+|])
-      ->to('story#story');
+      ->to('story#single');
 
     # comment page
     $r->get('/comment/:cid/')->to('comment#single');
 
     # journal page
     $r->get('/journal/new')->to('journal#create', seclev => 1);
-    $r->get('/journal/:id/')->to('journal#journal');
+    $r->get('/journal/:id/')->to('journal#single');
 
     # submission page
     $r->get('/submission/new')->to('submission#create');
-    $r->get('/submission/:id/')->to('submission#submission');
+    $r->get('/submission/:id/')->to('submission#single');
     #$r->post('/submission')->to('submission#create');
 
     # polls page
index fdeca1a..2b82d62 100644 (file)
@@ -82,14 +82,6 @@ sub _render_archive {
     }
 
     $year = $year + 2000;
-    my $property = { year => $year,
-                     month => $month,
-                     day => $day,
-                     type => 'archive',
-                     target => $type,
-                     title => $params->{title},
-                   };
-
     my $offset_sec = $user->{config}->{offset_sec} || 0;
     my $q_params = { year => $year,
                      month => $month,
@@ -136,13 +128,19 @@ sub _render_archive {
         $next = Newslash::Util::Items->get_date_string_from_item($next_items->[0], $offset_sec, $unit);
     }
 
+    my $page = { content_type => $type,
+                 type => "archive",
+                 year => $year,
+                 month => $month,
+                 day => $day,
+               };
+
     $c->render(template => 'archive/index',
-               items => $items,
+               contents => $items,
                counts => $counts,
-               page_property => $property,
+               page => $page,
                prev => $prev,
                next => $next,
-               archive_type => $type,
               );
 
     if (@$items == 0) {
index 5611892..d7118b6 100644 (file)
@@ -35,9 +35,14 @@ sub single {
     #    }
     #}
 
-    $c->render(comment => $comment,
+    my $page = { content_type => "comment",
+                 type => "single" };
+
+    $c->render(template => "common/single",
+               content => $comment,
                parent => $parent,
                discussion => $discuss,
+               page => $page,
               );
 }
 
index 1f49232..a67fb27 100644 (file)
@@ -3,7 +3,7 @@ use Mojo::Base 'Mojolicious::Controller';
 use Data::Dumper;
 use List::Util qw(any);
 
-sub journal {
+sub single {
     my $c = shift;
     my $users = $c->model('users');
     my $user = $c->stash('user');
@@ -29,10 +29,15 @@ sub journal {
 
     }
 
-    $c->render(story => $journal,
+    my $page = { content_type => "journal",
+                 type => "single" };
+
+    $c->render(template => "common/single",
+               content => $journal,
                discussion => $discuss,
                comments => $comments,
                the_user => $the_user,
+               page => $page,
                use_captcha => 1,
                comment_allowed => $comment_allowed,
               );
index 17e972d..fb52481 100644 (file)
@@ -41,7 +41,13 @@ sub single {
     $poll->{active} = _is_poll_active($c, $poll);
 
     my $related_polls = $c->model('polls')->select(limit => 10, order_by => {create_time => "DESC"});
-    $c->render(story => $poll,
+
+    my $page = { content_type => "poll",
+                 type => "single" };
+
+    $c->render(template => "common/single",
+               content => $poll,
+               page => $page,
                discussion => $discuss,
                related => $related_polls,
               );
index 8d236c9..cbe6e53 100644 (file)
@@ -2,7 +2,7 @@ package Newslash::Web::Controller::Story;
 use Mojo::Base 'Mojolicious::Controller';
 use Mojo::Util qw(dumper);
 
-sub story {
+sub single {
     my $c = shift;
     my $session = $c->session('session');
     my $sid = $c->stash('sid');
@@ -44,7 +44,11 @@ sub story {
     my $mod_reasons = $c->model('moderations')->reasons;
     $c->stash(moderate_reasons => $mod_reasons);
 
-    $c->render(story => $story,
+    my $page = { type => "single",
+                 content_type => "story",
+               };
+    $c->render(template => "common/single",
+               content => $story,
                discussion => $discuss,
                comments => $comments,
                related => $related,
@@ -52,7 +56,7 @@ sub story {
                params => $params,
                authors => $authors,
                use_captcha => 1,
-               comment_allowed => 1,
+               page => $page,
               );
 }
 
index 1d0b035..1d1154a 100644 (file)
@@ -2,7 +2,7 @@ package Newslash::Web::Controller::Submission;
 use Mojo::Base 'Mojolicious::Controller';
 use Data::Dumper;
 
-sub submission {
+sub single {
     my $c = shift;
     my $subid = $c->stash('id');
     my $user = $c->stash('user');
@@ -23,9 +23,15 @@ sub submission {
         $comment_allowed = $discussions->is_comment_allowed(discussion => $discuss,
                                                             uid => $user->{uid});
     }
-    $c->render(story => $submission,
+
+    my $page = { content_type => "submission",
+                 type => "single" };
+
+    $c->render(template => "common/single",
+               content => $submission,
                discussion => $discuss,
                comments => $comments,
+               page => $page,
                use_captcha => 1,
                comment_allowed => $comment_allowed,
               );
index f5b5a85..3491304 100644 (file)
@@ -56,11 +56,16 @@ sub _render_timeline {
         $prev = $self->_make_navitem($prev_item);
     }
 
+    my $page = { type => "timeline",
+                  content_type => $params->{content_type},
+                };
+
     $self->render("timeline/base",
-                  items => $items,
+                  contents => $items,
                   prev => $prev,
                   title => $params->{title},
-                  timeline => 1);
+                  page => $page,
+                 );
 }
 
 sub stories {
@@ -84,6 +89,7 @@ sub stories {
                                         );
 
     $c->_render_timeline(items => $items,
+                         content_type => "story",
                          limit => $limit);
 }
 
@@ -95,6 +101,7 @@ sub recent {
                                         limit => $limit);
 
     $c->_render_timeline(items => $items,
+                         content_type => "recent",
                          limit => $limit,
                          title => "最新");
 };
@@ -128,6 +135,7 @@ sub popular {
                                         %$popular_period);
 
     $c->_render_timeline(items => $items,
+                         content_type => "popular",
                          limit => $limit,
                          title => "人気");
 }
@@ -158,6 +166,7 @@ sub journals {
 
     $c->_render_timeline(items => $items,
                          limit => $limit,
+                         content_type => "comment",
                          title => "日記");
 }
 
@@ -172,6 +181,7 @@ sub submissions {
 
     $c->_render_timeline(items => $items,
                          limit => $limit,
+                         content_type => "submission",
                          title => "タレコミ");
 }
 
@@ -186,6 +196,7 @@ sub polls {
 
     $c->_render_timeline(items => $items,
                          limit => $limit,
+                         content_type => "poll",
                          title => "国民投票");
 }
 
index c8a9587..a0e8b98 100644 (file)
@@ -33,10 +33,18 @@ sub _base_render {
         }
     }
 
+    my $page = { type => "user" };
+    my $content_type_table = { home => "recent",
+                               comments => "comment",
+                               journals => "journal",
+                               submissions => "submission"
+                             };
+    $page->{content_type} = $content_type_table->{$tab} || "user";
+
     $c->render(template => "user/base",
-               page_property => { type => "user" },
+               page => $page,
                user_tab => $tab,
-               items => $items,
+               contents => $items,
                the_user => $the_user,
                relation => $relation
               );
index 34855b2..67a0bbd 100644 (file)
@@ -2,7 +2,7 @@
 
 <div class="main-column">
 
-  <div class="index main-contents">
+  <div class="archive [% page.content_type %] index main-contents">
     [%- INCLUDE archive/index_header.html.tt2 -%]
 
     [%- IF items.size == 0 -%]
@@ -11,7 +11,7 @@
     </div>
     [%- END -%]
 
-    [%- FOREACH story IN items -%]
+    [%- FOREACH content IN contents -%]
     [%- INCLUDE common/article/article %]
     [%- END -%]
 
index fceec7e..43181f0 100644 (file)
@@ -1,16 +1,16 @@
 [%-
 USE cal = MicroCalendar;
-last_day = cal.last_day_of_month(page_property.year, page_property.month);
-dow = cal.day_of_week(page_property.year, page_property.month, 1);
+last_day = cal.last_day_of_month(page.year, page.month);
+dow = cal.day_of_week(page.year, page.month, 1);
 days = ['日', '月','火','水','木','金','土','日'];
 classes = ['sunday', 'monday','tuesday','wednesday','thursday','friday','saturday','sunday'];
-yyyy = page_property.year;
-yy = page_property.year.substr(2, 2);
-mm = page_property.month;
+yyyy = page.year;
+yy = page.year.substr(2, 2);
+mm = page.month;
 m = mm + 0;
-dd = page_property.day;
+dd = page.day;
 d = dd + 0;
-ctype = page_property.target;
+ctype = page.target;
 
 p_yy = cal.year_of_previous_month(yyyy, m).substr(2, 2);
 p_mm = cal.previous_month(yyyy, m);
index 738bb7e..ca69478 100644 (file)
 [%-
 USE dtf = DateTimeFormatter;
-IF story.content_type == 'story'; content_id = story.sid; END;
-IF story.content_type == 'journal'; content_id = story.id; END;
-IF story.content_type == 'submission'; content_id = story.subid; END;
-IF story.content_type == 'poll'; content_id = story.qid; END;
-IF story.content_type == 'vote'; content_id = story.qid; END;
+IF content.content_type == 'story'; content_id = content.sid; END;
+IF content.content_type == 'journal'; content_id = content.id; END;
+IF content.content_type == 'submission'; content_id = content.subid; END;
+IF content.content_type == 'poll'; content_id = content.qid; END;
+IF content.content_type == 'vote'; content_id = content.qid; END;
 
-IF story.content_type == 'story'; url = "/story/" _ story.sid _ "/"; END;
-IF story.content_type == 'journal'; url = "/journal/" _ story.id _ "/"; END;
-IF story.content_type == 'submission'; url = "/submission/" _ story.id _ "/"; END;
-IF story.content_type == 'comment'; url = "/comment/" _ story.id _ "/"; END;
-IF story.content_type == 'poll'; url = "/poll/" _ story.id _ "/"; END;
+IF content.content_type == 'story'; url = "/story/" _ content.sid _ "/"; END;
+IF content.content_type == 'journal'; url = "/journal/" _ content.id _ "/"; END;
+IF content.content_type == 'submission'; url = "/submission/" _ content.id _ "/"; END;
+IF content.content_type == 'comment'; url = "/comment/" _ content.id _ "/"; END;
+IF content.content_type == 'poll'; url = "/poll/" _ content.id _ "/"; END;
 -%]
 
-<article id="[% story.id %]" type="[% story.content_type %]" item-id="[% content_id %]"
+<article id="[% content.id %]" type="[% content.content_type %]" item-id="[% content_id %]"
          [% IF !x_template %]v-if="0"[% ELSE %]v-if="mode != 'editing' || enableAutoPreview"[% END %]>
   <header>
     <h1>
-      [%- IF story.primary_topic.image.length || x_template -%]
-      <img [% IF story.primary_topic.image %]src="[% Site.topic_icon_base_url %]/[% story.primary_topic.image %]"[% END %]
+      [%- IF content.primary_topic.image.length || x_template -%]
+      <img [% IF content.primary_topic.image %]src="[% Site.topic_icon_base_url %]/[% content.primary_topic.image %]"[% END %]
            :src="primaryTopicIconURL" v-if="primaryTopicIconURL" />
       [%- END -%]
       [%- IF url -%]
-      <a href="[% url %]" v-html="item.title">[% story.title %]</a>
+      <a href="[% url %]" v-html="content.title">[% content.title %]</a>
       [%- ELSE -%]
-      <span v-html="item.title">[% story.title %]</span>
+      <span v-html="content.title">[% content.title %]</span>
       [%- END -%]
     </h1>
 
     <div class="property">
       <span class="content-type">
-        [%- IF story.content_type == 'story' -%]ストーリー[%- END -%]
-        [%- IF story.content_type == 'feed' -%]フィード[%- END -%]
-        [%- IF story.content_type == 'journal' -%]日記[%- END -%]
-        [%- IF story.content_type == 'submission' -%]タレコミ[%- END -%]
-        [%- IF story.content_type == 'comment' -%]コメント[%- END -%]
-        [%- IF story.content_type == 'poll' -%]国民投票[%- END -%]
+        [%- IF content.content_type == 'story' -%]ストーリー[%- END -%]
+        [%- IF content.content_type == 'feed' -%]フィード[%- END -%]
+        [%- IF content.content_type == 'journal' -%]日記[%- END -%]
+        [%- IF content.content_type == 'submission' -%]タレコミ[%- END -%]
+        [%- IF content.content_type == 'comment' -%]コメント[%- END -%]
+        [%- IF content.content_type == 'poll' -%]国民投票[%- END -%]
       </span>
       <span class="author">
-        by <span v-text="item.author"><a href="/~[% story.author %]/">[% story.author %]</a></span>
+        by <span v-text="content.author"><a href="/~[% content.author %]/">[% content.author %]</a></span>
       </span>
-      <span class="create-time" v-text="item.create_time">[% dtf.mysql_to_user(story.create_time, user.config.offset_sec, user.config.time_format) %]</span>
-      [% IF story.content_type == 'story' %]<span class="dept"><span v-text="item.dept" v-if="item.dept">[% story.dept %]</span> 部門より</span>[% END %]
+      <span class="create-time" v-text="content.create_time">[% dtf.mysql_to_user(content.create_time, user.config.offset_sec, user.config.time_format) %]</span>
+      [% IF content.content_type == 'story' %]<span class="dept"><span v-text="content.dept" v-if="content.dept">[% content.dept %]</span> 部門より</span>[% END %]
     </div>
 
     <div class="toolbar" v-if="mode == ''">
-      [%- IF story.content_type == 'journal' && story.uid == user.uid || x_template -%]
+      [%- IF content.content_type == 'journal' && content.uid == user.uid || x_template -%]
       <button type="button" class="btn btn-default btn-sm"
               area-label="編集" v-show="editable" v-on:click="editItem(item)">
         <span class="glyphicon glyphicon-pencil"></span>
       </button>
       [%- END -%]
-      [%- IF story.content_type == 'story' && user.is_admin || user.editor || x_template -%]
+      [%- IF content.content_type == 'story' && user.is_admin || user.editor || x_template -%]
       <button type="button" class="btn btn-default btn-sm" id="activate-editor"
               area-label="編集" title="編集" v-on:click="editItem(item)"
               v-if="editable">
         <span class="glyphicon glyphicon-cog"></span>
       </button>
       [%- END -%]
-      [%- IF story.content_type == 'submission' && (user.author || x_template) -%]
-      [<a href="/admin/story/edit?subid=[% story.submission_id %]">accept</a>]
+      [%- IF content.content_type == 'submission' && (user.author || x_template) -%]
+      [<a href="/admin/story/edit?subid=[% content.submission_id %]">accept</a>]
       [%- END -%]
     </div>
   </header>
 
   <div class="body contents-text">
-    [%- IF story.content_type == 'poll' -%]
+    [%- IF content.content_type == 'poll' -%]
       [% INCLUDE common/poll/poll_body %]
-    [%- ELSIF story.content_type == 'vote' -%]
+    [%- ELSIF content.content_type == 'vote' -%]
       [% INCLUDE common/poll/vote_body %]
     [%- END -%]
   </div>
 
-  [%- IF story.introtext || x_template -%]
-  <div class="body contents-text" v-html="item.introtext">[% story.introtext %]</div>
+  [%- IF content.introtext || x_template -%]
+  <div class="body contents-text" v-html="content.introtext">[% content.introtext %]</div>
   [%- END -%]
 
-  [% IF story.content_type != "journal" && story.bodytext && !hide_bodytext %]
-  <div class="body contents-text" v-html="item.bodytext">[% story.bodytext %]</div>
+  [% IF content.content_type != "journal" && content.bodytext && !hide_bodytext %]
+  <div class="body contents-text" v-html="content.bodytext">[% content.bodytext %]</div>
   [% END %]
 
   [%- IF x_template -%]
-  <div class="body contents-text" v-if="item.url"><p><a :href="item.url">情報元へのリンク</a></p></div>
-  [%- ELSIF story.url -%]
-  <div class="body contents-text"><p><a href="[% story.url %]">情報元へのリンク</a></p></div>
+  <div class="body contents-text" v-if="content.url"><p><a :href="content.url">情報元へのリンク</a></p></div>
+  [%- ELSIF content.url -%]
+  <div class="body contents-text"><p><a href="[% content.url %]">情報元へのリンク</a></p></div>
   [%- END -%]
 
   <footer>
     [%- IF !hide_more_link -%]
-    [%- IF story.content_type != "feed" -%]
+    [%- IF content.content_type != "feed" -%]
     <div class="link-to-story" v-if="mode == ''"><a href="[% url %]" :href="url">
-        [%- IF story.content_type == "poll" -%]
-        [%- IF story.commentcount || x_template -%]
-       <span v-if="item.commentcount > 0">投票結果と<span v-text="item.commentcount">[% story.commentcount %]</span>件のコメントを見る</span>
+        [%- IF content.content_type == "poll" -%]
+        [%- IF content.commentcount || x_template -%]
+       <span v-if="content.commentcount > 0">投票結果と<span v-text="content.commentcount">[% content.commentcount %]</span>件のコメントを見る</span>
         [%- END -%]
-        [%- IF !story.commentcount || x_template -%]<span v-if="item.commentcount == 0">投票結果を見る</span>[%- END -%]
+        [%- IF !content.commentcount || x_template -%]<span v-if="content.commentcount == 0">投票結果を見る</span>[%- END -%]
         [%- ELSE -%]
         [%- link_target = "記事" -%]
-        [%- IF story.commentcount || x_template -%]
-       <span v-if="item.commentcount > 0">[% link_target %]と<span v-text="item.commentcount">[% story.commentcount %]</span>件のコメントを読む</span>
+        [%- IF content.commentcount || x_template -%]
+       <span v-if="content.commentcount > 0">[% link_target %]と<span v-text="content.commentcount">[% content.commentcount %]</span>件のコメントを読む</span>
         [%- END -%]
-        [%- IF !story.commentcount || x_template -%]
-       <span v-if="item.commentcount == 0">[% link_target %]を読む</span>
+        [%- IF !content.commentcount || x_template -%]
+       <span v-if="content.commentcount == 0">[% link_target %]を読む</span>
         [%- END -%]
         [%- END -%]
     </a></div>
     [%- END -%]
     [%- ELSE -%]
     <div class="comment-counter">
-      [%- IF story.discussion_id -%]
-      <a href="#comments"><span class="counter" v-text="item.commentcount">[% story.commentcount %]</span>コメント</a>
+      [%- IF content.discussion_id -%]
+      <a href="#comments"><span class="counter" v-text="content.commentcount">[% content.commentcount %]</span>コメント</a>
       [%- END -%]
     </div>
     [%- END -%]
 
     <div class="tag-bar">
       <ul class="tags">
-       [%- FOREACH tag IN story.tags -%]
-       [%- IF tag.private == "no" && tag.tagname != "mainpage" && tag.uid == story.uid -%]
+       [%- FOREACH tag IN content.tags -%]
+       [%- IF tag.private == "no" && tag.tagname != "mainpage" && tag.uid == content.uid -%]
         <li>[% tag.tagname %]</li>
         [%- END -%]
        [%- END -%]
index a6593fa..527e440 100644 (file)
@@ -3,8 +3,8 @@
 <script type="text/x-template" id="article-item-template">
   <div class="article">
     <div class="preview-header" v-if="mode == 'editing' && enableAutoPreview">投稿プレビュー:</div>
-    [% INCLUDE common/article/article story={content_type => type} x_template=1 hide_more_link = 0 %]
-    [% INCLUDE common/article/editor story={content_type => type} x_template=1 %]
+    [% INCLUDE common/article/article content={content_type => type} x_template=1 hide_more_link = 0 %]
+    [% INCLUDE common/article/editor content={content_type => type} x_template=1 %]
   </div>
 </script>
 
index 0cae68c..4f01240 100644 (file)
@@ -1,16 +1,16 @@
 <div id="poll-body">
   [%- IF timeline -%]
   <div class="poll">
-    <p class="poll-title">[% story.title %]</p>
+    <p class="poll-title">[% content.title %]</p>
     <ol class="poll-answers">
-      [%- FOREACH answer IN story.answers -%]
+      [%- FOREACH answer IN content.answers -%]
       <li>[% answer.answer %]</li>
       [%- END -%]
     </ol>
   </div>
   [%- ELSE -%]
   <div class="poll-results">
-    [%- FOREACH answer IN story.answers -%]
+    [%- FOREACH answer IN content.answers -%]
     <div class="poll-answer">
       <div class="answer-text">[% answer.answer %]</div>
       <div class="poll-graph-wrapper">
@@ -20,6 +20,6 @@
     </div>
     [%- END -%]
   </div>
-  <div class="total">合計 [% story.voters %]票</div>
+  <div class="total">合計 [% content.voters %]票</div>
   [%- END %]
 </div>
index 1e13ca1..60f8e70 100644 (file)
@@ -1,6 +1,14 @@
 <div class="sidebar">
 
-  [%- IF mode == "story" -%]
+  [%- IF page.type == "timeline" || page.type == "archive" -%]
+  [%- INCLUDE common/ads/main_rectangle -%]
+  [%- FOREACH box IN NS.sidebar_items() -%]
+  <div class="sidebar-item contents-text [% box.type %] [% box.name %]">
+    [%- box.contents -%]
+  </div>
+  [%- END -%]
+
+  [%- ELSIF page.content_type == "story" -%]
   [% INCLUDE common/ads/main_rectangle %]
   <div class="sidebar-item related">
     <h2>関連リンク</h2>
     [%- END -%]
   </div>
 
-  [%- ELSIF mode == "comment" -%]
+  [%- ELSIF page.content_type == "comment" -%]
   [% INCLUDE common/ads/main_rectangle %]
 
-  [%- ELSIF mode == "poll" -%]
+  [%- ELSIF page.content_type == "poll" -%]
   [% INCLUDE common/ads/main_rectangle %]
   <div class="sidebar-item related">
     <h2>最近の国民投票</h2>
     </ul>
   </div>
 
-  [%- ELSIF mode == "journal" -%]
+  [%- ELSIF page.content_type == "journal" -%]
   <div class="abbrevable">
     [% INCLUDE common/user %]
   </div>
+
   [%- ELSE -%]
   [% INCLUDE common/ads/main_rectangle %]
-  [%- FOREACH box IN NS.sidebar_items() -%]
-  <div class="sidebar-item contents-text [% box.type %] [% box.name %]">
-    [%- box.contents -%]
-  </div>
-  [%- END -%]
+
   [%- END -%]
 </div>
diff --git a/src/newslash_web/templates/common/single.html.tt2 b/src/newslash_web/templates/common/single.html.tt2
new file mode 100644 (file)
index 0000000..a2fbc5e
--- /dev/null
@@ -0,0 +1,85 @@
+[% WRAPPER common/layout enable_sidebar=1 short_header=1 %]
+
+[% INCLUDE common/components/comment_tree %]
+[% IF user.editor || user.is_admin -%]
+[% INCLUDE common/components/article_item %]
+[% END -%]
+
+<div class="main-column">
+  <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 %]">[% discussion.title %]</a></span>」記事
+        [%- ELSE -%]
+        「<span>[% discussion.title %]</span>」記事
+        [%- END -%]に対するコメントです。</p>
+      
+      [%- IF comment.parent_id != 0 -%]
+      <p>親コメントは「<span><a href="/comment/[% parent.cid %]">[% parent.title %]</a></span>」です。</p>
+      [%- END -%]
+    </div>
+    [%- END -%]
+
+    <div id="content-body">
+      [%- INCLUDE common/article/article hide_more_link=1 -%]
+      <article-item></article-item>
+    </div>
+
+    [%- IF page.type == "single" && page.content_type == "story" -%]
+    <div class="next-prev-story">
+      [%- IF params.prev_stoid && params.prev_stoid.story -%]
+      <div class="prev"><a href="/story/[% params.prev_stoid.story.sid %]">
+          [% params.prev_stoid.story.title %]
+      </a></div>
+      [%- END -%]
+      [%- IF params.next_stoid && params.next_stoid.story -%]
+      <div class="next"><a href="/story/[% params.next_stoid.story.sid %]">
+          [% params.next_stoid.story.title %]
+      </a></div>
+      [%- END -%]
+    </div>
+    <div class="related">
+      <div id="story-ads-native-contents" class="ads-native-contents">
+        [%- INCLUDE ads/native_contents -%]
+      </div>
+    </div>
+    [%- END -%]
+
+    [%- IF !discussion -%]
+    <div class="alert alert-info">
+      この投稿に対するコメントは設定により無効にされています。
+    </div>
+    [%- ELSIF discussion.commentstatus == "disabled" -%]
+    <div class="alert alert-info">
+      この投稿に対するコメントは設定により無効にされています。
+    </div>
+    [%- ELSIF discussion.commentstatus == "logged_in" -%]
+    <div class="alert alert-info">
+      この投稿に対するコメントはログインユーザーにのみ許可されています。
+    </div>
+    [%- ELSIF discussion.commentstatus != "enabled" -%]
+    <div class="alert alert-info clear">
+      この投稿に対するコメントは一部のユーザーのみに許可されています。
+    </div>
+    [%- END -%]
+
+  </div><!-- .story -->
+</div><!-- .main-column -->
+
+[%- INCLUDE common/sidebar -%]
+
+[%#- INCLUDE common/comment/comments_nojs -%]
+[%#- INCLUDE common/comment/comments -%]
+<div id="comments">
+  <comment-tree></comment-tree>
+</div>
+<script>commentTree.run({el:'#comments'});</script>
+
+[%- IF user.editor || user.is_admin -%]
+<script>articleItem.addTrigger('#activate-editor', {el: '#content-body'});</script>
+[%- END -%]
+
+[% END %]
index 2bd20c5..4840ab2 100644 (file)
@@ -2,7 +2,7 @@
 
 <div class="main-column">
   <div class="index main-contents">
-    [%- FOREACH story IN items -%]
+    [%- FOREACH content IN contents -%]
     [%- INCLUDE common/article/article %]
     [%- END -%]
 
index 75b972f..be44884 100644 (file)
     </nav>
   </div>
 
-  [%- SWITCH user_tab %]
-  [%- CASE ['friends', 'foes', 'fans', 'freaks' ] -%]
-  <div class="index main-contents">
-      [%- FOREACH item IN items -%]
-      [% INCLUDE common/user the_user=item no_form=1 %]
-      [%- END -%]
-  </div>
-  [%- CASE DEFAULT -%]
-  <div class="index main-contents">
-    [%- FOREACH item IN items -%]
+  <div class="user [%- page.content_type -%] main-contents">
+    [%- SWITCH user_tab %]
+    [%- CASE ['friends', 'foes', 'fans', 'freaks' ] -%]
+    [%- FOREACH user IN contents -%]
+    [% INCLUDE common/user the_user=user no_form=1 %]
+    [%- END -%]
+
+    [%- CASE DEFAULT -%]
+    [%- FOREACH content IN contents -%]
     [%- INCLUDE common/article/article story=item %]
     [%- END -%]
   </div><!-- .index -->
   [%- END -%]
 </div>
 
-<div class="sidebar">
-</div>
+[%- INCLUDE common/sidebar -%]
 
 [%- IF user.uid != the_user.uid && user.is_login -%]
 <script src="/js/user-profile.js"></script>