page_list.html 5.4 KB

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