page.html 8.5 KB

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