##// END OF EJS Templates
personal-repo-group: update ui on auto-selecting the personal repo group on forks, edit/create repo
marcink -
r1100:0ad13d5b default
parent child Browse files
Show More
@@ -1,146 +1,148 b''
1 1 ## -*- coding: utf-8 -*-
2 2
3 3 ${h.secure_form(url('repos'))}
4 4 <div class="form">
5 5 <!-- fields -->
6 6 <div class="fields">
7 7 <div class="field">
8 8 <div class="label">
9 9 <label for="repo_name">${_('Name')}:</label>
10 10 </div>
11 11 <div class="input">
12 12 ${h.text('repo_name', class_="medium")}
13 13 <div class="info-block">
14 14 <a id="remote_clone_toggle" href="#"><i class="icon-download-alt"></i> ${_('Import Existing Repository ?')}</a>
15 15 </div>
16 16 %if not c.rhodecode_user.is_admin:
17 17 ${h.hidden('user_created',True)}
18 18 %endif
19 19 </div>
20 20 </div>
21 21 <div id="remote_clone" class="field" style="display: none;">
22 22 <div class="label">
23 23 <label for="clone_uri">${_('Clone from')}:</label>
24 24 </div>
25 25 <div class="input">
26 26 ${h.text('clone_uri', class_="medium")}
27 27 <span class="help-block">${_('Optional http[s] URL from which to clone a repository.')}</span>
28 28 </div>
29 29 </div>
30 30 <div class="field">
31 31 <div class="label">
32 32 <label for="repo_description">${_('Description')}:</label>
33 33 </div>
34 34 <div class="textarea editor">
35 35 ${h.textarea('repo_description')}
36 36 <span class="help-block">${_('Keep it short and to the point. Use a README file for longer descriptions.')}</span>
37 37 </div>
38 38 </div>
39 39 <div class="field">
40 40 <div class="label">
41 41 <label for="repo_group">${_('Repository Group')}:</label>
42 42 </div>
43 43 <div class="select">
44 44 ${h.select('repo_group',request.GET.get('parent_group'),c.repo_groups,class_="medium")}
45 %if c.personal_repo_group:
46 <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>
47 %endif
45 % if c.personal_repo_group:
46 <a class="btn" href="#" id="select_my_group" data-personal-group-id="${c.personal_repo_group.group_id}">
47 ${_('Select my personal group (%(repo_group_name)s)') % {'repo_group_name': c.personal_repo_group.group_name}}
48 </a>
49 % endif
48 50 <span class="help-block">${_('Optionally select a group to put this repository into.')}</span>
49 51 </div>
50 52 </div>
51 53 <div id="copy_perms" class="field">
52 54 <div class="label label-checkbox">
53 55 <label for="repo_copy_permissions">${_('Copy Parent Group Permissions')}:</label>
54 56 </div>
55 57 <div class="checkboxes">
56 58 ${h.checkbox('repo_copy_permissions', value="True", checked="checked")}
57 59 <span class="help-block">${_('Copy permission set from the parent repository group.')}</span>
58 60 </div>
59 61 </div>
60 62 <div class="field">
61 63 <div class="label">
62 64 <label for="repo_type">${_('Type')}:</label>
63 65 </div>
64 66 <div class="select">
65 67 ${h.select('repo_type','hg',c.backends)}
66 68 <span class="help-block">${_('Set the type of repository to create.')}</span>
67 69 </div>
68 70 </div>
69 71 <div class="field">
70 72 <div class="label">
71 73 <label for="repo_landing_rev">${_('Landing commit')}:</label>
72 74 </div>
73 75 <div class="select">
74 76 ${h.select('repo_landing_rev','',c.landing_revs,class_="medium")}
75 77 <span class="help-block">${_('The default commit for file pages, downloads, full text search index, and README generation.')}</span>
76 78 </div>
77 79 </div>
78 80 <div class="field">
79 81 <div class="label label-checkbox">
80 82 <label for="repo_private">${_('Private Repository')}:</label>
81 83 </div>
82 84 <div class="checkboxes">
83 85 ${h.checkbox('repo_private',value="True")}
84 86 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
85 87 </div>
86 88 </div>
87 89 <div class="buttons">
88 90 ${h.submit('save',_('Save'),class_="btn")}
89 91 </div>
90 92 </div>
91 93 </div>
92 94 <script>
93 95 $(document).ready(function(){
94 96 var setCopyPermsOption = function(group_val){
95 97 if(group_val != "-1"){
96 98 $('#copy_perms').show()
97 99 }
98 100 else{
99 101 $('#copy_perms').hide();
100 102 }
101 103 };
102 104
103 105 $('#remote_clone_toggle').on('click', function(e){
104 106 $('#remote_clone').show();
105 107 e.preventDefault();
106 108 });
107 109
108 110 if($('#remote_clone input').hasClass('error')){
109 111 $('#remote_clone').show();
110 112 }
111 113 if($('#remote_clone input').val()){
112 114 $('#remote_clone').show();
113 115 }
114 116
115 117 $("#repo_group").select2({
116 118 'containerCssClass': "drop-menu",
117 119 'dropdownCssClass': "drop-menu-dropdown",
118 120 'dropdownAutoWidth': true,
119 121 'width': "resolve"
120 122 });
121 123
122 124 setCopyPermsOption($('#repo_group').val());
123 125 $("#repo_group").on("change", function(e) {
124 126 setCopyPermsOption(e.val)
125 127 });
126 128
127 129 $("#repo_type").select2({
128 130 'containerCssClass': "drop-menu",
129 131 'dropdownCssClass': "drop-menu-dropdown",
130 132 'minimumResultsForSearch': -1,
131 133 });
132 134 $("#repo_landing_rev").select2({
133 135 'containerCssClass': "drop-menu",
134 136 'dropdownCssClass': "drop-menu-dropdown",
135 137 'minimumResultsForSearch': -1,
136 138 });
137 139 $('#repo_name').focus();
138 140
139 141 $('#select_my_group').on('click', function(e){
140 142 e.preventDefault();
141 143 $("#repo_group").val($(this).data('personalGroupId')).trigger("change");
142 144 })
143 145
144 146 })
145 147 </script>
146 148 ${h.end_form()}
@@ -1,238 +1,240 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%namespace name="base" file="/base/base.html"/>
3 3
4 4 <div class="panel panel-default">
5 5 <div class="panel-heading">
6 6 <h3 class="panel-title">${_('Settings for Repository: %s') % c.repo_info.repo_name}</h3>
7 7 </div>
8 8 <div class="panel-body">
9 9 ${h.secure_form(url('repo', repo_name=c.repo_info.repo_name),method='put')}
10 10 <div class="form">
11 11 <!-- fields -->
12 12 <div class="fields">
13 13 <div class="field">
14 14 <div class="label">
15 15 <label for="repo_name">${_('Name')}:</label>
16 16 </div>
17 17 <div class="input">
18 18 ${h.text('repo_name',class_="medium")}
19 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>
20 20 <p id="clone_id" style="display:none;">
21 21 ${_('URL by id')}: `${c.repo_info.clone_url(with_id=True)}` </br>
22 22 ${_('''In case this repository is renamed or moved into another group the repository url changes.
23 23 Using above url guarantees that this repository will always be accessible under such url.
24 24 Useful for CI systems, or any other cases that you need to hardcode the url into 3rd party service.''')}</p>
25 25 </div>
26 26 </div>
27 27 % if c.repo_info.repo_type != 'svn':
28 28 <div class="field">
29 29 <div class="label">
30 30 <label for="clone_uri">${_('Remote uri')}:</label>
31 31 </div>
32 32 <div class="input">
33 33 %if c.repo_info.clone_uri:
34 34 <div id="clone_uri_hidden" class='text-as-placeholder'>
35 35 <span id="clone_uri_hidden_value">${c.repo_info.clone_uri_hidden}</span>
36 36 <span class="link" id="edit_clone_uri"><i class="icon-edit"></i>${_('edit')}</span>
37 37 </div>
38 38 <div id="alter_clone_uri" style="display: none">
39 39 ${h.text('clone_uri',class_="medium", placeholder=_('new value, leave empty to remove'))}
40 40 ${h.hidden('clone_uri_change', 'OLD')}
41 41 <span class="link" id="cancel_edit_clone_uri">${_('cancel')}</span>
42 42 </div>
43 43 %else:
44 44 ## not set yet, display form to set it
45 45 ${h.text('clone_uri',class_="medium")}
46 46 ${h.hidden('clone_uri_change', 'NEW')}
47 47 %endif
48 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>
49 49 </div>
50 50 </div>
51 51 % else:
52 52 ${h.hidden('clone_uri', '')}
53 53 % endif
54 54 <div class="field">
55 55 <div class="label">
56 56 <label for="repo_group">${_('Repository group')}:</label>
57 57 </div>
58 58 <div class="select">
59 59 ${h.select('repo_group','',c.repo_groups,class_="medium")}
60 %if c.personal_repo_group:
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>
62 %endif
60 % if c.personal_repo_group:
61 <a class="btn" href="#" id="select_my_group" data-personal-group-id="${c.personal_repo_group.group_id}">
62 ${_('Select my personal group (%(repo_group_name)s)') % {'repo_group_name': c.personal_repo_group.group_name}}
63 </a>
64 % endif
63 65 <p class="help-block">${_('Optional select a group to put this repository into.')}</p>
64 66 </div>
65 67 </div>
66 68 <div class="field">
67 69 <div class="label">
68 70 <label for="repo_landing_rev">${_('Landing commit')}:</label>
69 71 </div>
70 72 <div class="select">
71 73 ${h.select('repo_landing_rev','',c.landing_revs,class_="medium")}
72 74 <p class="help-block">${_('Default commit for files page, downloads, whoosh and readme')}</p>
73 75 </div>
74 76 </div>
75 77
76 78 <div class="field badged-field">
77 79 <div class="label">
78 80 <label for="user">${_('Owner')}:</label>
79 81 </div>
80 82 <div class="input">
81 83 <div class="badge-input-container">
82 84 <div class="user-badge">
83 85 ${base.gravatar_with_user(c.repo_info.user.email, show_disabled=not c.repo_info.user.active)}
84 86 </div>
85 87 <div class="badge-input-wrap">
86 88 ${h.text('user', class_="medium", autocomplete="off")}
87 89 </div>
88 90 </div>
89 91 <form:error name="user"/>
90 92 <p class="help-block">${_('Change owner of this repository.')}</p>
91 93 </div>
92 94 </div>
93 95
94 96 <div class="field">
95 97 <div class="label label-textarea">
96 98 <label for="repo_description">${_('Description')}:</label>
97 99 </div>
98 100 <div class="textarea text-area editor">
99 101 ${h.textarea('repo_description', )}
100 102 <p class="help-block">${_('Keep it short and to the point. Use a README file for longer descriptions.')}</p>
101 103 </div>
102 104 </div>
103 105
104 106 <div class="field">
105 107 <div class="label label-checkbox">
106 108 <label for="repo_private">${_('Private repository')}:</label>
107 109 </div>
108 110 <div class="checkboxes">
109 111 ${h.checkbox('repo_private',value="True")}
110 112 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
111 113 </div>
112 114 </div>
113 115 <div class="field">
114 116 <div class="label label-checkbox">
115 117 <label for="repo_enable_statistics">${_('Enable statistics')}:</label>
116 118 </div>
117 119 <div class="checkboxes">
118 120 ${h.checkbox('repo_enable_statistics',value="True")}
119 121 <span class="help-block">${_('Enable statistics window on summary page.')}</span>
120 122 </div>
121 123 </div>
122 124 <div class="field">
123 125 <div class="label label-checkbox">
124 126 <label for="repo_enable_downloads">${_('Enable downloads')}:</label>
125 127 </div>
126 128 <div class="checkboxes">
127 129 ${h.checkbox('repo_enable_downloads',value="True")}
128 130 <span class="help-block">${_('Enable download menu on summary page.')}</span>
129 131 </div>
130 132 </div>
131 133 <div class="field">
132 134 <div class="label label-checkbox">
133 135 <label for="repo_enable_locking">${_('Enable automatic locking')}:</label>
134 136 </div>
135 137 <div class="checkboxes">
136 138 ${h.checkbox('repo_enable_locking',value="True")}
137 139 <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>
138 140 </div>
139 141 </div>
140 142
141 143 %if c.visual.repository_fields:
142 144 ## EXTRA FIELDS
143 145 %for field in c.repo_fields:
144 146 <div class="field">
145 147 <div class="label">
146 148 <label for="${field.field_key_prefixed}">${field.field_label} (${field.field_key}):</label>
147 149 </div>
148 150 <div class="input input-medium">
149 151 ${h.text(field.field_key_prefixed, field.field_value, class_='medium')}
150 152 %if field.field_desc:
151 153 <span class="help-block">${field.field_desc}</span>
152 154 %endif
153 155 </div>
154 156 </div>
155 157 %endfor
156 158 %endif
157 159 <div class="buttons">
158 160 ${h.submit('save',_('Save'),class_="btn")}
159 161 ${h.reset('reset',_('Reset'),class_="btn")}
160 162 </div>
161 163 </div>
162 164 </div>
163 165 ${h.end_form()}
164 166 </div>
165 167 </div>
166 168
167 169 <script>
168 170 $(document).ready(function(){
169 171 var select2Options = {
170 172 'containerCssClass': "drop-menu",
171 173 'dropdownCssClass': "drop-menu-dropdown",
172 174 'dropdownAutoWidth': true
173 175 };
174 176
175 177 var cloneUrl = function() {
176 178 var alterButton = $('#alter_clone_uri');
177 179 var editButton = $('#edit_clone_uri');
178 180 var cancelEditButton = $('#cancel_edit_clone_uri');
179 181 var hiddenUrl = $('#clone_uri_hidden');
180 182 var hiddenUrlValue = $('#clone_uri_hidden_value');
181 183 var input = $('#clone_uri');
182 184 var helpBlock = $('#alter_clone_uri_help_block');
183 185 var changedFlag = $('#clone_uri_change');
184 186 var originalText = helpBlock.html();
185 187 var obfuscatedUrl = hiddenUrlValue.html();
186 188
187 189 var edit = function(e) {
188 190 alterButton.show();
189 191 editButton.hide();
190 192 hiddenUrl.hide();
191 193
192 194 //add the old value next to input for verification
193 195 helpBlock.html("(" + obfuscatedUrl + ")" + "<br\>" + originalText);
194 196 changedFlag.val('MOD');
195 197 };
196 198
197 199 var cancelEdit = function(e) {
198 200 alterButton.hide();
199 201 editButton.show();
200 202 hiddenUrl.show();
201 203
202 204 helpBlock.html(originalText);
203 205 changedFlag.val('OLD');
204 206 input.val('');
205 207 };
206 208
207 209 var initEvents = function() {
208 210 editButton.on('click', edit);
209 211 cancelEditButton.on('click', cancelEdit);
210 212 };
211 213
212 214 var setInitialState = function() {
213 215 if (input.hasClass('error')) {
214 216 alterButton.show();
215 217 editButton.hide();
216 218 hiddenUrl.hide();
217 219 }
218 220 };
219 221
220 222 setInitialState();
221 223 initEvents();
222 224 }();
223 225
224 226 $('#show_more_clone_id').on('click', function(e){
225 227 $('#clone_id').show();
226 228 e.preventDefault();
227 229 });
228 230
229 231 $('#repo_landing_rev').select2(select2Options);
230 232 $('#repo_group').select2(select2Options);
231 233
232 234 UsersAutoComplete('user', '${c.rhodecode_user.user_id}');
233 235 $('#select_my_group').on('click', function(e){
234 236 e.preventDefault();
235 237 $("#repo_group").val($(this).data('personalGroupId')).trigger("change");
236 238 });
237 239 });
238 240 </script>
@@ -1,127 +1,129 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.html"/>
3 3
4 4 <%def name="title()">
5 5 ${_('Fork repository %s') % c.repo_name}
6 6 %if c.rhodecode_name:
7 7 &middot; ${h.branding(c.rhodecode_name)}
8 8 %endif
9 9 </%def>
10 10
11 11 <%def name="breadcrumbs_links()">
12 12 ${_('New Fork')}
13 13 </%def>
14 14
15 15 <%def name="menu_bar_nav()">
16 16 ${self.menu_items(active='repositories')}
17 17 </%def>
18 18
19 19 <%def name="menu_bar_subnav()">
20 20 ${self.repo_menu(active='options')}
21 21 </%def>
22 22
23 23 <%def name="main()">
24 24 <div class="box">
25 25 <div class="title">
26 26 ${self.repo_page_title(c.rhodecode_db_repo)}
27 27 ${self.breadcrumbs()}
28 28 </div>
29 29
30 30 ${h.secure_form(url('repo_fork_create_home',repo_name=c.repo_info.repo_name))}
31 31 <div class="form">
32 32 <!-- fields -->
33 33 <div class="fields">
34 34
35 35 <div class="field">
36 36 <div class="label">
37 37 <label for="repo_name">${_('Fork name')}:</label>
38 38 </div>
39 39 <div class="input">
40 40 ${h.text('repo_name', class_="medium")}
41 41 ${h.hidden('repo_type',c.repo_info.repo_type)}
42 42 ${h.hidden('fork_parent_id',c.repo_info.repo_id)}
43 43 </div>
44 44 </div>
45 45
46 46 <div class="field">
47 47 <div class="label label-textarea">
48 48 <label for="description">${_('Description')}:</label>
49 49 </div>
50 50 <div class="textarea-repo textarea text-area editor">
51 51 ${h.textarea('description')}
52 52 <span class="help-block">${_('Keep it short and to the point. Use a README file for longer descriptions.')}</span>
53 53 </div>
54 54 </div>
55 55
56 56 <div class="field">
57 57 <div class="label">
58 58 <label for="repo_group">${_('Repository group')}:</label>
59 59 </div>
60 60 <div class="select">
61 61 ${h.select('repo_group','',c.repo_groups,class_="medium")}
62 %if c.personal_repo_group:
63 <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>
64 %endif
62 % if c.personal_repo_group:
63 <a class="btn" href="#" id="select_my_group" data-personal-group-id="${c.personal_repo_group.group_id}">
64 ${_('Select my personal group (%(repo_group_name)s)') % {'repo_group_name': c.personal_repo_group.group_name}}
65 </a>
66 % endif
65 67 <span class="help-block">${_('Optionally select a group to put this repository into.')}</span>
66 68 </div>
67 69 </div>
68 70
69 71 <div class="field">
70 72 <div class="label">
71 73 <label for="landing_rev">${_('Landing commit')}:</label>
72 74 </div>
73 75 <div class="select">
74 76 ${h.select('landing_rev','',c.landing_revs,class_="medium")}
75 77 <span class="help-block">${_('Default commit for files page, downloads, whoosh and readme')}</span>
76 78 </div>
77 79 </div>
78 80
79 81 <div class="field">
80 82 <div class="label label-checkbox">
81 83 <label for="private">${_('Private')}:</label>
82 84 </div>
83 85 <div class="checkboxes">
84 86 ${h.checkbox('private',value="True")}
85 87 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
86 88 </div>
87 89 </div>
88 90
89 91 <div class="field">
90 92 <div class="label label-checkbox">
91 93 <label for="private">${_('Copy permissions')}:</label>
92 94 </div>
93 95 <div class="checkboxes">
94 96 ${h.checkbox('copy_permissions',value="True", checked="checked")}
95 97 <span class="help-block">${_('Copy permissions from forked repository')}</span>
96 98 </div>
97 99 </div>
98 100
99 101 <div class="buttons">
100 102 ${h.submit('',_('Fork this Repository'),class_="btn")}
101 103 </div>
102 104 </div>
103 105 </div>
104 106 ${h.end_form()}
105 107 </div>
106 108 <script>
107 109 $(document).ready(function(){
108 110 $("#repo_group").select2({
109 111 'dropdownAutoWidth': true,
110 112 'containerCssClass': "drop-menu",
111 113 'dropdownCssClass': "drop-menu-dropdown",
112 114 'width': "resolve"
113 115 });
114 116 $("#landing_rev").select2({
115 117 'containerCssClass': "drop-menu",
116 118 'dropdownCssClass': "drop-menu-dropdown",
117 119 'minimumResultsForSearch': -1
118 120 });
119 121 $('#repo_name').focus();
120 122
121 123 $('#select_my_group').on('click', function(e){
122 124 e.preventDefault();
123 125 $("#repo_group").val($(this).data('personalGroupId')).trigger("change");
124 126 })
125 127 })
126 128 </script>
127 129 </%def>
General Comments 0
You need to be logged in to leave comments. Login now