##// END OF EJS Templates
admin: tweak usergroup settings ui for clarity
dan -
r101:f6b5a36e default
parent child Browse files
Show More
@@ -1,131 +1,131 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('User Group: %s') % c.user_group.users_group_name}</h3>
3 <h3 class="panel-title">${_('User Group: %s') % c.user_group.users_group_name}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
5 <div class="panel-body">
6 ${h.secure_form(url('update_users_group', user_group_id=c.user_group.users_group_id),method='put', id='edit_users_group')}
6 ${h.secure_form(url('update_users_group', user_group_id=c.user_group.users_group_id),method='put', id='edit_users_group')}
7 <div class="form">
7 <div class="form">
8 <!-- fields -->
8 <!-- fields -->
9 <div class="fields">
9 <div class="fields">
10 <div class="field">
10 <div class="field">
11 <div class="label">
11 <div class="label">
12 <label for="users_group_name">${_('Group name')}:</label>
12 <label for="users_group_name">${_('Group name')}:</label>
13 </div>
13 </div>
14 <div class="input">
14 <div class="input">
15 ${h.text('users_group_name',class_='medium')}
15 ${h.text('users_group_name',class_='medium')}
16 </div>
16 </div>
17 </div>
17 </div>
18 <div class="field">
18 <div class="field">
19 <div class="label">
19 <div class="label">
20 <label for="user">${_('Owner')}:</label>
20 <label for="user">${_('Owner')}:</label>
21 </div>
21 </div>
22 <div class="input">
22 <div class="input">
23 ${h.text('user', class_="medium", autocomplete="off")}
23 ${h.text('user', class_="medium", autocomplete="off")}
24 <span class="help-block">${_('Change owner of this user group.')}</span>
24 <span class="help-block">${_('Change owner of this user group.')}</span>
25 </div>
25 </div>
26 </div>
26 </div>
27 <div class="field">
27 <div class="field">
28 <div class="label label-textarea">
28 <div class="label label-textarea">
29 <label for="user_group_description">${_('Description')}:</label>
29 <label for="user_group_description">${_('Description')}:</label>
30 </div>
30 </div>
31 <div class="textarea textarea-small editor">
31 <div class="textarea textarea-small editor">
32 ${h.textarea('user_group_description',cols=23,rows=5,class_="medium")}
32 ${h.textarea('user_group_description',cols=23,rows=5,class_="medium")}
33 <span class="help-block">${_('Short, optional description for this user group.')}</span>
33 <span class="help-block">${_('Short, optional description for this user group.')}</span>
34 </div>
34 </div>
35 </div>
35 </div>
36 <div class="field">
36 <div class="field">
37 <div class="label label-checkbox">
37 <div class="label label-checkbox">
38 <label for="users_group_active">${_('Active')}:</label>
38 <label for="users_group_active">${_('Active')}:</label>
39 </div>
39 </div>
40 <div class="checkboxes">
40 <div class="checkboxes">
41 ${h.checkbox('users_group_active',value=True)}
41 ${h.checkbox('users_group_active',value=True)}
42 </div>
42 </div>
43 </div>
43 </div>
44 <div class="field">
44 <div class="field">
45 <div class="label">
45 <div class="label">
46 <label for="users_group_active">${_('Members')}:</label>
46 <label for="users_group_active">${_('Search')}:</label>
47 ${h.text('from_user_group',
47 ${h.text('from_user_group',
48 placeholder="select only users",
48 placeholder="user/usergroup",
49 class_="medium")}
49 class_="medium")}
50 </div>
50 </div>
51 <div class="select side-by-side-selector">
51 <div class="select side-by-side-selector">
52 <div class="left-group">
52 <div class="left-group">
53 <label class="text" >${_('Chosen group members')}</label>
53 <label class="text"><strong>${_('Chosen group members')}</strong></label>
54 ${h.select('users_group_members',[x[0] for x in c.group_members],c.group_members,multiple=True,size=8,)}
54 ${h.select('users_group_members',[x[0] for x in c.group_members],c.group_members,multiple=True,size=8,)}
55 <div class="btn" id="remove_all_elements" >
55 <div class="btn" id="remove_all_elements" >
56 ${_('Remove all elements')}
56 ${_('Remove all elements')}
57 <i class="icon-chevron-right"></i>
57 <i class="icon-chevron-right"></i>
58 </div>
58 </div>
59 </div>
59 </div>
60 <div class="middle-group">
60 <div class="middle-group">
61 <i id="add_element" class="icon-chevron-left"></i>
61 <i id="add_element" class="icon-chevron-left"></i>
62 <br />
62 <br />
63 <i id="remove_element" class="icon-chevron-right"></i>
63 <i id="remove_element" class="icon-chevron-right"></i>
64 </div>
64 </div>
65 <div class="right-group">
65 <div class="right-group">
66 <label class="text" >${_('Available members')}
66 <label class="text" >${_('Available users')}
67 </label>
67 </label>
68 ${h.select('available_members',[],c.available_members,multiple=True,size=8,)}
68 ${h.select('available_members',[],c.available_members,multiple=True,size=8,)}
69 <div class="btn" id="add_all_elements" >
69 <div class="btn" id="add_all_elements" >
70 <i class="icon-chevron-left"></i>${_('Add all elements')}
70 <i class="icon-chevron-left"></i>${_('Add all elements')}
71 </div>
71 </div>
72 </div>
72 </div>
73 </div>
73 </div>
74 </div>
74 </div>
75 <div class="buttons">
75 <div class="buttons">
76 ${h.submit('Save',_('Save'),class_="btn")}
76 ${h.submit('Save',_('Save'),class_="btn")}
77 </div>
77 </div>
78 </div>
78 </div>
79 </div>
79 </div>
80 ${h.end_form()}
80 ${h.end_form()}
81 </div>
81 </div>
82 </div>
82 </div>
83 <script>
83 <script>
84 $(document).ready(function(){
84 $(document).ready(function(){
85 MultiSelectWidget('users_group_members','available_members','edit_users_group');
85 MultiSelectWidget('users_group_members','available_members','edit_users_group');
86
86
87 $("#group_parent_id").select2({
87 $("#group_parent_id").select2({
88 'containerCssClass': "drop-menu",
88 'containerCssClass': "drop-menu",
89 'dropdownCssClass': "drop-menu-dropdown",
89 'dropdownCssClass': "drop-menu-dropdown",
90 'dropdownAutoWidth': true
90 'dropdownAutoWidth': true
91 });
91 });
92
92
93 $('#from_user_group').autocomplete({
93 $('#from_user_group').autocomplete({
94 serviceUrl: pyroutes.url('user_autocomplete_data'),
94 serviceUrl: pyroutes.url('user_autocomplete_data'),
95 minChars:2,
95 minChars:2,
96 maxHeight:400,
96 maxHeight:400,
97 width:300,
97 width:300,
98 deferRequestBy: 300, //miliseconds
98 deferRequestBy: 300, //miliseconds
99 showNoSuggestionNotice: true,
99 showNoSuggestionNotice: true,
100 params: { user_groups:true },
100 params: { user_groups:true },
101 formatResult: autocompleteFormatResult,
101 formatResult: autocompleteFormatResult,
102 lookupFilter: autocompleteFilterResult,
102 lookupFilter: autocompleteFilterResult,
103 onSelect: function(element, suggestion){
103 onSelect: function(element, suggestion){
104
104
105 function preSelectUserIds(uids) {
105 function preSelectUserIds(uids) {
106 $('#available_members').val(uids);
106 $('#available_members').val(uids);
107 $('#users_group_members').val(uids);
107 $('#users_group_members').val(uids);
108 }
108 }
109
109
110 if (suggestion.value_type == 'user_group') {
110 if (suggestion.value_type == 'user_group') {
111 $.getJSON(
111 $.getJSON(
112 pyroutes.url('edit_user_group_members',
112 pyroutes.url('edit_user_group_members',
113 {'user_group_id': suggestion.id}),
113 {'user_group_id': suggestion.id}),
114 function(data) {
114 function(data) {
115 var uids = [];
115 var uids = [];
116 $.each(data.members, function(idx, user) {
116 $.each(data.members, function(idx, user) {
117 var userid = user[0],
117 var userid = user[0],
118 username = user[1];
118 username = user[1];
119 uids.push(userid.toString());
119 uids.push(userid.toString());
120 });
120 });
121 preSelectUserIds(uids)
121 preSelectUserIds(uids)
122 }
122 }
123 );
123 );
124 } else if (suggestion.value_type == 'user') {
124 } else if (suggestion.value_type == 'user') {
125 preSelectUserIds([suggestion.id.toString()]);
125 preSelectUserIds([suggestion.id.toString()]);
126 }
126 }
127 }
127 }
128 });
128 });
129 UsersAutoComplete('user', '${c.rhodecode_user.user_id}');
129 UsersAutoComplete('user', '${c.rhodecode_user.user_id}');
130 })
130 })
131 </script>
131 </script>
General Comments 0
You need to be logged in to leave comments. Login now