page_list.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. {% extends 'layout/2column.html' %}
  2. {% block html_title %}{{ path|path2name }} · {{ path }}{% endblock %}
  3. {% block html_base_attr %}
  4. data-spy="scroll"
  5. data-target="#search-result-list"
  6. {% endblock %}
  7. {% block content_head %}
  8. {% block content_head_before %}
  9. {% endblock %}
  10. <div class="header-wrap">
  11. <header class="portal-header {% if page %}has-page{% endif %}">
  12. <div class="flex-title-line">
  13. <h1 class="title flex-item-title">
  14. <span id="revision-path">{{ path|insertSpaceToEachSlashes }}</span>
  15. {% if searchConfigured() && !isTopPage() && !isTrashPage() %}
  16. <form class="input-group search-input-group hidden-xs hidden-sm" data-toggle="tooltip" data-placement="bottom" title="{{ path }} 以下から検索" id="search-listpage-form">
  17. <input type="text" class="search-listpage-input form-control" data-path="{{ path }}" id="search-listpage-input">
  18. <span class="input-group-btn search-listpage-submit-group">
  19. <button type="submit" class="btn btn-default" id="search-listpage-submit">
  20. <i class="fa fa-search"></i>
  21. </button>
  22. </span>
  23. <a class="search-listpage-clear" id="search-listpage-clear"><i class="fa fa-times-circle"></i></a>
  24. </form>
  25. {% endif %}
  26. </h1>
  27. {% if page %}
  28. <div class="flex-item-action">
  29. <a href="#" title="Bookmark" class="bookmark-link" id="bookmark-button" data-csrftoken="{{ csrf() }}" data-bookmarked="0"><i class="fa fa-star-o"></i></a>
  30. </div>
  31. <div class="flex-item-action visible-xs visible-sm">
  32. <button
  33. data-csrftoken="{{ csrf() }}"
  34. data-liked="{% if page.isLiked(user) %}1{% else %}0{% endif %}"
  35. class="like-button btn btn-default btn-sm {% if page.isLiked(user) %}active{% endif %}"
  36. ><i class="fa fa-thumbs-o-up"></i></button>
  37. </div>
  38. {% endif %}
  39. </div>
  40. </header>
  41. </div>
  42. {% endblock %}
  43. {% block content_main %}
  44. {% block content_main_before %}
  45. {% endblock %}
  46. {# page-list-search should be fully managed by react.js,
  47. # but now the header and page list content is rendered separately by the server,
  48. # so now bind the values through the hidden fields.
  49. #}
  50. {% if searchConfigured() && !isTopPage() && !isTrashPage() %}
  51. <div id="page-list-search">
  52. </div>
  53. {% endif %}
  54. <div class="page-list content-main {% if req.body.pageForm %}on-edit{% endif %}"
  55. id="content-main"
  56. data-path="{{ path }}"
  57. data-path-shortname="{{ path|path2name }}"
  58. data-page-portal="{% if page and page.isPortal() %}1{% else %}0{% endif %}"
  59. data-page-id="{% if page %}{{ page._id.toString() }}{% endif %}"
  60. data-current-user="{% if user %}{{ user._id.toString() }}{% endif %}"
  61. data-current-username="{% if user %}{{ user.username }}{% endif %}"
  62. data-page-revision-id="{% if revision %}{{ revision._id.toString() }}{% endif %}"
  63. data-page-revision-created="{% if revision %}{{ revision.createdAt|datetz('U') }}{% endif %}"
  64. data-page-is-seen="{% if page and page.isSeenUser(user) %}1{% else %}0{% endif %}"
  65. data-linebreaks-enabled="{{ isEnabledLinebreaks() }}"
  66. >
  67. <div class="portal {% if not page or req.query.offset > 0 %}hide{% endif %}">
  68. <ul class="nav nav-tabs hidden-print">
  69. {# portal tab #}
  70. <li class=" {% if not req.body.pageForm %}active{% endif %}">
  71. {% if page %}
  72. <a href="#revision-body" data-toggle="tab">
  73. <i class="fa fa-magic"></i>
  74. PORTAL
  75. </a>
  76. {% else %}
  77. <a>Create Portal: {{ path }}</a>
  78. {% endif %}
  79. </li>
  80. <li {% if req.body.pageForm %}class="active"{% endif %}><a href="#edit-form" data-toggle="tab"><i class="fa fa-pencil-square-o"></i> {{ t('Edit') }}</a></li>
  81. {% if not page %}
  82. <li class="pull-right close-button">
  83. <a href="#" id="portal-form-close">
  84. <i class="fa fa-times"></i>
  85. </a>
  86. </li>
  87. {% else %}
  88. <li class="dropdown pull-right">
  89. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  90. <i class="fa fa-wrench"></i> <span class="caret"></span>
  91. </a>
  92. <ul class="dropdown-menu">
  93. <li><a href="#" data-target="#unportalize" data-toggle="modal"><i class="fa fa-share"></i> {{ t('Unportalize') }}</a></li>
  94. </ul>
  95. </li>
  96. <li class="pull-right"><a href="#revision-history" data-toggle="tab"><i class="fa fa-history"></i> History</a></li>
  97. {% endif %}
  98. </ul>
  99. <div class="tab-content">
  100. {% if page and not page.isLatestRevision() %}
  101. <div class="alert alert-warning">
  102. <strong>{{ t('Warning') }}: </strong> {{ t('page.notice.version') }} <i class="fa fa-magic"></i> <a href="{{ page.path }}">最新のポータルを表示</a>
  103. </div>
  104. {% endif %}
  105. <div class="tab-pane {% if not req.body.pageForm %}active{% endif %}" id="revision-body">
  106. <div class="wiki" id="revision-body-content">
  107. <i class="fa fa-spinner fa-pulse fa-fw"></i>
  108. </div>
  109. </div>
  110. <script type="text/template" id="raw-text-original">{{ page.revision.body }}</script>
  111. <div class="tab-pane edit-form portal-form {% if req.body.pageForm %}active{% endif %}" id="edit-form">
  112. {% include '_form.html' with {forceGrant: 1} %}
  113. </div>
  114. <div class="tab-pane revision-history" id="revision-history">
  115. <h1><i class="fa fa-history"></i> History</h1>
  116. {% if not page %}
  117. {% else %}
  118. <div class="revision-history-list">
  119. {% for tr in tree %}
  120. <div class="revision-hisory-outer">
  121. <img src="{{ tr.author|picture }}" class="picture picture-rounded">
  122. <div class="revision-history-main">
  123. <div class="revision-history-author">
  124. <strong>{% if tr.author %}{{ tr.author.username }}{% else %}-{% endif %}</strong>
  125. </div>
  126. <div class="revision-history-comment">
  127. </div>
  128. <div class="revision-history-meta">
  129. {{ tr.createdAt|datetz('Y-m-d H:i:s') }}
  130. <br>
  131. <a href="?revision={{ tr._id.toString() }}"><i class="fa fa-history"></i> {{ t('View this version') }}</a>
  132. <a class="diff-view" data-revision-id="{{ tr._id.toString() }}">
  133. <i id="diff-icon-{{ tr._id.toString() }}" class="fa fa-arrow-circle-right"></i> {{ t('View diff') }}
  134. </a>
  135. <div class="" id="diff-display-{{ tr._id.toString()}}" style="display: none"></div>
  136. </div>
  137. </div>
  138. </div>
  139. {% endfor %}
  140. </div>
  141. {% endif %}
  142. </div>
  143. </div>
  144. </div> {# /.portal #}
  145. <div class="page-list-container">
  146. <ul class="nav nav-tabs">
  147. <li class="active"><a href="#view-list" data-toggle="tab">{{ t('List View') }}</a></li>
  148. <li><a href="#view-timeline" data-toggle="tab">{{ t('Timeline View') }}</a></li>
  149. </ul>
  150. <div class="tab-content">
  151. {% if pages.length == 0 %}
  152. {% if isTrashPage() %}
  153. No deleted pages.
  154. {% else %}
  155. There are no pages under <strong>{{ path }}</strong>.
  156. <h3>Next Actions</h3>
  157. <ul>
  158. <li>Create portal page?
  159. <ul>
  160. <li>Great! To create the portal of <strong>{{ path }}</strong>, click "Create Portal" button.</li>
  161. </ul>
  162. </li>
  163. <li>Create the under page directly?
  164. <ul>
  165. <li>Nice. To create the page under <strong>{{ path }}</strong> directly, type the page name on your browser.</li>
  166. </ul>
  167. </li>
  168. </ul>
  169. {% endif %}
  170. {% endif %}
  171. {# list view #}
  172. <div class="active tab-pane fade page-list-container in" id="view-list">
  173. {% include 'widget/page_list.html' with { pages: pages, pager: pager, viewConfig: viewConfig } %}
  174. </div>
  175. {# timeline view #}
  176. <div class="tab-pane" id="view-timeline" data-shown=0>
  177. {% for page in pages %}
  178. <div class="timeline-body" id="id-{{ page.id }}">
  179. <h3 class="revision-path"><a href="{{ page.path }}">{{ page.path }}</a></h3>
  180. <div class="revision-body wiki"></div>
  181. <script type="text/template">{{ page.revision.body }}</script>
  182. </div>
  183. <hr>
  184. {% endfor %}
  185. </div>
  186. </div>
  187. </div>
  188. </div> {# /.content-main #}
  189. {% block content_main_after %}
  190. {% endblock %}
  191. {% endblock %}
  192. {% block content_footer %}
  193. <footer>
  194. </footer>
  195. {% endblock %}
  196. {% block side_header %}
  197. {% if not page and not isUserPageList(path) and !isTrashPage() %}
  198. <div class="portal-side">
  199. <div class="portal-form-button">
  200. <button class="btn btn-primary" id="create-portal-button">Create Portal</button>
  201. <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>
  202. </div>
  203. </div>
  204. {% else %}
  205. {% include 'widget/page_side_header.html' %}
  206. {% endif %}
  207. {% endblock %} {# side_header #}
  208. {% block body_end %}
  209. <div id="crowi-modals">
  210. {% include 'modal/what_is_portal.html' %}
  211. {% include 'modal/unportalize.html' %}
  212. </div>
  213. <div class="modal fade portal-warning-modal" id="portal-warning-modal">
  214. <div class="modal-dialog">
  215. <div class="modal-content">
  216. <div class="modal-header">
  217. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  218. <h4 class="modal-title">ポータルに関するヒント</h4>
  219. </div>
  220. <div class="modal-body alert alert-danger">
  221. <strong>Warning!</strong><br>
  222. <p>既に <strong><a href="{{ path|removeLastSlash }}">{{ path|removeLastSlash }}</a></strong> のページが存在します。</p>
  223. <p>
  224. <a href="{{ path|removeLastSlash }}">{{ path|removeLastSlash }}</a> をポータル化するには、
  225. <a href="{{ path|removeLastSlash }}">{{ path|removeLastSlash }}</a> に移動し、「ページを移動」させてください。<br>
  226. <a href="{{ path|removeLastSlash }}">{{ path|removeLastSlash }}</a> とは別に、このページ(<code>{{ path }}</code>)にポータルを作成する場合、このまま編集を続けて作成してください。
  227. </p>
  228. </div>
  229. </div>
  230. </div>
  231. </div>
  232. {% endblock %} {# body_end #}