layout.mako 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. ## Licensed to Cloudera, Inc. under one
  2. ## or more contributor license agreements. See the NOTICE file
  3. ## distributed with this work for additional information
  4. ## regarding copyright ownership. Cloudera, Inc. licenses this file
  5. ## to you under the Apache License, Version 2.0 (the
  6. ## "License"); you may not use this file except in compliance
  7. ## with the License. You may obtain a copy of the License at
  8. ##
  9. ## http://www.apache.org/licenses/LICENSE-2.0
  10. ##
  11. ## Unless required by applicable law or agreed to in writing, software
  12. ## distributed under the License is distributed on an "AS IS" BASIS,
  13. ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ## See the License for the specific language governing permissions and
  15. ## limitations under the License.
  16. ##
  17. ##
  18. ## no spaces in this method please; we're declaring a CSS class, and ART uses this value for stuff, and it splits on spaces, and
  19. ## multiple spaces and line breaks cause issues
  20. <%!
  21. def is_selected(section, matcher):
  22. if section == matcher:
  23. return "active"
  24. else:
  25. return ""
  26. %>
  27. <%def name="render_field(field, show_label=True, extra_attrs={})">
  28. % if not field.is_hidden:
  29. <% group_class = field.errors and "error" or "" %>
  30. <div class="control-group ${group_class}"
  31. rel="popover" data-original-title="${ field.label }" data-content="${ field.help_text }">
  32. % if show_label:
  33. <label class="control-label">${ field.label }</label>
  34. % endif
  35. <div class="controls">
  36. <% field.field.widget.attrs.update(extra_attrs) %>
  37. ${ field | n,unicode }
  38. % if field.errors:
  39. <span class="help-inline">${ field.errors | n,unicode }</span>
  40. % endif
  41. </div>
  42. </div>
  43. %endif
  44. </%def>
  45. <%def name="menubar(section='', _=None)">
  46. <div class="subnav subnav-fixed">
  47. <div class="container-fluid">
  48. <ul class="nav nav-pills">
  49. <li class="${is_selected(section, 'users')}"><a href="/useradmin/users">${_('Users')}</a></li>
  50. <li class="${is_selected(section, 'groups')}"><a href="/useradmin/groups">${_('Groups')}</a></li>
  51. <li class="${is_selected(section, 'permissions')}"><a href="/useradmin/permissions">${_('Permissions')}</a></li>
  52. </ul>
  53. </div>
  54. </div>
  55. </%def>
  56. <%def name="commons()">
  57. <style type="text/css">
  58. .fixed {
  59. position: fixed;
  60. top: 80px;
  61. filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff2f2f2', GradientType=0);
  62. -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
  63. -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
  64. box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
  65. }
  66. .pull-right {
  67. margin: 4px;
  68. }
  69. .sortable {
  70. cursor: pointer;
  71. }
  72. .file-row {
  73. height:37px;
  74. }
  75. </style>
  76. <script type="text/javascript">
  77. $(document).ready(function(){
  78. $("#filterInput").keyup(function(){
  79. var shown = 0;
  80. $(".datatables tfoot").hide();
  81. $.each($(".tableRow"), function(index, value) {
  82. if($(value).data("search").toLowerCase().indexOf($("#filterInput").val().toLowerCase()) == -1 && $("#filterInput").val() != ""){
  83. $(value).hide();
  84. }
  85. else{
  86. $(value).show();
  87. shown++;
  88. }
  89. });
  90. if (shown == 0){
  91. $(".datatables tfoot").show();
  92. }
  93. });
  94. });
  95. </script>
  96. </%def>