page.html 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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. {# raw text #}
  94. <div class="tab-pane" id="raw-text">
  95. <pre id="">{{ revision.body }}</pre>
  96. </div>
  97. {# edit form #}
  98. <div class="edit-form tab-pane {% if req.body.pageForm %}active{% endif %}" id="edit-form">
  99. {% include '_form.html' %}
  100. </div>
  101. {# raw revision history #}
  102. <div class="tab-pane revision-history" id="revision-history">
  103. <h1><i class="fa fa-history"></i> History</h1>
  104. {% if not page %}
  105. {% else %}
  106. <div class="revision-history-list">
  107. {% for t in tree %}
  108. <div class="revision-hisory-outer">
  109. <img src="{{ t.author|picture }}" class="picture picture-rounded">
  110. <div class="revision-history-main">
  111. <div class="revision-history-author">
  112. <strong>{% if t.author %}{{ t.author.username }}{% else %}-{% endif %}</strong>
  113. </div>
  114. <div class="revision-history-comment">
  115. </div>
  116. <div class="revision-history-meta">
  117. {{ t.createdAt|datetz('Y-m-d H:i:s') }}
  118. <br>
  119. <a href="?revision={{ t._id.toString() }}"><i class="fa fa-history"></i> このバージョンを見る</a>
  120. </div>
  121. </div>
  122. </div>
  123. {% endfor %}
  124. </div>
  125. {% endif %}
  126. </div>
  127. </div>
  128. <script type="text/javascript">
  129. $(function(){
  130. var renderer = new Crowi.renderer($('#raw-text-original').html());
  131. renderer.render();
  132. Crowi.correctHeaders('#revision-body-content');
  133. Crowi.revisionToc('#revision-body-content', '#revision-toc');
  134. $('#edit-form').submit(function()
  135. {
  136. //console.log('save');
  137. //return false;
  138. });
  139. //data-spy="affix" data-offset-top="80"
  140. var headerHeight = $('#page-header').outerHeight(true);
  141. $('.header-wrap').css({height: headerHeight + 'px'});
  142. $('#page-header').affix({
  143. offset: {
  144. top: function() {
  145. return headerHeight + 74; // (54 header + 20 padding-top)
  146. }
  147. }
  148. });
  149. $('[data-affix-disable]').on('click', function(e) {
  150. $elm = $($(this).data('affix-disable'));
  151. $(window).off('.affix');
  152. $elm.removeData('affix').removeClass('affix affix-top affix-bottom');
  153. return false;
  154. });
  155. });
  156. </script>
  157. {% endif %}
  158. </div>
  159. {% block content_main_after %}
  160. {% endblock %}
  161. {% endblock %}
  162. {% block content_footer %}
  163. <div class="page-attachments meta">
  164. <p>Attachments</p>
  165. <ul>
  166. </ul>
  167. </div>
  168. <p class="meta">
  169. Path: <span id="pagePath">{{ page.path }}</span><br />
  170. 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) }}
  171. </p>
  172. {% endblock %}
  173. {% block side_header %}
  174. {% include 'widget/page_side_header.html' %}
  175. {% endblock %} {# side_header #}
  176. {% block side_content %}
  177. {% include 'widget/page_side_content.html' %}
  178. {% endblock %}
  179. {% block footer %}
  180. <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>
  181. <div id="notifPageEditing" class="fk-hide fk-notif fk-notif-warning"><i class="fa fa-exclamation-triangle"></i> 他の人がこのページの編集を開始しました。</div>
  182. <script>
  183. $(function() {
  184. var me = {{ user|json|safe }};
  185. var socket = io();
  186. socket.on('page edited', function (data) {
  187. if (data.user._id != me._id
  188. && data.page.path == {{ page.path|json|safe }}) {
  189. $('#notifPageEdited').removeClass('fk-hide').css({bottom: 0});
  190. $('#notifPageEdited .edited-user').html(data.user.name);
  191. }
  192. });
  193. });
  194. </script>
  195. {% endblock %}
  196. {% block body_end %}
  197. {% parent %}
  198. <div id="presentation-layer" class="fullscreen-layer">
  199. <div id="presentation-container"></div>
  200. </div>
  201. <script>
  202. $(function() {
  203. var presentaionInitialized = false
  204. , $b = $('body');
  205. $(document).on('click', '.toggle-presentation', function(e) {
  206. var $a = $(this);
  207. e.preventDefault();
  208. $b.toggleClass('overlay-on');
  209. if (!presentaionInitialized) {
  210. presentaionInitialized = true;
  211. $('<iframe />').attr({
  212. src: $a.attr('href')
  213. }).appendTo($('#presentation-container'));
  214. }
  215. }).on('click', '.fullscreen-layer', function() {
  216. $b.toggleClass('overlay-on');
  217. });
  218. });
  219. </script>
  220. {% endblock %}