##// END OF EJS Templates
repositories: preserve order of defined backends, and switched repo type selector to radios.
marcink -
r4321:711124f9 default
parent child Browse files
Show More
@@ -19,17 +19,20 b''
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 import os
21 import os
22 from collections import OrderedDict
23
22 import sys
24 import sys
23 import platform
25 import platform
24
26
25 VERSION = tuple(open(os.path.join(
27 VERSION = tuple(open(os.path.join(
26 os.path.dirname(__file__), 'VERSION')).read().split('.'))
28 os.path.dirname(__file__), 'VERSION')).read().split('.'))
27
29
28 BACKENDS = {
30 BACKENDS = OrderedDict()
29 'hg': 'Mercurial repository',
31
30 'git': 'Git repository',
32 BACKENDS['hg'] = 'Mercurial repository'
31 'svn': 'Subversion repository',
33 BACKENDS['git'] = 'Git repository'
32 }
34 BACKENDS['svn'] = 'Subversion repository'
35
33
36
34 CELERY_ENABLED = False
37 CELERY_ENABLED = False
35 CELERY_EAGER = False
38 CELERY_EAGER = False
@@ -60,10 +60,15 b' def load_pyramid_environment(global_conf'
60
60
61 load_rcextensions(root_path=settings_merged['here'])
61 load_rcextensions(root_path=settings_merged['here'])
62
62
63 # Limit backends to `vcs.backends` from configuration
63 # Limit backends to `vcs.backends` from configuration, and preserve the order
64 for alias in rhodecode.BACKENDS.keys():
64 for alias in rhodecode.BACKENDS.keys():
65 if alias not in settings['vcs.backends']:
65 if alias not in settings['vcs.backends']:
66 del rhodecode.BACKENDS[alias]
66 del rhodecode.BACKENDS[alias]
67
68 def sorter(item):
69 return settings['vcs.backends'].index(item[0])
70 rhodecode.BACKENDS = rhodecode.OrderedDict(sorted(rhodecode.BACKENDS.items(), key=sorter))
71
67 log.info('Enabled VCS backends: %s', rhodecode.BACKENDS.keys())
72 log.info('Enabled VCS backends: %s', rhodecode.BACKENDS.keys())
68
73
69 # initialize vcs client and optionally run the server if enabled
74 # initialize vcs client and optionally run the server if enabled
@@ -437,7 +437,7 b' def attach_context_attributes(context, r'
437
437
438 context.csrf_token = csrf_token
438 context.csrf_token = csrf_token
439 context.backends = rhodecode.BACKENDS.keys()
439 context.backends = rhodecode.BACKENDS.keys()
440 context.backends.sort()
440
441 unread_count = 0
441 unread_count = 0
442 user_bookmark_list = []
442 user_bookmark_list = []
443 if user_id:
443 if user_id:
@@ -402,3 +402,10 b' input.input-valuedisplay {'
402 }
402 }
403 }
403 }
404 }
404 }
405
406 .repo-type-radio input {
407 margin: 0 0 0 0
408 }
409 .repo-type-radio label {
410 padding-right: 15px;
411 }
@@ -52,12 +52,29 b''
52 <span class="help-block">${_('Optionally select a group to put this repository into.')}</span>
52 <span class="help-block">${_('Optionally select a group to put this repository into.')}</span>
53 </div>
53 </div>
54 </div>
54 </div>
55
55 <div class="field">
56 <div class="field">
56 <div class="label">
57 <div class="label">
57 <label for="repo_type">${_('Type')}:</label>
58 <label for="repo_type">${_('Type')}:</label>
58 </div>
59 </div>
59 <div class="select">
60 <div class="fields repo-type-radio">
60 ${h.select('repo_type','hg',c.backends)}
61
62
63 % for backend in c.backends:
64 % if loop.index == 0:
65 <input id="repo_type_${backend}" name="repo_type" type="radio" value="${backend}" checked="checked"/>
66 % else:
67 <input id="repo_type_${backend}" name="repo_type" type="radio" value="${backend}" />
68 % endif
69
70 <label for="repo_type_${backend}">
71 <i class="icon-${backend}" style="font-size: 16px"></i>
72 ${backend.upper()}
73 </label>
74
75 % endfor
76
77
61 <span class="help-block">${_('Set the type of repository to create.')}</span>
78 <span class="help-block">${_('Set the type of repository to create.')}</span>
62 </div>
79 </div>
63 </div>
80 </div>
General Comments 0
You need to be logged in to leave comments. Login now