page_list.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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 %} {# portal tab #}
  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. {% endif %} {# portal tab #}
  55. {% if page %} {# portal tab #}
  56. <div class="tab-content wiki-content">
  57. <div class="wiki tab-pane" id="revision-body-content">
  58. </div>
  59. <script type="text/template" id="raw-text-original">{{ page.revision.body }}</script>
  60. <script type="text/javascript">
  61. $(function(){
  62. var renderer = new Crowi.renderer($('#raw-text-original').html());
  63. renderer.render();
  64. Crowi.correctHeaders('#revision-body-content');
  65. });
  66. </script>
  67. <div class="tab-pane portal-edit" id="edit-form">
  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. </div>
  81. {% endif %} {# portal tab #}
  82. </div>
  83. <ul class="nav nav-tabs">
  84. <li class="active"><a href="#view-list" data-toggle="tab">リスト表示</a></li>
  85. <li><a href="#view-timeline" data-toggle="tab">タイムライン表示</a></li>
  86. </ul>
  87. <div class="tab-content">
  88. {% if pages.length == 0 %}
  89. There are no pages under <strong>{{ path }}</strong>.
  90. <h3>Next Actions</h3>
  91. <ul>
  92. <li>Create portal page?
  93. <ul>
  94. <li>Great! To create the portal of <strong>{{ path }}</strong>, click "Create Portal" button.</li>
  95. </ul>
  96. </li>
  97. <li>Create the under page directly?
  98. <ul>
  99. <li>Nice. To create the page under <strong>{{ path }}</strong> directly, type the page name on your browser.</li>
  100. </ul>
  101. </li>
  102. </ul>
  103. {% endif %}
  104. {# list view #}
  105. <div class="active tab-pane fade page-list-container in" id="view-list">
  106. <ul class="page-list-ul">
  107. {% for page in pages %}
  108. <li class="page-list-li">
  109. <img src="{{ page.revision.author|picture }}" class="picture picture-rounded">
  110. <a class="page-list-link" href="{{ page.path }}"
  111. data-path="{{ page.path }}"
  112. data-short-path="{{ page.path|path2name }}">{{ page.path }}</a>
  113. <span class="page-list-meta">
  114. {% if page.isPortal() %}
  115. <span class="label label-info">PORTAL</span>
  116. {% endif %}
  117. {% if page.commentCount > 0 %}
  118. <i class="fa fa-comment"></i>{{ page.commentCount }}
  119. {% endif %}
  120. {% if !page.isPublic() %}
  121. <i class="fa fa-lock"></i>
  122. {% endif %}
  123. </span>
  124. </li>
  125. {% endfor %}
  126. </ul>
  127. <ul class="pagination">
  128. {% if pager.prev != null %}
  129. <li class="prev"><a href="{{ path }}?offset={{ pager.prev }}&limit={{ pager.limit }}"><i class="fa fa-arrow-left"></i> Prev</a></li>
  130. {% endif %}
  131. {# この条件は無いな.. #}
  132. {% if pages.length > 0 %}
  133. <li class="next"><a href="{{ path }}?offset={{ pager.next }}&limit={{ pager.limit }}">Next <i class="fa fa-arrow-right"></i></a></li>
  134. {% endif %}
  135. </ul>
  136. </div>
  137. {# timeline view #}
  138. <div class="tab-pane" id="view-timeline">
  139. {% for page in pages %}
  140. <div class="timeline-body" id="id-{{ page.id }}">
  141. <h3 class="revision-path"><a href="{{ page.path }}">{{ page.path }}</a></h3>
  142. <div class="revision-body wiki"></div>
  143. <script type="text/template">{{ page.revision.body }}</script>
  144. </div>
  145. <hr>
  146. {% endfor %}
  147. </div>
  148. </div>
  149. <script type="text/javascript">
  150. $(function(){
  151. $('#view-list .page-list-link').each(function() {
  152. var $link = $(this);
  153. var text = $link.text();
  154. var path = $link.data('path');
  155. var shortPath = $link.data('short-path');
  156. $link.html(path.replace(shortPath, '<strong>' + shortPath + '</strong>'));
  157. });
  158. $('#view-timeline .timeline-body').each(function()
  159. {
  160. var id = $(this).attr('id');
  161. var contentId = '#' + id + ' > script';
  162. var revisionBody = '#' + id + ' .revision-body';
  163. var revisionPath = '#' + id + ' .revision-path';
  164. var renderer = new Crowi.renderer($(contentId).html(), $(revisionBody));
  165. renderer.render();
  166. });
  167. //$('.tooltip .tabs').tabs();
  168. });
  169. </script>
  170. </div> {# /.content-main #}
  171. {% block content_main_after %}
  172. {% endblock %}
  173. {% endblock %}
  174. {% block content_footer %}
  175. <footer>
  176. </footer>
  177. {% endblock %}
  178. {% block side_header %}
  179. {% if not page %}
  180. <div class="portal-side">
  181. <div class="portal-form-button">
  182. <button class="btn btn-primary" id="create-portal-button">Create Portal</button>
  183. <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>
  184. </div>
  185. </div>
  186. {% else %}
  187. {% include 'widget/page_side_header.html' %}
  188. {% endif %}
  189. {% endblock %} {# side_header #}
  190. {% include 'modal/widget_what_is_portal.html' %}