##// END OF EJS Templates
fix(svn-configs): cleanup code and fixed generate config on repo settings page which should not be visible
super-admin -
r5395:c07fca24 default
parent child Browse files
Show More
@@ -32,7 +32,7 b' from pyramid.response import Response'
32
32
33 from rhodecode.apps._base import BaseAppView
33 from rhodecode.apps._base import BaseAppView
34 from rhodecode.apps._base.navigation import navigation_list
34 from rhodecode.apps._base.navigation import navigation_list
35 from rhodecode.apps.svn_support.config_keys import generate_config
35 from rhodecode.apps.svn_support import config_keys
36 from rhodecode.lib import helpers as h
36 from rhodecode.lib import helpers as h
37 from rhodecode.lib.auth import (
37 from rhodecode.lib.auth import (
38 LoginRequired, HasPermissionAllDecorator, CSRFRequired)
38 LoginRequired, HasPermissionAllDecorator, CSRFRequired)
@@ -113,10 +113,8 b' class AdminSettingsView(BaseAppView):'
113 model = VcsSettingsModel()
113 model = VcsSettingsModel()
114 c.svn_branch_patterns = model.get_global_svn_branch_patterns()
114 c.svn_branch_patterns = model.get_global_svn_branch_patterns()
115 c.svn_tag_patterns = model.get_global_svn_tag_patterns()
115 c.svn_tag_patterns = model.get_global_svn_tag_patterns()
116
116 c.svn_generate_config = rhodecode.ConfigGet().get_bool(config_keys.generate_config)
117 settings = self.request.registry.settings
117 c.svn_config_path = rhodecode.ConfigGet().get_str(config_keys.config_file_path)
118 c.svn_generate_config = settings[generate_config]
119 c.svn_config_path = rhodecode.ConfigGet().get_str('svn.proxy.config_file_path')
120 defaults = self._form_defaults()
118 defaults = self._form_defaults()
121
119
122 model.create_largeobjects_dirs_if_needed(defaults['paths_root_path'])
120 model.create_largeobjects_dirs_if_needed(defaults['paths_root_path'])
@@ -143,9 +141,8 b' class AdminSettingsView(BaseAppView):'
143 c.svn_branch_patterns = model.get_global_svn_branch_patterns()
141 c.svn_branch_patterns = model.get_global_svn_branch_patterns()
144 c.svn_tag_patterns = model.get_global_svn_tag_patterns()
142 c.svn_tag_patterns = model.get_global_svn_tag_patterns()
145
143
146 settings = self.request.registry.settings
144 c.svn_generate_config = rhodecode.ConfigGet().get_bool(config_keys.generate_config)
147 c.svn_generate_config = settings[generate_config]
145 c.svn_config_path = rhodecode.ConfigGet().get_str(config_keys.config_file_path)
148 c.svn_config_path = rhodecode.ConfigGet().get_str('svn.proxy.config_file_path')
149 application_form = ApplicationUiSettingsForm(self.request.translate)()
146 application_form = ApplicationUiSettingsForm(self.request.translate)()
150
147
151 try:
148 try:
@@ -24,7 +24,9 b' from pyramid.httpexceptions import HTTPF'
24 from pyramid.response import Response
24 from pyramid.response import Response
25 from pyramid.renderers import render
25 from pyramid.renderers import render
26
26
27 import rhodecode
27 from rhodecode.apps._base import RepoAppView
28 from rhodecode.apps._base import RepoAppView
29 from rhodecode.apps.svn_support import config_keys
28 from rhodecode.lib import helpers as h
30 from rhodecode.lib import helpers as h
29 from rhodecode.lib.auth import (
31 from rhodecode.lib.auth import (
30 LoginRequired, HasRepoPermissionAnyDecorator, CSRFRequired)
32 LoginRequired, HasRepoPermissionAnyDecorator, CSRFRequired)
@@ -38,8 +40,6 b' log = logging.getLogger(__name__)'
38 class RepoSettingsVcsView(RepoAppView):
40 class RepoSettingsVcsView(RepoAppView):
39 def load_default_context(self):
41 def load_default_context(self):
40 c = self._get_local_tmpl_context()
42 c = self._get_local_tmpl_context()
41
42
43 return c
43 return c
44
44
45 def _vcs_form_defaults(self, repo_name):
45 def _vcs_form_defaults(self, repo_name):
@@ -77,6 +77,9 b' class RepoSettingsVcsView(RepoAppView):'
77 c.svn_branch_patterns = model.get_repo_svn_branch_patterns()
77 c.svn_branch_patterns = model.get_repo_svn_branch_patterns()
78 c.svn_tag_patterns = model.get_repo_svn_tag_patterns()
78 c.svn_tag_patterns = model.get_repo_svn_tag_patterns()
79
79
80 c.svn_generate_config = rhodecode.ConfigGet().get_bool(config_keys.generate_config)
81 c.svn_config_path = rhodecode.ConfigGet().get_str(config_keys.config_file_path)
82
80 defaults = self._vcs_form_defaults(self.db_repo_name)
83 defaults = self._vcs_form_defaults(self.db_repo_name)
81 c.inherit_global_settings = defaults['inherit_global_settings']
84 c.inherit_global_settings = defaults['inherit_global_settings']
82
85
@@ -103,6 +106,8 b' class RepoSettingsVcsView(RepoAppView):'
103 c.global_svn_tag_patterns = model.get_global_svn_tag_patterns()
106 c.global_svn_tag_patterns = model.get_global_svn_tag_patterns()
104 c.svn_branch_patterns = model.get_repo_svn_branch_patterns()
107 c.svn_branch_patterns = model.get_repo_svn_branch_patterns()
105 c.svn_tag_patterns = model.get_repo_svn_tag_patterns()
108 c.svn_tag_patterns = model.get_repo_svn_tag_patterns()
109 c.svn_generate_config = rhodecode.ConfigGet().get_bool(config_keys.generate_config)
110 c.svn_config_path = rhodecode.ConfigGet().get_str(config_keys.config_file_path)
106
111
107 defaults = self._vcs_form_defaults(self.db_repo_name)
112 defaults = self._vcs_form_defaults(self.db_repo_name)
108 c.inherit_global_settings = defaults['inherit_global_settings']
113 c.inherit_global_settings = defaults['inherit_global_settings']
@@ -49,16 +49,5 b''
49 unlockpath();
49 unlockpath();
50 }
50 }
51
51
52 /* On click handler for the `Generate Apache Config` button. It sends a
53 POST request to trigger the (re)generation of the mod_dav_svn config. */
54 $('#vcs_svn_generate_cfg').on('click', function(event) {
55 event.preventDefault();
56 var url = "${h.route_path('admin_settings_vcs_svn_generate_cfg')}";
57 var jqxhr = $.post(url, {'csrf_token': CSRF_TOKEN});
58 jqxhr.done(function(data) {
59 $.Topic('/notifications').publish(data);
60 });
61 });
62
63 });
52 });
64 </script>
53 </script>
@@ -148,6 +148,7 b''
148 <h3 class="panel-title">${_('Subversion Settings')}<a class="permalink" href="#vcs-svn-options"> ΒΆ</a></h3>
148 <h3 class="panel-title">${_('Subversion Settings')}<a class="permalink" href="#vcs-svn-options"> ΒΆ</a></h3>
149 </div>
149 </div>
150 <div class="panel-body">
150 <div class="panel-body">
151 % if display_globals:
151 <div class="field">
152 <div class="field">
152 <div class="content" >
153 <div class="content" >
153 <label>${_('mod_dav config')}</label><br/>
154 <label>${_('mod_dav config')}</label><br/>
@@ -164,6 +165,7 b''
164 % endif
165 % endif
165 </div>
166 </div>
166 </div>
167 </div>
168 % endif
167
169
168 <div class="field">
170 <div class="field">
169 <div class="content" >
171 <div class="content" >
@@ -324,5 +326,22 b''
324 ## </div>
326 ## </div>
325 ## % endif
327 ## % endif
326
328
329 <script type="text/javascript">
327
330
331 $(document).ready(function() {
332 /* On click handler for the `Generate Apache Config` button. It sends a
333 POST request to trigger the (re)generation of the mod_dav_svn config. */
334 $('#vcs_svn_generate_cfg').on('click', function(event) {
335 event.preventDefault();
336 alert('i cliked it !!')
337 var url = "${h.route_path('admin_settings_vcs_svn_generate_cfg')}";
338 var jqxhr = $.post(url, {'csrf_token': CSRF_TOKEN});
339 jqxhr.done(function(data) {
340 $.Topic('/notifications').publish(data);
341 });
342 });
343 });
344
345 </script>
328 </%def>
346 </%def>
347
General Comments 0
You need to be logged in to leave comments. Login now