page_list.html 5.9 KB

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