page_list.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. {% extends 'layout/2column.html' %}
  2. {% block html_title %}{{ path|path2name }} · {{ path }}{% endblock %}
  3. {% block content_head %}
  4. {% block content_head_before %}
  5. {% endblock %}
  6. <div class="header-wrap">
  7. <header class="portal-header {% if page %}has-page{% endif %}">
  8. {% if page %}
  9. <a href="#" title="Bookmark" class="bookmark-link" id="bookmark-button" data-bookmarked="0"><i class="fa fa-star-o"></i></a>
  10. {% endif %}
  11. <h1 class="title" id="revision-path">
  12. {{ path }}
  13. </h1>
  14. </header>
  15. </div>
  16. {% endblock %}
  17. {% block content_head_after %}
  18. {% endblock %}
  19. {% block content_main %}
  20. {% block content_main_before %}
  21. {% endblock %}
  22. <div class="page-list content-main {% if req.body.pageForm %}on-edit{% endif %}"
  23. id="content-main"
  24. data-page-portal="{% if page and page.isPortal() %}1{% else %}0{% endif %}"
  25. data-page-id="{% if page %}{{ page._id.toString() }}{% endif %}"
  26. data-current-user="{% if user %}{{ user._id.toString() }}{% endif %}"
  27. data-page-revision-id="{% if revision %}{{ revision._id.toString() }}{% endif %}"
  28. data-page-revision-created="{% if revision %}{{ revision.createdAt|datetz('U') }}{% endif %}"
  29. data-page-is-seen="{% if page and page.isSeenUser(user) %}1{% else %}0{% endif %}"
  30. >
  31. <div class="portal">
  32. {% if page %}
  33. <ul class="nav nav-tabs hidden-print">
  34. <li class=" {% if not req.body.pageForm %}active{% endif %}">
  35. {% if page.isPortal() %}
  36. <a href="#revision-body" data-toggle="tab">
  37. <i class="fa fa-magic"></i>
  38. <span class="portal-label">PORTAL</span>
  39. </a>
  40. {% endif %}
  41. </li>
  42. <li {% if req.body.pageForm %}class="active"{% endif %}><a href="#edit-form" data-toggle="tab"><i class="fa fa-pencil-square-o"></i> 編集</a></li>
  43. {#
  44. <li class="dropdown pull-right">
  45. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  46. <i class="fa fa-wrench"></i> <span class="caret"></span>
  47. </a>
  48. <ul class="dropdown-menu">
  49. <li><a href="#" data-target="#" data-toggle="modal"><i class="fa fa-share"></i> 移動</a></li>
  50. </ul>
  51. </li>
  52. #}
  53. </ul>
  54. <div class="tab-content wiki-content">
  55. <div class="wiki tab-pane" id="revision-body-content">
  56. </div>
  57. <script type="text/template" id="raw-text-original">{{ page.revision.body }}</script>
  58. <script type="text/javascript">
  59. $(function(){
  60. var renderer = new Crowi.renderer($('#raw-text-original').html());
  61. renderer.render();
  62. Crowi.correctHeaders('#revision-body-content');
  63. });
  64. </script>
  65. // .. edit ............. html 構造の整理が必要
  66. </div>
  67. {% endif %}
  68. <div class="portal-form-header">
  69. Create Portal: <strong>{{ path }}</strong>
  70. <p class="pull-right ">
  71. <a href="#" id="portal-form-close"><i class="fa fa-times"></i></a>
  72. </p>
  73. </div>
  74. <div class="portal-form">
  75. <div class="edit-form">
  76. {% include '_form.html' %}
  77. </div>
  78. </div>
  79. </div>
  80. <ul class="nav nav-tabs">
  81. <li class="active"><a href="#view-list" data-toggle="tab">リスト表示</a></li>
  82. <li><a href="#view-timeline" data-toggle="tab">タイムライン表示</a></li>
  83. </ul>
  84. <div class="tab-content">
  85. {% if pages.length == 0 %}
  86. There are no pages under <strong>{{ path }}</strong>.
  87. <h3>Next Actions</h3>
  88. <ul>
  89. <li>Create portal page?
  90. <ul>
  91. <li>Great! To create the portal of <strong>{{ path }}</strong>, click "Create Portal" button.</li>
  92. </ul>
  93. </li>
  94. <li>Create the under page directly?
  95. <ul>
  96. <li>Nice. To create the page under <strong>{{ path }}</strong> directly, type the page name on your browser.</li>
  97. </ul>
  98. </li>
  99. </ul>
  100. {% endif %}
  101. {# list view #}
  102. <div class="active tab-pane fade page-list-container in" id="view-list">
  103. <ul class="page-list-ul">
  104. {% for page in pages %}
  105. <li class="page-list-li">
  106. <img src="{{ page.revision.author|picture }}" class="picture picture-rounded">
  107. <a class="page-list-link" href="{{ page.path }}"
  108. data-path="{{ page.path }}"
  109. data-short-path="{{ page.path|path2name }}">{{ page.path }}</a>
  110. <span class="page-list-meta">
  111. {% if page.isPortal() %}
  112. <span class="label label-info">PORTAL</span>
  113. {% endif %}
  114. {% if page.commentCount > 0 %}
  115. <i class="fa fa-comment"></i>{{ page.commentCount }}
  116. {% endif %}
  117. {% if !page.isPublic() %}
  118. <i class="fa fa-lock"></i>
  119. {% endif %}
  120. </span>
  121. </li>
  122. {% endfor %}
  123. </ul>
  124. <ul class="pagination">
  125. {% if pager.prev != null %}
  126. <li class="prev"><a href="{{ path }}?offset={{ pager.prev }}&limit={{ pager.limit }}"><i class="fa fa-arrow-left"></i> Prev</a></li>
  127. {% endif %}
  128. {# この条件は無いな.. #}
  129. {% if pages.length > 0 %}
  130. <li class="next"><a href="{{ path }}?offset={{ pager.next }}&limit={{ pager.limit }}">Next <i class="fa fa-arrow-right"></i></a></li>
  131. {% endif %}
  132. </ul>
  133. </div>
  134. {# timeline view #}
  135. <div class="tab-pane" id="view-timeline">
  136. {% for page in pages %}
  137. <div class="timeline-body" id="id-{{ page.id }}">
  138. <h3 class="revision-path"><a href="{{ page.path }}">{{ page.path }}</a></h3>
  139. <div class="revision-body wiki"></div>
  140. <script type="text/template">{{ page.revision.body }}</script>
  141. </div>
  142. <hr>
  143. {% endfor %}
  144. </div>
  145. </div>
  146. <script type="text/javascript">
  147. $(function(){
  148. $('#view-list .page-list-link').each(function() {
  149. var $link = $(this);
  150. var text = $link.text();
  151. var path = $link.data('path');
  152. var shortPath = $link.data('short-path');
  153. $link.html(path.replace(shortPath, '<strong>' + shortPath + '</strong>'));
  154. });
  155. $('#view-timeline .timeline-body').each(function()
  156. {
  157. var id = $(this).attr('id');
  158. var contentId = '#' + id + ' > script';
  159. var revisionBody = '#' + id + ' .revision-body';
  160. var revisionPath = '#' + id + ' .revision-path';
  161. var renderer = new Crowi.renderer($(contentId).html(), $(revisionBody));
  162. renderer.render();
  163. });
  164. //$('.tooltip .tabs').tabs();
  165. });
  166. </script>
  167. </div> {# /.content-main #}
  168. {% block content_main_after %}
  169. {% endblock %}
  170. {% endblock %}
  171. {% block content_footer %}
  172. <footer>
  173. </footer>
  174. {% endblock %}
  175. {% block side_header %}
  176. {% if not page %}
  177. <div class="portal-side">
  178. <div class="portal-form-button">
  179. <button class="btn btn-primary" id="create-portal-button">Create Portal</button>
  180. <p class="help-block"><a href="#" data-target="#help-portal" data-toggle="modal"><i class="fa fa-question-circle"></i> What is Portal?</a></p>
  181. </div>
  182. </div>
  183. {% else %}
  184. {% include 'widget/page_side_header.html' %}
  185. {% endif %}
  186. {% endblock %} {# side_header #}
  187. {% include 'modal/widget_what_is_portal.html' %}