page_list.html 10 KB

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