layout.html.twig 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. {# layout.html.twig #}
  2. {# Sample base layout to show how to alter the twig in order to have sidebar nav #}
  3. <!doctype html>
  4. <html>
  5. <head>
  6. <meta charset="utf-8">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  8. <meta name="viewport" content="width=device-width, initial-scale=1">
  9. <title>{% block pPageTitle %}{{ 'Page:DefaultTitle'|dict_s }}{% endblock %}</title>
  10. {% block pPageStylesheets %}
  11. <link href="{{ app['combodo.portal.base.absolute_url'] }}lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  12. <link href="{{ app['combodo.portal.instance.conf'].properties.themes.bootstrap }}" rel="stylesheet">
  13. <link href="{{ app['combodo.portal.instance.conf'].properties.themes.portal }}" rel="stylesheet">
  14. {% if app['combodo.portal.instance.conf'].properties.themes.custom is defined %}
  15. <link href="{{ app['combodo.portal.instance.conf'].properties.themes.custom }}" rel="stylesheet">
  16. {% endif %}
  17. {% endblock %}
  18. {% block pPageScripts %}
  19. <script type="text/javascript" src="{{ app['combodo.portal.base.absolute_url'] }}lib/jquery/jquery-1.11.3.min.js"></script>
  20. <script type="text/javascript" src="{{ app['combodo.portal.base.absolute_url'] }}lib/bootstrap/js/bootstrap.min.js"></script>
  21. {% endblock %}
  22. </head>
  23. <body class="{% block pPageBodyClass %}{% endblock %}">
  24. {% block pPageBodyWrapper %}
  25. <nav class="navbar navbar-fixed-top navbar-inverse visible-xs" role="navigation">
  26. <div class="container">
  27. <div class="navbar-header">
  28. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
  29. <span class="icon-bar"></span>
  30. <span class="icon-bar"></span>
  31. <span class="icon-bar"></span>
  32. </button>
  33. <a class="navbar-brand" href="{{ app.url_generator.generate('p_home') }}">iTop</a>
  34. </div>
  35. <div class="collapse navbar-collapse" id="navbar">
  36. <ul class="nav navbar-nav">
  37. {% for brick in app['combodo.portal.instance.conf'].bricks %}
  38. {% if brick.GetActive and brick.GetVisibleNavigationMenu and brick.GetRouteName is not null %}
  39. <li {% if oBrick is defined and brick.id == oBrick.id %}class="active"{% endif %}>
  40. <a href="{{ app.url_generator.generate(brick.GetRouteName, {sBrickId: brick.GetId}) }}{% if app['combodo.portal.instance.routes'][brick.GetRouteName]['hash'] is defined %}#{{ app['combodo.portal.instance.routes'][brick.GetRouteName]['hash'] }}{% endif %}" {% if app['combodo.portal.instance.routes'][brick.GetRouteName]['navigation_menu_attr'] is defined %}{% for key, value in app['combodo.portal.instance.routes'][brick.GetRouteName]['navigation_menu_attr'] %} {{ key }}="{{ value }}"{% endfor %}{% endif %}>
  41. {{ brick.GetTitle|dict_s }}
  42. </a>
  43. </li>
  44. {% endif %}
  45. {% endfor %}
  46. <li class="visible-sm">
  47. <a class="navbar-search" data-toggle="collapse" data-target="#searchbar">
  48. <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
  49. </a>
  50. </li>
  51. </ul>
  52. </div>
  53. </div><!-- /.container -->
  54. </nav>
  55. <div class="container-fluid">
  56. <div class="row">
  57. {% block pNavigationWrapper %}
  58. <div class="col-sm-3 col-md-2 sidebar">
  59. <ul class="nav nav-sidebar navbar navbar-default">
  60. <li>
  61. <a href="{{ app.url_generator.generate('p_home') }}">iTop</a>
  62. </li>
  63. {% for brick in app['combodo.portal.instance.conf'].bricks %}
  64. {% if brick.GetActive and brick.GetVisibleNavigationMenu and brick.GetRouteName is not null %}
  65. <li {% if oBrick is defined and brick.id == oBrick.id %}class="active"{% endif %}>
  66. <a href="{{ app.url_generator.generate(brick.GetRouteName, {sBrickId: brick.GetId}) }}{% if app['combodo.portal.instance.routes'][brick.GetRouteName]['hash'] is defined %}#{{ app['combodo.portal.instance.routes'][brick.GetRouteName]['hash'] }}{% endif %}" {% if app['combodo.portal.instance.routes'][brick.GetRouteName]['navigation_menu_attr'] is defined %}{% for key, value in app['combodo.portal.instance.routes'][brick.GetRouteName]['navigation_menu_attr'] %} {{ key }}="{{ value }}"{% endfor %}{% endif %}>
  67. {{ brick.GetTitle|dict_s }}
  68. </a>
  69. </li>
  70. {% endif %}
  71. {% endfor %}
  72. </ul>
  73. </div>
  74. {% endblock %}
  75. {% block pMainWrapper %}
  76. <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2" id="main-wrapper">
  77. <section class="row row-eq-height-sm" id="main-header">
  78. {% block pMainHeader %}
  79. {% endblock %}
  80. </section>
  81. <section class="row row-eq-height-sm" id="main-content">
  82. {% block pMainContent %}
  83. {% endblock %}
  84. </section>
  85. </div>
  86. {% endblock %}
  87. </div>
  88. <footer id="footer-wrapper">
  89. {% block pPageFooter%}
  90. <a href="http://www.combodo.com">iTop &copy; {{ "now"|date('Y') }}</a>
  91. {% endblock %}
  92. </footer>
  93. </div>
  94. <div class="modal fade" id="modal-for-all" role="dialog">
  95. <div class="modal-dialog" role="document">
  96. <div class="modal-content">
  97. </div>
  98. </div>
  99. </div>
  100. {% endblock %}
  101. {% block pPageLiveScripts %}
  102. <script type="text/javascript">
  103. // Hack to enable a same modal to load content from different urls
  104. $('body').on('hidden.bs.modal', '.modal', function () {
  105. $(this).removeData('bs.modal');
  106. $(this).find('.modal-content').html('<div class="modal-body modal-wait">{{ 'Page:PleaseWait'|dict_s }}</div>');
  107. });
  108. /* Will not be used if we go with html response from ajax
  109. var prepareModal = function(modal, data, open)
  110. {
  111. if(open === undefined)
  112. {
  113. open = true;
  114. }
  115. // Filling the whole modal with data if it's a string (It should be HTML)
  116. if((typeof data) === 'string')
  117. {
  118. $(modal).html(data);
  119. }
  120. // Parsing object if necessary
  121. else if((typeof data) === 'object')
  122. {
  123. // - Title
  124. if(data.title !== undefined)
  125. {
  126. parseDataForModalPart(modal, '.modal-header .modal-title', data.title);
  127. }
  128. // - Body
  129. if(data.body !== undefined)
  130. {
  131. parseDataForModalPart(modal, '.modal-body', data.body);
  132. }
  133. // - Footer
  134. if(data.footer !== undefined)
  135. {
  136. parseDataForModalPart(modal, '.modal-footer', data.footer);
  137. }
  138. }
  139. if(open === true)
  140. {
  141. $(modal).fadeIn();
  142. }
  143. };
  144. // Used by prepareModal function to build a specific area from data
  145. var parseDataForModalPart = function(modal, partSelector, data)
  146. {
  147. if((typeof data === 'string'))
  148. {
  149. $(modal).find(partSelector).text(data);
  150. }
  151. else if((typeof data) === 'object')
  152. {
  153. if(data.format === 'html')
  154. {
  155. $(modal).find(partSelector).html(data.data);
  156. }
  157. else if(data.format === 'object')
  158. {
  159. console.log('TODO : Build modal '+partSelector+' from data');
  160. }
  161. else
  162. {
  163. $(modal).find(partSelector).text(data.data);
  164. }
  165. }
  166. };*/
  167. </script>
  168. {% endblock %}
  169. </body>
  170. </html>