page_list.html 5.5 KB

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