page_list.html 5.1 KB

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