page.html 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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 id="page-header">
  8. <p class="stopper"><a href="#" data-affix-disable="#page-header"><i class="fa fa-chevron-up"></i></a></p>
  9. {% if page %}
  10. <a href="#" title="Bookmark" class="bookmark-link" id="bookmark-button" data-bookmarked="0"><i class="fa fa-star-o"></i></a>
  11. {% endif %}
  12. <h1 class="title" id="revision-path">{{ path|insertSpaceToEachSlashes }}</h1>
  13. </header>
  14. </div>
  15. {% block content_head_after %}
  16. {% endblock %}
  17. {% endblock %}
  18. {% block content_main %}
  19. {% block content_main_before %}
  20. {% endblock %}
  21. <div id="content-main" class="content-main {% if not page or req.body.pageForm %}on-edit{% endif %}"
  22. data-path="{{ path }}"
  23. data-path-shortname="{{ path|path2name }}"
  24. data-page-id="{% if page %}{{ page._id.toString() }}{% endif %}"
  25. data-current-user="{% if user %}{{ user._id.toString() }}{% endif %}"
  26. data-page-revision-id="{% if revision %}{{ revision._id.toString() }}{% endif %}"
  27. data-page-revision-created="{% if revision %}{{ revision.createdAt|datetz('U') }}{% endif %}"
  28. data-page-is-seen="{% if page and page.isSeenUser(user) %}1{% else %}0{% endif %}"
  29. >
  30. {% if not page %}
  31. <ul class="nav nav-tabs hidden-print">
  32. <li><a>Create: {{ path }}</a></li>
  33. <li class="dropdown pull-right">
  34. <a href="/"><i class="fa fa-times"></i> キャンセル</a>
  35. </li>
  36. </ul>
  37. <div class="tab-content">
  38. <div class="edit-form">
  39. {% include '_form.html' %}
  40. </div>
  41. </div>
  42. {% else %}
  43. <ul class="nav nav-tabs hidden-print">
  44. <li class=" {% if not req.body.pageForm %}active{% endif %}" data-toggle="tooltip" {# data-title="あなたの 確認待ち です" title="" data-placement="bottom" data-trigger="manual" data-tooltip-stay #}>
  45. <a href="#revision-body" data-toggle="tab">
  46. <i class="fa fa-magic"></i>
  47. {#
  48. <img src="//graph.facebook.com/588883490/picture?size=square" width="16"> <i class="fa fa-arrow-right"></i> <img src="//graph.facebook.com/588883490/picture?size=square" width="16">
  49. <span class="label label-danger" style=""> 承認待ち</span>
  50. #}
  51. </a>
  52. </li>
  53. <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>
  54. <li class="dropdown pull-right">
  55. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  56. <i class="fa fa-wrench"></i> <span class="caret"></span>
  57. </a>
  58. <ul class="dropdown-menu">
  59. <li><a href="#" data-target="#renamePage" data-toggle="modal"><i class="fa fa-share"></i> 移動</a></li>
  60. <li><a href="?presentation=1" class="toggle-presentation"><i class="fa fa-arrows-alt"></i> プレゼンモード (beta)</a></li>
  61. </ul>
  62. </li>
  63. {% if page %}
  64. <li class="pull-right"><a href="#revision-history" data-toggle="tab"><i class="fa fa-history"></i> History</a></li>
  65. {% endif %}
  66. </ul>
  67. {% include 'modal/widget_rename.html' %}
  68. <div class="tab-content wiki-content">
  69. {% if req.query.renamed %}
  70. <div class="alert alert-info">
  71. <strong>移動しました: </strong> このページは <code>{{ req.query.renamed }}</code> から移動しました。
  72. </div>
  73. {% endif %}
  74. {% if not page.isLatestRevision() %}
  75. <div class="alert alert-warning">
  76. <strong>注意: </strong> これは現在の版ではありません。
  77. </div>
  78. {% endif %}
  79. {#
  80. <div class="panel panel-default">
  81. <div class="panel-heading">承認待ち</div>
  82. <div class="panel-body">
  83. ほげほげ
  84. </div>
  85. </div>
  86. #}
  87. <script type="text/template" id="raw-text-original">{{ revision.body }}</script>
  88. {# formatted text #}
  89. <div class="tab-pane {% if not req.body.pageForm %}active{% endif %}" id="revision-body">
  90. <div class="revision-toc" id="revision-toc">
  91. <a data-toggle="collapse" data-parent="#revision-toc" href="#revision-toc-content" class="revision-toc-head collapsed">目次</a>
  92. </div>
  93. <div class="wiki {{ revision.format }}" id="revision-body-content"></div>
  94. </div>
  95. {# edit form #}
  96. <div class="edit-form tab-pane {% if req.body.pageForm %}active{% endif %}" id="edit-form">
  97. {% include '_form.html' %}
  98. </div>
  99. {# raw revision history #}
  100. <div class="tab-pane revision-history" id="revision-history">
  101. <h1><i class="fa fa-history"></i> History</h1>
  102. {% if not page %}
  103. {% else %}
  104. <div class="revision-history-list">
  105. {% for t in tree %}
  106. <div class="revision-hisory-outer">
  107. <img src="{{ t.author|picture }}" class="picture picture-rounded">
  108. <div class="revision-history-main">
  109. <div class="revision-history-author">
  110. <strong>{% if t.author %}{{ t.author.username }}{% else %}-{% endif %}</strong>
  111. </div>
  112. <div class="revision-history-comment">
  113. </div>
  114. <div class="revision-history-meta">
  115. {{ t.createdAt|datetz('Y-m-d H:i:s') }}
  116. <br>
  117. <a href="?revision={{ t._id.toString() }}"><i class="fa fa-history"></i> このバージョンを見る</a>
  118. </div>
  119. </div>
  120. </div>
  121. {% endfor %}
  122. </div>
  123. {% endif %}
  124. </div>
  125. </div>
  126. <script type="text/javascript">
  127. $(function(){
  128. var renderer = new Crowi.renderer($('#raw-text-original').html());
  129. renderer.render();
  130. Crowi.correctHeaders('#revision-body-content');
  131. Crowi.revisionToc('#revision-body-content', '#revision-toc');
  132. $('#edit-form').submit(function()
  133. {
  134. //console.log('save');
  135. //return false;
  136. });
  137. //data-spy="affix" data-offset-top="80"
  138. var headerHeight = $('#page-header').outerHeight(true);
  139. $('.header-wrap').css({height: headerHeight + 'px'});
  140. $('#page-header').affix({
  141. offset: {
  142. top: function() {
  143. return headerHeight + 74; // (54 header + 20 padding-top)
  144. }
  145. }
  146. });
  147. $('[data-affix-disable]').on('click', function(e) {
  148. $elm = $($(this).data('affix-disable'));
  149. $(window).off('.affix');
  150. $elm.removeData('affix').removeClass('affix affix-top affix-bottom');
  151. return false;
  152. });
  153. });
  154. </script>
  155. {% endif %}
  156. </div>
  157. {% block content_main_after %}
  158. {% endblock %}
  159. {% endblock %}
  160. {% block content_footer %}
  161. <div class="page-attachments meta">
  162. <p>Attachments</p>
  163. <ul>
  164. </ul>
  165. </div>
  166. <p class="meta">
  167. Path: <span id="pagePath">{{ page.path }}</span><br>
  168. Last updated at {{ page.revision.createdAt|datetz('Y-m-d H:i:s') }} by <img src="{{ page.revision.author|picture }}" class="picture picture-rounded"> {{ page.revision.author.name }}<br>
  169. Created at {{ page.createdAt|datetz('Y-m-d H:i:s') }} by <img src="{{ page.creator|default(page.creator)|picture }}" class="picture picture-rounded"> {{ page.creator.name }}<br>
  170. </p>
  171. {% endblock %}
  172. {% block side_header %}
  173. {% include 'widget/page_side_header.html' %}
  174. {% endblock %} {# side_header #}
  175. {% block side_content %}
  176. {% include 'widget/page_side_content.html' %}
  177. {% endblock %}
  178. {% block footer %}
  179. <div id="notifPageEdited" class="fk-hide fk-notif fk-notif-danger"><i class="fa fa-exclamation-triangle"></i> <span class="edited-user"></span>さんがこのページを編集しました。 <a href="javascript:location.reload();"><i class="fa fa-angle-double-right"></i> 最新版を読み込む</a></div>
  180. <div id="notifPageEditing" class="fk-hide fk-notif fk-notif-warning"><i class="fa fa-exclamation-triangle"></i> 他の人がこのページの編集を開始しました。</div>
  181. <script>
  182. $(function() {
  183. var me = {{ user|json|safe }};
  184. var socket = io();
  185. socket.on('page edited', function (data) {
  186. if (data.user._id != me._id
  187. && data.page.path == {{ page.path|json|safe }}) {
  188. $('#notifPageEdited').removeClass('fk-hide').css({bottom: 0});
  189. $('#notifPageEdited .edited-user').html(data.user.name);
  190. }
  191. });
  192. });
  193. </script>
  194. {% endblock %}
  195. {% block body_end %}
  196. {% parent %}
  197. <div id="presentation-layer" class="fullscreen-layer">
  198. <div id="presentation-container"></div>
  199. </div>
  200. <script>
  201. $(function() {
  202. var presentaionInitialized = false
  203. , $b = $('body');
  204. $(document).on('click', '.toggle-presentation', function(e) {
  205. var $a = $(this);
  206. e.preventDefault();
  207. $b.toggleClass('overlay-on');
  208. if (!presentaionInitialized) {
  209. presentaionInitialized = true;
  210. $('<iframe />').attr({
  211. src: $a.attr('href')
  212. }).appendTo($('#presentation-container'));
  213. }
  214. }).on('click', '.fullscreen-layer', function() {
  215. $b.toggleClass('overlay-on');
  216. });
  217. });
  218. </script>
  219. {% endblock %}