edit.html 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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="/">首页</a></li>
  9. <li><a href="/team/list">用户组列表</a></li>
  10. <li class="active">修改用户组</li>
  11. </ol>
  12. <div class="panel panel-default">
  13. <div class="panel-heading">
  14. <h3 class="panel-title">Edit Team: {{team.name}}</h3>
  15. </div>
  16. <div class="panel-body">
  17. <div class="form-group">
  18. <label for="resume">简介(方便以后能想起这个组的作用,选填):</label> <input
  19. type="text" id="resume" class="form-control" value="{{team.resume}}"/>
  20. </div>
  21. <div class="form-group">
  22. <label for="users">成员:</label> <input
  23. type="text" id="users" class="form-control" value="{{team_user_ids}}"/>
  24. </div>
  25. <button type="button" class="btn btn-default" onclick="edit_team('{{team.id}}');">
  26. <span class="glyphicon glyphicon-floppy-disk"></span>
  27. 更新
  28. </button>
  29. <a href="/team/list" class="btn btn-default">
  30. <span class="glyphicon glyphicon-arrow-left"></span>
  31. 返回
  32. </a>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. {%endblock%}
  40. {% block more_js%}
  41. {{super()}}
  42. <script type="text/javascript">
  43. $(function() {
  44. $("#users").select2({
  45. placeholder: "输入要添加组员的name",
  46. allowClear: true,
  47. multiple: true,
  48. quietMillis: 100,
  49. minimumInputLength: 1,
  50. id: function(obj){return obj.id;},
  51. initSelection: function(element, callback) {
  52. $.getJSON("/team/{{team.id}}/users", function(json) {
  53. callback(json.users);
  54. });
  55. },
  56. ajax: {
  57. url: "/user/query",
  58. dataType: 'json',
  59. data: function(term, page) {
  60. return {
  61. query: term,
  62. limit: 20
  63. };
  64. },
  65. results: function(json, page) {
  66. return {results: json.users};
  67. }
  68. },
  69. formatResult: function(obj) {return obj.name + "["+obj.cnname+"]" + "["+obj.email+"]"},
  70. formatSelection: function(obj) {return obj.name},
  71. });
  72. });
  73. </script>
  74. {%endblock%}