getone.mak 9.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <%inherit file="local:templates.master_authenticated_left_treeview_right_toolbar"/>
  2. <%namespace name="TIM" file="tracim.templates.pod"/>
  3. <%namespace name="TOOLBAR" file="tracim.templates.folder.toolbar"/>
  4. <%namespace name="FORMS" file="tracim.templates.user_workspace_forms"/>
  5. <%namespace name="WIDGETS" file="tracim.templates.user_workspace_widgets"/>
  6. <%namespace name="BUTTON" file="tracim.templates.widgets.button"/>
  7. <%namespace name="TABLE_ROW" file="tracim.templates.widgets.table_row"/>
  8. <%namespace name="ICON" file="tracim.templates.widgets.icon"/>
  9. <%namespace name="P" file="tracim.templates.widgets.paragraph"/>
  10. <%namespace name="UI" file="tracim.templates.widgets.ui"/>
  11. <%def name="title()">${result.folder.label}</%def>
  12. <%def name="SIDEBAR_LEFT_CONTENT()">
  13. <h4>${_('Workspaces')}</h4>
  14. ${WIDGETS.TREEVIEW('sidebar-left-menu', 'workspace_{}__item_{}'.format(result.folder.workspace.id, result.folder.id))}
  15. </%def>
  16. <%def name="SIDEBAR_RIGHT_CONTENT()">
  17. ${TOOLBAR.SECURED_FOLDER(fake_api.current_user, result.folder.workspace, result.folder)}
  18. </%def>
  19. <%def name="REQUIRED_DIALOGS()">
  20. ${TIM.HELP_MODAL_DIALOG('content-wiki-page-definition')}
  21. ${TIM.MODAL_DIALOG('folder-edit-modal-dialog')}
  22. ${TIM.MODAL_DIALOG('folder-move-modal-dialog')}
  23. ${TIM.MODAL_DIALOG('folder-new-modal-dialog')}
  24. ${TIM.MODAL_DIALOG('file-new-modal-dialog')}
  25. ${TIM.MODAL_DIALOG('page-new-modal-dialog')}
  26. ${TIM.MODAL_DIALOG('thread-new-modal-dialog')}
  27. ## TODO-DYNAMIC-CONTENT-HERE
  28. </%def>
  29. ############################################################################
  30. ##
  31. ## PAGE CONTENT BELOW
  32. ##
  33. ############################################################################
  34. <div class="folder-container ${'not-editable' if not result.folder.is_editable else ''} ${'archived' if result.folder.is_archived else ''} ${'deleted' if result.folder.is_deleted else ''}">
  35. <!--# TODO BS 20161213: Indent content-->
  36. <div class="row t-page-header-row">
  37. <div class="col-sm-7 col-sm-offset-3 main">
  38. <h1 class="page-header t-folder-color-border">
  39. <i class="fa fa-fw fa-lg fa-folder-open tracim-less-visible" style="color: #CCCC00"></i>
  40. ${result.folder.label}
  41. </h1>
  42. <div style="margin: -1.5em auto -1.5em auto;" class="tracim-less-visible">
  43. <% created_localized = h.get_with_timezone(result.folder.created) %>
  44. <p>${_('folder created on {date} at {time} by <b>{author}</b>').format(date=h.date(created_localized), time=h.time(created_localized), author=result.folder.owner.name)|n}</p>
  45. </div>
  46. </div>
  47. </div>
  48. % if (result.folder.is_archived) :
  49. <div class="row alert alert-info" role="alert">
  50. <div class="col-sm-7 col-sm-offset-3">
  51. <p>
  52. <span class="pull-left"><i class="fa fa-fw fa-2x fa-warning" alt="" title=""></i></span>
  53. ${_('Vous consultez <b>une version archivée</b> de la page courante.')|n}
  54. </p>
  55. </div>
  56. </div>
  57. % elif (result.folder.is_deleted) :
  58. <div class="row alert alert-info" role="alert">
  59. <div class="col-sm-7 col-sm-offset-3">
  60. <p>
  61. <span class="pull-left"><i class="fa fa-fw fa-2x fa-warning" alt="" title=""></i></span>
  62. ${_('Vous consultez <b>une version supprimée</b> de la page courante.')|n}
  63. </p>
  64. </div>
  65. </div>
  66. % endif
  67. <div class="row">
  68. <div class="col-sm-7 col-sm-offset-3">
  69. <% user_role = h.user_role(fake_api.current_user, result.folder.workspace) %>
  70. <div class="t-spacer-above">
  71. % if user_role > 1:
  72. <div class="btn-group" role="group">
  73. % if (not result.folder.is_archived and not result.folder.is_deleted) :
  74. <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
  75. <i class="fa fa-plus"></i> ${_('New ...')}
  76. <span class="caret"></span>
  77. </button>
  78. % endif
  79. <ul class="dropdown-menu" role="menu">
  80. % for content_type in result.folder.allowed_content_types:
  81. % if content_type.id != 'folder' or user_role > 2:
  82. ## Only show 'new folder' to content managers
  83. <%
  84. new_form_content_url = tg.url('/workspaces/{}/folders/{}/{}s/new'.format(result.folder.workspace.id, result.folder.id, content_type.id), params={'workspace_id': result.folder.workspace.id, 'parent_id': result.folder.id})
  85. modal_dialog_id = '{content_type}-new-modal-dialog'.format(content_type=content_type.id)
  86. icon_classes = content_type.icon+' '+content_type.color
  87. %>
  88. <li>${BUTTON.DATA_TARGET_AS_TEXT_AND_ICON_MODAL_WITH_REMOTE_CONTENT(modal_dialog_id, content_type.label, new_form_content_url, icon_classes)}</li>
  89. % endif
  90. % endfor
  91. </ul>
  92. </div>
  93. % endif
  94. % if len(fake_api.sub_items) > 0:
  95. ## INFO - D.A. - 2015-05-25
  96. ## We hide filtering/search buttons if no content yet.
  97. ## This make the interface more easy to use
  98. <div class="btn-group" role="group" aria-label="...">
  99. ${BUTTON.TEXT('', 'btn btn-default disabled', _('hide...'))}
  100. % for content_type in result.folder.allowed_content_types:
  101. ${BUTTON.TEXT('toggle-{type}-visibility'.format(type=content_type.id), 'btn btn-default t-active-color disabled-has-priority', content_type.label)}
  102. % endfor
  103. </div>
  104. <div class="btn-group pull-right" role="group" aria-label="...">
  105. <input id="filtering" type="text" class="form-control t-bg-grey" placeholder="${_('search...')}" aria-describedby="basic-addon1">
  106. </div>
  107. % endif
  108. </div>
  109. <div class="t-spacer-above">
  110. % if user_role > 1:
  111. ## TODO - D.A. - 2015-05-25 - Remove this part of code which becomes useless
  112. % if result.folder.allowed_content.page:
  113. ${FORMS.NEW_PAGE_FORM('page-new', result.folder.workspace.id, result.folder.id)}
  114. % endif
  115. % if result.folder.allowed_content.thread:
  116. ${FORMS.NEW_THREAD_FORM('thread-new', result.folder.workspace.id, result.folder.id)}
  117. % endif
  118. % if result.folder.allowed_content.file:
  119. ## FIXME${FORMS.NEW_FILE_FORM('file-new', result.folder.workspace.id, result.folder.id)}
  120. ## FIXME${FORMS.NEW_FILE_FORM('file-new', result.folder.workspace.id, result.folder.id)}
  121. % endif
  122. % if user_role > 2 and result.folder.allowed_content.folder:
  123. ## FIXME${FORMS.NEW_FOLDER_FORM('folder-new', result.folder.workspace.id, result.folder.id)}
  124. % endif
  125. % endif
  126. ${UI.GENERIC_DISPLAY_VIEW_BUTTONS_CONTAINER(tg.url('/workspaces/{}/folders/{}'.format(result.folder.workspace.id, result.folder.id)))}
  127. % if len(fake_api.sub_items) <= 0:
  128. ${P.EMPTY_CONTENT(_('This folder has not yet content.'))}
  129. % else:
  130. <table class="table table-striped table-hover tablesorter folder__content__list" id="current-folder-content-list">
  131. <thead>
  132. <tr>
  133. <th>${_('Title')}</th>
  134. <th>${_('Status')}</th>
  135. <th>${_('Notes')}</th>
  136. <th>${_('Type')}</th>
  137. </tr>
  138. </thead>
  139. <tbody>
  140. % for content in fake_api.sub_items:
  141. ${TABLE_ROW.CONTENT(content)}
  142. % endfor
  143. </tbody>
  144. </table>
  145. % endif
  146. </div>
  147. </div>
  148. </div>
  149. <script>
  150. $(document).ready(function() {
  151. $("#current-folder-content-list").DataTable({
  152. sDom: '',
  153. pageLength: -1
  154. });
  155. });
  156. $(document).ready(function() {
  157. $("#toggle-file-visibility").click(function() {
  158. $('.t-table-row-file').toggle();
  159. $('#toggle-file-visibility').toggleClass('t-active-color');
  160. $('#toggle-file-visibility').toggleClass('t-inactive-color');
  161. });
  162. $("#toggle-thread-visibility").click(function() {
  163. $('.t-table-row-thread').toggle();
  164. $('#toggle-thread-visibility').toggleClass('t-active-color');
  165. $('#toggle-thread-visibility').toggleClass('t-inactive-color');
  166. });
  167. $("#toggle-folder-visibility").click(function() {
  168. $('.t-table-row-folder').toggle();
  169. $('#toggle-folder-visibility').toggleClass('t-active-color');
  170. $('#toggle-folder-visibility').toggleClass('t-inactive-color');
  171. });
  172. $("#toggle-page-visibility").click(function() {
  173. $('.t-table-row-page').toggle();
  174. $('#toggle-page-visibility').toggleClass('t-active-color');
  175. $('#toggle-page-visibility').toggleClass('t-inactive-color');
  176. });
  177. });
  178. $(document).ready(function() {
  179. $("#filtering").on('keyup click', function() {
  180. $("#current-folder-content-list").DataTable().search(
  181. $("#filtering").val()
  182. ).draw();
  183. });
  184. });
  185. </script>
  186. </div>