list.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. {% extends "portal/layout.html" %}
  2. {% block content %}
  3. <div class="form-inline" role="form">
  4. <div class="form-group">
  5. <input type="text" value="{{ data.query }}" class="form-control" id="query"
  6. placeholder="search name" onkeydown="if(event.keyCode==13)query_template()">
  7. </div>
  8. <button type="button" onclick="query_template();" class="btn btn-default">
  9. <span class="glyphicon glyphicon-search"></span>
  10. </button>
  11. <input type="checkbox" name="mine" id="mine" {% if data.mine == '1' %}checked="checked"{% endif %}>
  12. <span>mine</span>
  13. <div class="pull-right">
  14. <input type="text" placeholder="input name to create" class="form-control" id="tpl_name"
  15. onkeydown="if(event.keyCode==13)create_template()">
  16. <button onclick="create_template()" class="btn btn-default">
  17. <span class="glyphicon glyphicon-plus"></span>
  18. </button>
  19. </div>
  20. </div>
  21. <table class="table table-hover table-bordered table-striped" style="margin-bottom: 0px; margin-top: 10px;">
  22. <thead>
  23. <tr>
  24. <th>name</th>
  25. <th>parent</th>
  26. <th>creator</th>
  27. <th>operation</th>
  28. </tr>
  29. </thead>
  30. <tbody>
  31. {% for v in data.vs %}
  32. <tr>
  33. <td><a href="{{ url_for('template_view_get', tpl_id=v.id) }}">{{ v.tpl_name }}</a></td>
  34. <td>{% if v.parent %}<a href="{{ url_for('template_view_get', tpl_id=v.parent.id) }}">{{ v.parent.tpl_name }}</a>{% endif %}</td>
  35. <td>
  36. <a href="/user/about/{{ v.create_user }}">{{ v.create_user }}</a>
  37. </td>
  38. <td>
  39. <a data-toggle="tooltip" data-placement="top" title="克隆一份该模板" href="javascript:fork_template('{{ v.id }}');" style="text-decoration: none;">
  40. <span class="glyphicon glyphicon-duplicate orange"></span>
  41. </a>
  42. {% if v.writable(g.user) %}
  43. <span class="cut-line">¦</span>
  44. <a data-toggle="tooltip" data-placement="top" title="查看绑定了哪些HostGroup" href="{{ url_for('template_binds_get', tpl_id=v.id) }}"
  45. style="text-decoration: none;">
  46. <span class="glyphicon glyphicon-list-alt orange"></span>
  47. </a>
  48. <span class="cut-line">¦</span>
  49. <a data-toggle="tooltip" data-placement="top" title="修改" href="{{ url_for('template_update_get', tpl_id=v.id) }}"
  50. style="text-decoration: none;">
  51. <span class="glyphicon glyphicon-edit orange"></span>
  52. </a>
  53. <span class="cut-line">¦</span>
  54. <a data-toggle="tooltip" data-placement="top" title="删除" href="javascript:delete_template('{{ v.id }}');"
  55. style="text-decoration: none;">
  56. <span class="glyphicon glyphicon-trash orange"></span>
  57. </a>
  58. {% endif %}
  59. </td>
  60. </tr>
  61. {% else %}
  62. <tr>
  63. <td colspan="4">no records</td>
  64. </tr>
  65. {% endfor %}
  66. </tbody>
  67. </table>
  68. <div class="pull-right" style="margin-top: 20px;">
  69. <a href="{{ url_for('template_help_get') }}" class="btn btn-default">
  70. <span class="glyphicon glyphicon-question-sign"></span>
  71. </a>
  72. </div>
  73. {% import "portal/blocks.html" as blocks %}
  74. {{ blocks.pager('/portal/template?q='+data.query+'&mine='+data.mine, data.total, data.limit, data.page) }}
  75. <script>
  76. $(function () {
  77. $("#query").focus();
  78. $("#mine").click(query_template);
  79. $('[data-toggle="tooltip"]').tooltip();
  80. });
  81. </script>
  82. {% endblock %}