Show More
@@ -1,190 +1,191 b'' | |||
|
1 | 1 | ## -*- coding: utf-8 -*- |
|
2 | 2 | <%namespace name="base" file="/base/base.mako"/> |
|
3 | 3 | |
|
4 | 4 | <div class="panel panel-default"> |
|
5 | 5 | <div class="panel-heading"> |
|
6 | 6 | <h3 class="panel-title"> |
|
7 | 7 | <i class="icon-user-group" title="${_('User group')}"></i> |
|
8 | 8 | ${h.link_to_group(c.user_group.users_group_name)} |
|
9 | 9 | - ${_('Settings')} |
|
10 | 10 | </h3> |
|
11 | 11 | </div> |
|
12 | 12 | <div class="panel-body"> |
|
13 | 13 | ${h.secure_form(h.route_path('user_groups_update', user_group_id=c.user_group.users_group_id), id='edit_user_group', request=request)} |
|
14 | 14 | <div class="form"> |
|
15 | 15 | <!-- fields --> |
|
16 | 16 | <div class="fields"> |
|
17 | 17 | <div class="field"> |
|
18 | 18 | <div class="label"> |
|
19 | 19 | <label for="users_group_name">${_('Group name')}:</label> |
|
20 | 20 | </div> |
|
21 | 21 | <div class="input"> |
|
22 | 22 | ${h.text('users_group_name',class_='medium')} |
|
23 | 23 | </div> |
|
24 | 24 | </div> |
|
25 | 25 | |
|
26 | 26 | <div class="field badged-field"> |
|
27 | 27 | <div class="label"> |
|
28 | 28 | <label for="user">${_('Owner')}:</label> |
|
29 | 29 | </div> |
|
30 | 30 | <div class="input"> |
|
31 | 31 | <div class="badge-input-container"> |
|
32 | 32 | <div class="user-badge"> |
|
33 | 33 | ${base.gravatar_with_user(c.user_group.user.email, show_disabled=not c.user_group.user.active)} |
|
34 | 34 | </div> |
|
35 | 35 | <div class="badge-input-wrap"> |
|
36 | 36 | ${h.text('user', class_="medium", autocomplete="off")} |
|
37 | 37 | </div> |
|
38 | 38 | </div> |
|
39 | 39 | <form:error name="user"/> |
|
40 | 40 | <p class="help-block">${_('Change owner of this user group.')}</p> |
|
41 | 41 | </div> |
|
42 | 42 | </div> |
|
43 | 43 | |
|
44 | 44 | <div class="field"> |
|
45 | 45 | <div class="label label-textarea"> |
|
46 | 46 | <label for="user_group_description">${_('Description')}:</label> |
|
47 | 47 | </div> |
|
48 | 48 | <div class="textarea textarea-small editor"> |
|
49 | 49 | ${h.textarea('user_group_description',cols=23,rows=5,class_="medium")} |
|
50 | 50 | <span class="help-block">${_('Short, optional description for this user group.')}</span> |
|
51 | 51 | </div> |
|
52 | 52 | </div> |
|
53 | 53 | <div class="field"> |
|
54 | 54 | <div class="label label-checkbox"> |
|
55 | 55 | <label for="users_group_active">${_('Active')}:</label> |
|
56 | 56 | </div> |
|
57 | 57 | <div class="checkboxes"> |
|
58 | 58 | ${h.checkbox('users_group_active',value=True)} |
|
59 | 59 | </div> |
|
60 | 60 | </div> |
|
61 | 61 | |
|
62 | 62 | <div class="field"> |
|
63 | 63 | <div class="label label-checkbox"> |
|
64 | 64 | <label for="users_group_active">${_('Add members')}:</label> |
|
65 | 65 | </div> |
|
66 | 66 | <div class="input"> |
|
67 | 67 | ${h.text('user_group_add_members', placeholder="user/usergroup", class_="medium")} |
|
68 | 68 | </div> |
|
69 | 69 | </div> |
|
70 | 70 | |
|
71 | 71 | <input type="hidden" name="__start__" value="user_group_members:sequence"/> |
|
72 | 72 | <table id="group_members_placeholder" class="rctable group_members"> |
|
73 | 73 | <tr> |
|
74 | 74 | <th>${_('Username')}</th> |
|
75 | 75 | <th>${_('Action')}</th> |
|
76 | 76 | </tr> |
|
77 | 77 | |
|
78 | 78 | % if c.group_members_obj: |
|
79 | 79 | % for user in c.group_members_obj: |
|
80 | 80 | <tr> |
|
81 | 81 | <td id="member_user_${user.user_id}" class="td-author"> |
|
82 | 82 | <div class="group_member"> |
|
83 | 83 | ${base.gravatar(user.email, 16, user=user, tooltip=True)} |
|
84 | 84 | <span class="username user">${h.link_to(h.person(user), h.route_path('user_edit',user_id=user.user_id))}</span> |
|
85 | 85 | <input type="hidden" name="__start__" value="member:mapping"> |
|
86 | 86 | <input type="hidden" name="member_user_id" value="${user.user_id}"> |
|
87 | 87 | <input type="hidden" name="type" value="existing" id="member_${user.user_id}"> |
|
88 | 88 | <input type="hidden" name="__end__" value="member:mapping"> |
|
89 | 89 | </div> |
|
90 | 90 | </td> |
|
91 | 91 | <td class=""> |
|
92 | 92 | <div class="usergroup_member_remove action_button" onclick="removeUserGroupMember(${user.user_id}, true)" style="visibility: visible;"> |
|
93 | 93 | <i class="icon-remove"></i> |
|
94 | 94 | </div> |
|
95 | 95 | </td> |
|
96 | 96 | </tr> |
|
97 | 97 | % endfor |
|
98 | 98 | |
|
99 | 99 | % else: |
|
100 | 100 | <tr><td colspan="2">${_('No members yet')}</td></tr> |
|
101 | 101 | % endif |
|
102 | 102 | </table> |
|
103 | 103 | <input type="hidden" name="__end__" value="user_group_members:sequence"/> |
|
104 | 104 | |
|
105 | 105 | <div class="buttons"> |
|
106 | 106 | ${h.submit('Save',_('Save'),class_="btn")} |
|
107 | 107 | </div> |
|
108 | 108 | </div> |
|
109 | 109 | </div> |
|
110 | 110 | ${h.end_form()} |
|
111 | 111 | </div> |
|
112 | 112 | </div> |
|
113 | 113 | <script> |
|
114 | 114 | $(document).ready(function(){ |
|
115 | 115 | $("#group_parent_id").select2({ |
|
116 | 116 | 'containerCssClass': "drop-menu", |
|
117 | 117 | 'dropdownCssClass': "drop-menu-dropdown", |
|
118 | 118 | 'dropdownAutoWidth': true |
|
119 | 119 | }); |
|
120 | 120 | |
|
121 | 121 | removeUserGroupMember = function(userId){ |
|
122 | 122 | $('#member_'+userId).val('remove'); |
|
123 | 123 | $('#member_user_'+userId).addClass('to-delete'); |
|
124 | 124 | }; |
|
125 | 125 | |
|
126 | 126 | $('#user_group_add_members').autocomplete({ |
|
127 | 127 | serviceUrl: pyroutes.url('user_autocomplete_data'), |
|
128 | 128 | minChars:2, |
|
129 | 129 | maxHeight:400, |
|
130 | 130 | width:300, |
|
131 | 131 | deferRequestBy: 300, //miliseconds |
|
132 | 132 | showNoSuggestionNotice: true, |
|
133 | 133 | params: { user_groups:true }, |
|
134 | 134 | formatResult: autocompleteFormatResult, |
|
135 | 135 | lookupFilter: autocompleteFilterResult, |
|
136 | 136 | onSelect: function(element, suggestion){ |
|
137 | 137 | |
|
138 | 138 | function addMember(user, fromUserGroup) { |
|
139 | 139 | var gravatar = user.icon_link; |
|
140 | 140 | var username = user.value_display; |
|
141 | 141 | var userLink = pyroutes.url('user_edit', {"user_id": user.id}); |
|
142 | 142 | var uid = user.id; |
|
143 | 143 | |
|
144 | 144 | if (fromUserGroup) { |
|
145 | 145 | username = username +" "+ _gettext('(from usergroup {0})'.format(fromUserGroup)) |
|
146 | 146 | } |
|
147 | 147 | |
|
148 | 148 | var elem = $( |
|
149 | 149 | ('<tr>'+ |
|
150 | 150 | '<td id="member_user_{6}" class="td-author td-author-new-entry">'+ |
|
151 | 151 | '<div class="group_member">'+ |
|
152 | 152 | '<img class="gravatar" src="{0}" height="16" width="16">'+ |
|
153 | 153 | '<span class="username user"><a href="{1}">{2}</a></span>'+ |
|
154 | 154 | '<input type="hidden" name="__start__" value="member:mapping">'+ |
|
155 | 155 | '<input type="hidden" name="member_user_id" value="{3}">'+ |
|
156 | 156 | '<input type="hidden" name="type" value="new" id="member_{4}">'+ |
|
157 | 157 | '<input type="hidden" name="__end__" value="member:mapping">'+ |
|
158 | 158 | '</div>'+ |
|
159 | 159 | '</td>'+ |
|
160 | 160 | '<td class="td-author-new-entry">'+ |
|
161 | 161 | '<div class="usergroup_member_remove action_button" onclick="removeUserGroupMember({5}, true)" style="visibility: visible;">'+ |
|
162 | 162 | '<i class="icon-remove"></i>'+ |
|
163 | 163 | '</div>'+ |
|
164 | 164 | '</td>'+ |
|
165 | 165 | '</tr>').format(gravatar, userLink, username, |
|
166 | 166 | uid, uid, uid, uid) |
|
167 | 167 | ); |
|
168 | 168 | $('#group_members_placeholder').append(elem) |
|
169 | 169 | } |
|
170 | 170 | |
|
171 | 171 | if (suggestion.value_type == 'user_group') { |
|
172 | 172 | $.getJSON( |
|
173 | 173 | pyroutes.url('user_group_members_data', |
|
174 | 174 | {'user_group_id': suggestion.id}), |
|
175 | 175 | function(data) { |
|
176 | 176 | $.each(data.members, function(idx, user) { |
|
177 | 177 | addMember(user, suggestion.value) |
|
178 | 178 | }); |
|
179 | 179 | } |
|
180 | 180 | ); |
|
181 | 181 | } else if (suggestion.value_type == 'user') { |
|
182 | 182 | addMember(suggestion, null); |
|
183 | 183 | } |
|
184 | $('#user_group_add_members').val('') | |
|
184 | 185 | } |
|
185 | 186 | }); |
|
186 | 187 | |
|
187 | 188 | |
|
188 | 189 | UsersAutoComplete('user', '${c.rhodecode_user.user_id}'); |
|
189 | 190 | }) |
|
190 | 191 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now