1
0

edit.html 2.3 KB

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