##// END OF EJS Templates
repos, repo groups, user groups: visually show what user is an owner, and if...
marcink -
r225:48a40e43 default
parent child Browse files
Show More
@@ -1,293 +1,320 b''
1 1 // forms.less
2 2 // For use in RhodeCode applications;
3 3 // see style guide documentation for guidelines.
4 4
5 5 form.rcform {
6 6
7 7 // reset for ie
8 8 // using :not(#ie) prevents older browsers from applying these rules
9 9 input[type="radio"],
10 10 input[type="checkbox"] {
11 11 padding: 0;
12 12 border: none;
13 13 }
14 14 label { display: inline; border:none; padding:none; }
15 15 .label { display: none; }
16 16
17 17 max-width: 940px;
18 18 line-height: normal;
19 19 white-space: normal;
20 20 font-size: @basefontsize;
21 21 font-family: @text-light;
22 22 color: @form-textcolor;
23 23
24 24 fieldset,
25 25 .buttons {
26 26 clear: both;
27 27 position: relative;
28 28 display:block;
29 29 width: 100%;
30 30 min-height: 3em;
31 31 margin-bottom: @form-vertical-margin;
32 32 line-height: 1.2em;
33 33
34 34 &:after { //clearfix
35 35 content: "";
36 36 clear: both;
37 37 width: 100%;
38 38 height: 1em;
39 39 }
40 40
41 41 .label:not(#ie) {
42 42 display: inline;
43 43 margin: 0 1em 0 .5em;
44 44 line-height: 1em;
45 45 }
46 46 }
47 47
48 48 legend {
49 49 float: left;
50 50 display: block;
51 51 width: @legend-width;
52 52 margin: 0;
53 53 padding: 0 @padding 0 0;
54 54 }
55 55
56 56 .fields {
57 57 float: left;
58 58 display: block;
59 59 width: 100%;
60 60 max-width: 500px;
61 61 margin: 0 0 @padding -@legend-width;
62 62 padding: 0 0 0 @legend-width;
63 63
64 64 .btn {
65 65 display: inline-block;
66 66 margin: 0 1em @padding 0;
67 67 }
68 68 }
69 69
70 70 input,
71 71 textarea {
72 72 float: left;
73 73 .box-sizing(content-box);
74 74 padding: @input-padding;
75 75 border: @border-thickness-inputs solid @grey4;
76 76 }
77 77
78 78 input {
79 79 float: left;
80 80 margin: 0 @input-padding 0 0;
81 81 line-height: 1em;
82 82 }
83 83
84 84 input[type="text"],
85 85 input[type="password"],
86 86 textarea {
87 87 float: left;
88 88 min-width: 200px;
89 89 margin: 0 1em @padding 0;
90 90 color: @form-textcolor;
91 91 }
92 92
93 93 input[type="text"],
94 94 input[type="password"] {
95 95 height: 1em;
96 96 }
97 97
98 98 textarea {
99 99 width: 100%;
100 100 margin-top: -1em; //so it lines up with legend
101 101 overflow: auto;
102 102 }
103 103
104 104 label:not(#ie) {
105 105 cursor: pointer;
106 106 display: inline-block;
107 107 position: relative;
108 108 background: white;
109 109 border-radius: 4px;
110 110 box-shadow: none;
111 111
112 112 &:hover::after {
113 113 opacity: 0.5;
114 114 }
115 115 }
116 116
117 117 input[type="radio"]:not(#ie),
118 118 input[type="checkbox"]:not(#ie) {
119 119 // Hide the input, but have it still be clickable
120 120 opacity: 0;
121 121 float: left;
122 122 height: 0;
123 123 width: 0;
124 124 margin: 0;
125 125 padding: 0;
126 126 }
127 127 input[type='radio'] + label:not(#ie),
128 128 input[type='checkbox'] + label:not(#ie) {
129 129 margin: 0;
130 130 clear: none;
131 131 }
132 132
133 133 input[type='radio'] + label:not(#ie) {
134 134 .circle (@form-radio-width,white);
135 135 float: left;
136 136 display: inline-block;
137 137 height: @form-radio-width;
138 138 width: @form-radio-width;
139 139 margin: 2px 6px 2px 0;
140 140 border: 1px solid @grey4;
141 141 background-color: white;
142 142 box-shadow: none;
143 143 text-indent: -9999px;
144 144 transition: none;
145 145
146 146 & + .label {
147 147 float: left;
148 148 margin-top: 7px
149 149 }
150 150 }
151 151
152 152 input[type='radio']:checked + label:not(#ie) {
153 153 margin: 0 4px 0 -2px;
154 154 padding: 3px;
155 155 border-style: double;
156 156 border-color: white;
157 157 border-width: thick;
158 158 background-color: @rcblue;
159 159 box-shadow: none;
160 160 }
161 161
162 162 input[type='checkbox'] + label:not(#ie) {
163 163 float: left;
164 164 width: @form-check-width;
165 165 height: @form-check-width;
166 166 margin: 0 5px 1em 0;
167 167 border: 1px solid @grey3;
168 168 .border-radius(@border-radius);
169 169 background-color: white;
170 170 box-shadow: none;
171 171 text-indent: -9999px;
172 172 transition: none;
173 173
174 174 &:after {
175 175 content: '';
176 176 width: 9px;
177 177 height: 5px;
178 178 position: absolute;
179 179 top: 4px;
180 180 left: 4px;
181 181 border: 3px solid @grey3;
182 182 border-top: none;
183 183 border-right: none;
184 184 background: transparent;
185 185 opacity: 0;
186 186 transform: rotate(-45deg);
187 187 filter: progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand', M11=0.7071067811865476, M12=-0.7071067811865475, M21=0.7071067811865475, M22=0.7071067811865476); /* IE6,IE7 */
188 188
189 189 -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(SizingMethod='auto expand', M11=0.7071067811865476, M12=-0.7071067811865475, M21=0.7071067811865475, M22=0.7071067811865476)"; /* IE8 */ }
190 190
191 191 & + .label {
192 192 float: left;
193 193 margin-top: 5px
194 194 }
195 195 }
196 196
197 197 input[type=checkbox]:not(#ie) {
198 198 visibility: hidden;
199 199 &:checked + label:after {
200 200 opacity: 1;
201 201 }
202 202 }
203 203
204 204 // center checkbox and label on a drop-down
205 205 .drop-menu + select + input[type='checkbox'] + label:not(#ie) {
206 206 margin-top:10px;
207 207
208 208 & + .label {
209 209 margin-top: 15px;
210 210 }
211 211 }
212 212
213 213 .formlist {
214 214 position: relative;
215 215 float: left;
216 216 margin: 0;
217 217 padding: 0;
218 218
219 219 li {
220 220 list-style-type: none;
221 221
222 222 &:before { content:none; }
223 223 &:after {
224 224 content: "";
225 225 float: left;
226 226 display: block;
227 227 height: @padding;
228 228 width: 100%;
229 229 }
230 230 }
231 231 }
232 232
233 233 .drop-menu {
234 234 float: left;
235 235 margin: 0 @input-padding 0 0;
236 236 }
237 237
238 238 .help-block,
239 239 .error-message {
240 240 display: block;
241 241 clear: both;
242 242 margin: @textmargin 0;
243 243 }
244 244
245 245 .error-message {
246 246 margin-top: 5px;
247 247 }
248 248
249 249 input[type=submit] {
250 250 &:extend(.btn-primary);
251 251
252 252 &:hover {
253 253 &:extend(.btn-primary:hover);
254 254 }
255 255 }
256 256
257 257 input[type=reset] {
258 258 &:extend(.btn-default);
259 259
260 260 &:hover {
261 261 &:extend(.btn-default:hover);
262 262 }
263 263 }
264 264
265 265 select,
266 266 option:checked {
267 267 background-color: @rclightblue;
268 268 }
269 269
270 270 }
271 271
272 .badged-field {
273 .user-badge {
274 line-height: 25px;
275 padding: 10px 5px;
276 border-radius: @border-radius;
277 border-top: 1px solid @rclightblue;
278 border-left: 1px solid @rclightblue;
279 border-bottom: 1px solid @rclightblue;
280 font-size: 14px;
281 font-style: normal;
282 color: @text-light;
283 display: inline-block;
284 vertical-align: top;
285 cursor: default;
286 margin-right: -2px;
287 }
288 .badge-input-container {
289 display: flex;
290 position: relative;
291 }
292 .user-disabled {
293 text-decoration: line-through;
294 }
295 .badge-input-wrap {
296 display: inline-block;
297 }
298 }
272 299
273 300 // for situations where we wish to display the form value but not the form input
274 301 input.input-valuedisplay {
275 302 border: none;
276 303 }
277 304
278 305 // for forms which only display information
279 306 .infoform {
280 307 .fields {
281 308 .field {
282 309 label,
283 310 .label,
284 311 input,
285 312 .input {
286 313 margin-top: 0;
287 314 margin-bottom: 0;
288 315 padding-top: 0;
289 316 padding-bottom: 0;
290 317 }
291 318 }
292 319 }
293 320 }
@@ -1,72 +1,84 b''
1 1 ## -*- coding: utf-8 -*-
2 <%namespace name="base" file="/base/base.html"/>
3
2 4 <div class="panel panel-default">
3 5 <div class="panel-heading">
4 6 <h3 class="panel-title">${_('Settings for Repository Group: %s') % c.repo_group.name}</h3>
5 7 </div>
6 8 <div class="panel-body">
7 9 ${h.secure_form(url('update_repo_group',group_name=c.repo_group.group_name),method='put')}
8 10 <div class="form">
9 11 <!-- fields -->
10 12 <div class="fields">
11 13 <div class="field">
12 14 <div class="label">
13 15 <label for="group_name">${_('Group Name')}:</label>
14 16 </div>
15 17 <div class="input">
16 18 ${h.text('group_name',class_='medium')}
17 19 </div>
18 20 </div>
19 <div class="field">
21
22 <div class="field badged-field">
20 23 <div class="label">
21 24 <label for="user">${_('Owner')}:</label>
22 25 </div>
23 26 <div class="input">
27 <div class="badge-input-container">
28 <div class="user-badge">
29 ${base.gravatar_with_user(c.repo_group.user.email, show_disabled=not c.repo_group.user.active)}
30 </div>
31 <div class="badge-input-wrap">
24 32 ${h.text('user', class_="medium", autocomplete="off")}
25 <span class="help-block">${_('Change Repository Group Owner.')}</span>
26 33 </div>
27 34 </div>
35 <form:error name="user"/>
36 <p class="help-block">${_('Change owner of this repository group.')}</p>
37 </div>
38 </div>
39
28 40 <div class="field">
29 41 <div class="label label-textarea">
30 42 <label for="group_description">${_('Description')}:</label>
31 43 </div>
32 44 <div class="textarea text-area editor">
33 45 ${h.textarea('group_description',cols=23,rows=5,class_="medium")}
34 46 </div>
35 47 </div>
36 48
37 49 <div class="field">
38 50 <div class="label">
39 51 <label for="group_parent_id">${_('Group parent')}:</label>
40 52 </div>
41 53 <div class="select">
42 54 ${h.select('group_parent_id','',c.repo_groups,class_="medium")}
43 55 </div>
44 56 </div>
45 57 <div class="field">
46 58 <div class="label label-checkbox">
47 59 <label for="enable_locking">${_('Enable Repository Locking')}:</label>
48 60 </div>
49 61 <div class="checkboxes">
50 62 ${h.checkbox('enable_locking',value="True")}
51 63 <span class="help-block">${_('Repository locking will be enabled on all subgroups and repositories inside this repository group. Pulling from a repository locks it, and it is unlocked by pushing back by the same user.')}</span>
52 64 </div>
53 65 </div>
54 66 <div class="buttons">
55 67 ${h.submit('save',_('Save'),class_="btn")}
56 68 ${h.reset('reset',_('Reset'),class_="btn")}
57 69 </div>
58 70 </div>
59 71 </div>
60 72 ${h.end_form()}
61 73 </div>
62 74 </div>
63 75 <script>
64 76 $(document).ready(function(){
65 77 $("#group_parent_id").select2({
66 78 'containerCssClass': "drop-menu",
67 79 'dropdownCssClass': "drop-menu-dropdown",
68 80 'dropdownAutoWidth': true
69 81 });
70 82 UsersAutoComplete('user', '${c.rhodecode_user.user_id}');
71 83 })
72 84 </script>
@@ -1,225 +1,238 b''
1 ## -*- coding: utf-8 -*-
2 <%namespace name="base" file="/base/base.html"/>
3
1 4 <div class="panel panel-default">
2 5 <div class="panel-heading">
3 6 <h3 class="panel-title">${_('Settings for Repository: %s') % c.repo_info.repo_name}</h3>
4 7 </div>
5 8 <div class="panel-body">
6 9 ${h.secure_form(url('repo', repo_name=c.repo_info.repo_name),method='put')}
7 10 <div class="form">
8 11 <!-- fields -->
9 12 <div class="fields">
10 13 <div class="field">
11 14 <div class="label">
12 15 <label for="repo_name">${_('Name')}:</label>
13 16 </div>
14 17 <div class="input">
15 18 ${h.text('repo_name',class_="medium")}
16 19 <p class="help-block">${_('Non-changeable id')}: `_${c.repo_info.repo_id}` <span><a id="show_more_clone_id" href="#">${_('what is that ?')}</a></span></p>
17 20 <p id="clone_id" style="display:none;">
18 21 ${_('URL by id')}: `${c.repo_info.clone_url(with_id=True)}` </br>
19 22 ${_('''In case this repository is renamed or moved into another group the repository url changes.
20 23 Using above url guarantees that this repository will always be accessible under such url.
21 24 Useful for CI systems, or any other cases that you need to hardcode the url into 3rd party service.''')}</p>
22 25 </div>
23 26 </div>
24 27 % if c.repo_info.repo_type != 'svn':
25 28 <div class="field">
26 29 <div class="label">
27 30 <label for="clone_uri">${_('Remote uri')}:</label>
28 31 </div>
29 32 <div class="input">
30 33 %if c.repo_info.clone_uri:
31 34 <div id="clone_uri_hidden" class='text-as-placeholder'>
32 35 <span id="clone_uri_hidden_value">${c.repo_info.clone_uri_hidden}</span>
33 36 <span class="link" id="edit_clone_uri"><i class="icon-edit"></i>${_('edit')}</span>
34 37 </div>
35 38 <div id="alter_clone_uri" style="display: none">
36 39 ${h.text('clone_uri',class_="medium", placeholder=_('new value, leave empty to remove'))}
37 40 ${h.hidden('clone_uri_change', 'OLD')}
38 41 <span class="link" id="cancel_edit_clone_uri">${_('cancel')}</span>
39 42 </div>
40 43 %else:
41 44 ## not set yet, display form to set it
42 45 ${h.text('clone_uri',class_="medium")}
43 46 ${h.hidden('clone_uri_change', 'NEW')}
44 47 %endif
45 48 <p id="alter_clone_uri_help_block" class="help-block">${_('http[s] url where from repository was imported, also used for doing remote pulls.')}</p>
46 49 </div>
47 50 </div>
48 51 % else:
49 52 ${h.hidden('clone_uri', '')}
50 53 % endif
51 54 <div class="field">
52 55 <div class="label">
53 56 <label for="repo_group">${_('Repository group')}:</label>
54 57 </div>
55 58 <div class="select">
56 59 ${h.select('repo_group','',c.repo_groups,class_="medium")}
57 60 %if c.personal_repo_group:
58 61 <a style="padding: 4px" href="#" id="select_my_group" data-personal-group-id="${c.personal_repo_group.group_id}">${_('Select my personal group (%(repo_group_name)s)') % {'repo_group_name': c.personal_repo_group.group_name}}</a>
59 62 %endif
60 63 <p class="help-block">${_('Optional select a group to put this repository into.')}</p>
61 64 </div>
62 65 </div>
63 66 <div class="field">
64 67 <div class="label">
65 68 <label for="repo_landing_rev">${_('Landing commit')}:</label>
66 69 </div>
67 70 <div class="select">
68 71 ${h.select('repo_landing_rev','',c.landing_revs,class_="medium")}
69 72 <p class="help-block">${_('Default commit for files page, downloads, whoosh and readme')}</p>
70 73 </div>
71 74 </div>
72 <div class="field">
75
76 <div class="field badged-field">
73 77 <div class="label">
74 78 <label for="user">${_('Owner')}:</label>
75 79 </div>
76 80 <div class="input">
81 <div class="badge-input-container">
82 <div class="user-badge">
83 ${base.gravatar_with_user(c.repo_info.user.email, show_disabled=not c.repo_info.user.active)}
84 </div>
85 <div class="badge-input-wrap">
77 86 ${h.text('user', class_="medium", autocomplete="off")}
87 </div>
88 </div>
89 <form:error name="user"/>
78 90 <p class="help-block">${_('Change owner of this repository.')}</p>
79 91 </div>
80 92 </div>
93
81 94 <div class="field">
82 95 <div class="label label-textarea">
83 96 <label for="repo_description">${_('Description')}:</label>
84 97 </div>
85 98 <div class="textarea text-area editor">
86 99 ${h.textarea('repo_description', )}
87 100 <p class="help-block">${_('Keep it short and to the point. Use a README file for longer descriptions.')}</p>
88 101 </div>
89 102 </div>
90 103
91 104 <div class="field">
92 105 <div class="label label-checkbox">
93 106 <label for="repo_private">${_('Private repository')}:</label>
94 107 </div>
95 108 <div class="checkboxes">
96 109 ${h.checkbox('repo_private',value="True")}
97 110 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
98 111 </div>
99 112 </div>
100 113 <div class="field">
101 114 <div class="label label-checkbox">
102 115 <label for="repo_enable_statistics">${_('Enable statistics')}:</label>
103 116 </div>
104 117 <div class="checkboxes">
105 118 ${h.checkbox('repo_enable_statistics',value="True")}
106 119 <span class="help-block">${_('Enable statistics window on summary page.')}</span>
107 120 </div>
108 121 </div>
109 122 <div class="field">
110 123 <div class="label label-checkbox">
111 124 <label for="repo_enable_downloads">${_('Enable downloads')}:</label>
112 125 </div>
113 126 <div class="checkboxes">
114 127 ${h.checkbox('repo_enable_downloads',value="True")}
115 128 <span class="help-block">${_('Enable download menu on summary page.')}</span>
116 129 </div>
117 130 </div>
118 131 <div class="field">
119 132 <div class="label label-checkbox">
120 133 <label for="repo_enable_locking">${_('Enable automatic locking')}:</label>
121 134 </div>
122 135 <div class="checkboxes">
123 136 ${h.checkbox('repo_enable_locking',value="True")}
124 137 <span class="help-block">${_('Enable automatic locking on repository. Pulling from this repository creates a lock that can be released by pushing back by the same user')}</span>
125 138 </div>
126 139 </div>
127 140
128 141 %if c.visual.repository_fields:
129 142 ## EXTRA FIELDS
130 143 %for field in c.repo_fields:
131 144 <div class="field">
132 145 <div class="label">
133 146 <label for="${field.field_key_prefixed}">${field.field_label} (${field.field_key}):</label>
134 147 </div>
135 148 <div class="input input-medium">
136 149 ${h.text(field.field_key_prefixed, field.field_value, class_='medium')}
137 150 %if field.field_desc:
138 151 <span class="help-block">${field.field_desc}</span>
139 152 %endif
140 153 </div>
141 154 </div>
142 155 %endfor
143 156 %endif
144 157 <div class="buttons">
145 158 ${h.submit('save',_('Save'),class_="btn")}
146 159 ${h.reset('reset',_('Reset'),class_="btn")}
147 160 </div>
148 161 </div>
149 162 </div>
150 163 ${h.end_form()}
151 164 </div>
152 165 </div>
153 166
154 167 <script>
155 168 $(document).ready(function(){
156 169 var select2Options = {
157 170 'containerCssClass': "drop-menu",
158 171 'dropdownCssClass': "drop-menu-dropdown",
159 172 'dropdownAutoWidth': true
160 173 };
161 174
162 175 var cloneUrl = function() {
163 176 var alterButton = $('#alter_clone_uri');
164 177 var editButton = $('#edit_clone_uri');
165 178 var cancelEditButton = $('#cancel_edit_clone_uri');
166 179 var hiddenUrl = $('#clone_uri_hidden');
167 180 var hiddenUrlValue = $('#clone_uri_hidden_value');
168 181 var input = $('#clone_uri');
169 182 var helpBlock = $('#alter_clone_uri_help_block');
170 183 var changedFlag = $('#clone_uri_change');
171 184 var originalText = helpBlock.html();
172 185 var obfuscatedUrl = hiddenUrlValue.html();
173 186
174 187 var edit = function(e) {
175 188 alterButton.show();
176 189 editButton.hide();
177 190 hiddenUrl.hide();
178 191
179 192 //add the old value next to input for verification
180 193 helpBlock.html("(" + obfuscatedUrl + ")" + "<br\>" + originalText);
181 194 changedFlag.val('MOD');
182 195 };
183 196
184 197 var cancelEdit = function(e) {
185 198 alterButton.hide();
186 199 editButton.show();
187 200 hiddenUrl.show();
188 201
189 202 helpBlock.html(originalText);
190 203 changedFlag.val('OLD');
191 204 input.val('');
192 205 };
193 206
194 207 var initEvents = function() {
195 208 editButton.on('click', edit);
196 209 cancelEditButton.on('click', cancelEdit);
197 210 };
198 211
199 212 var setInitialState = function() {
200 213 if (input.hasClass('error')) {
201 214 alterButton.show();
202 215 editButton.hide();
203 216 hiddenUrl.hide();
204 217 }
205 218 };
206 219
207 220 setInitialState();
208 221 initEvents();
209 222 }();
210 223
211 224 $('#show_more_clone_id').on('click', function(e){
212 225 $('#clone_id').show();
213 226 e.preventDefault();
214 227 });
215 228
216 229 $('#repo_landing_rev').select2(select2Options);
217 230 $('#repo_group').select2(select2Options);
218 231
219 232 UsersAutoComplete('user', '${c.rhodecode_user.user_id}');
220 233 $('#select_my_group').on('click', function(e){
221 234 e.preventDefault();
222 235 $("#repo_group").val($(this).data('personalGroupId')).trigger("change");
223 236 });
224 237 });
225 238 </script>
@@ -1,131 +1,144 b''
1 ## -*- coding: utf-8 -*-
2 <%namespace name="base" file="/base/base.html"/>
3
1 4 <div class="panel panel-default">
2 5 <div class="panel-heading">
3 6 <h3 class="panel-title">${_('User Group: %s') % c.user_group.users_group_name}</h3>
4 7 </div>
5 8 <div class="panel-body">
6 9 ${h.secure_form(url('update_users_group', user_group_id=c.user_group.users_group_id),method='put', id='edit_users_group')}
7 10 <div class="form">
8 11 <!-- fields -->
9 12 <div class="fields">
10 13 <div class="field">
11 14 <div class="label">
12 15 <label for="users_group_name">${_('Group name')}:</label>
13 16 </div>
14 17 <div class="input">
15 18 ${h.text('users_group_name',class_='medium')}
16 19 </div>
17 20 </div>
18 <div class="field">
21
22 <div class="field badged-field">
19 23 <div class="label">
20 24 <label for="user">${_('Owner')}:</label>
21 25 </div>
22 26 <div class="input">
27 <div class="badge-input-container">
28 <div class="user-badge">
29 ${base.gravatar_with_user(c.user_group.user.email, show_disabled=not c.user_group.user.active)}
30 </div>
31 <div class="badge-input-wrap">
23 32 ${h.text('user', class_="medium", autocomplete="off")}
24 <span class="help-block">${_('Change owner of this user group.')}</span>
25 33 </div>
26 34 </div>
35 <form:error name="user"/>
36 <p class="help-block">${_('Change owner of this user group.')}</p>
37 </div>
38 </div>
39
27 40 <div class="field">
28 41 <div class="label label-textarea">
29 42 <label for="user_group_description">${_('Description')}:</label>
30 43 </div>
31 44 <div class="textarea textarea-small editor">
32 45 ${h.textarea('user_group_description',cols=23,rows=5,class_="medium")}
33 46 <span class="help-block">${_('Short, optional description for this user group.')}</span>
34 47 </div>
35 48 </div>
36 49 <div class="field">
37 50 <div class="label label-checkbox">
38 51 <label for="users_group_active">${_('Active')}:</label>
39 52 </div>
40 53 <div class="checkboxes">
41 54 ${h.checkbox('users_group_active',value=True)}
42 55 </div>
43 56 </div>
44 57 <div class="field">
45 58 <div class="label">
46 59 <label for="users_group_active">${_('Search')}:</label>
47 60 ${h.text('from_user_group',
48 61 placeholder="user/usergroup",
49 62 class_="medium")}
50 63 </div>
51 64 <div class="select side-by-side-selector">
52 65 <div class="left-group">
53 66 <label class="text"><strong>${_('Chosen group members')}</strong></label>
54 67 ${h.select('users_group_members',[x[0] for x in c.group_members],c.group_members,multiple=True,size=8,)}
55 68 <div class="btn" id="remove_all_elements" >
56 69 ${_('Remove all elements')}
57 70 <i class="icon-chevron-right"></i>
58 71 </div>
59 72 </div>
60 73 <div class="middle-group">
61 74 <i id="add_element" class="icon-chevron-left"></i>
62 75 <br />
63 76 <i id="remove_element" class="icon-chevron-right"></i>
64 77 </div>
65 78 <div class="right-group">
66 79 <label class="text" >${_('Available users')}
67 80 </label>
68 81 ${h.select('available_members',[],c.available_members,multiple=True,size=8,)}
69 82 <div class="btn" id="add_all_elements" >
70 83 <i class="icon-chevron-left"></i>${_('Add all elements')}
71 84 </div>
72 85 </div>
73 86 </div>
74 87 </div>
75 88 <div class="buttons">
76 89 ${h.submit('Save',_('Save'),class_="btn")}
77 90 </div>
78 91 </div>
79 92 </div>
80 93 ${h.end_form()}
81 94 </div>
82 95 </div>
83 96 <script>
84 97 $(document).ready(function(){
85 98 MultiSelectWidget('users_group_members','available_members','edit_users_group');
86 99
87 100 $("#group_parent_id").select2({
88 101 'containerCssClass': "drop-menu",
89 102 'dropdownCssClass': "drop-menu-dropdown",
90 103 'dropdownAutoWidth': true
91 104 });
92 105
93 106 $('#from_user_group').autocomplete({
94 107 serviceUrl: pyroutes.url('user_autocomplete_data'),
95 108 minChars:2,
96 109 maxHeight:400,
97 110 width:300,
98 111 deferRequestBy: 300, //miliseconds
99 112 showNoSuggestionNotice: true,
100 113 params: { user_groups:true },
101 114 formatResult: autocompleteFormatResult,
102 115 lookupFilter: autocompleteFilterResult,
103 116 onSelect: function(element, suggestion){
104 117
105 118 function preSelectUserIds(uids) {
106 119 $('#available_members').val(uids);
107 120 $('#users_group_members').val(uids);
108 121 }
109 122
110 123 if (suggestion.value_type == 'user_group') {
111 124 $.getJSON(
112 125 pyroutes.url('edit_user_group_members',
113 126 {'user_group_id': suggestion.id}),
114 127 function(data) {
115 128 var uids = [];
116 129 $.each(data.members, function(idx, user) {
117 130 var userid = user[0],
118 131 username = user[1];
119 132 uids.push(userid.toString());
120 133 });
121 134 preSelectUserIds(uids)
122 135 }
123 136 );
124 137 } else if (suggestion.value_type == 'user') {
125 138 preSelectUserIds([suggestion.id.toString()]);
126 139 }
127 140 }
128 141 });
129 142 UsersAutoComplete('user', '${c.rhodecode_user.user_id}');
130 143 })
131 144 </script>
General Comments 0
You need to be logged in to leave comments. Login now