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