create.html 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. {% extends "team/base.html" %}
  2. {% block container_outer %}
  3. <div id="container" class="container-fluid">
  4. <div class="row">
  5. <div class="col-md-12">
  6. <div style="margin: 0 auto; max-width: 400px;">
  7. <ol class="breadcrumb">
  8. <li><a href="/team/list">用户组列表</a></li>
  9. <li class="active">创建用户组</li>
  10. </ol>
  11. <div class="panel panel-default">
  12. <div class="panel-heading">
  13. <h3 class="panel-title">Create Team</h3>
  14. </div>
  15. <div class="panel-body">
  16. <div class="form-group">
  17. <label for="name">名称(a-zA-Z0-9_-.):</label> <input type="text"
  18. id="name" class="form-control" />
  19. </div>
  20. <div class="form-group">
  21. <label for="resume">简介(方便以后能想起这个组的作用,选填):</label> <input
  22. type="text" id="resume" class="form-control" />
  23. </div>
  24. <div class="form-group">
  25. <label for="users">成员:</label> <input
  26. type="text" id="users" class="form-control" />
  27. </div>
  28. <button type="button" class="btn btn-default" onclick="create_team();">
  29. <span class="glyphicon glyphicon-floppy-disk"></span>
  30. 创建
  31. </button>
  32. <a href="/team/list" class="btn btn-default">
  33. <span class="glyphicon glyphicon-arrow-left"></span>
  34. 返回
  35. </a>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. {%endblock%}
  43. {% block more_js%}
  44. {{super()}}
  45. <script type="text/javascript">
  46. $(function() {
  47. $("#users").select2({
  48. placeholder: "输入要添加组员的name",
  49. allowClear: true,
  50. multiple: true,
  51. quietMillis: 100,
  52. minimumInputLength: 1,
  53. id: function(obj){return obj.id;},
  54. ajax: {
  55. url: "/user/query",
  56. dataType: 'json',
  57. data: function(term, page) {
  58. return {
  59. query: term,
  60. limit: 20
  61. };
  62. },
  63. results: function(json, page) {
  64. return {results: json.users};
  65. }
  66. },
  67. formatResult: function(obj) {return obj.name + "["+obj.cnname+"]" + "["+obj.email+"]"},
  68. formatSelection: function(obj) {return obj.name},
  69. });
  70. });
  71. </script>
  72. {%endblock%}