##// END OF EJS Templates
svn-support: Add js on click handler to trigger Apache config genreation....
Martin Bornhold -
r1014:86a8d5c9 default
parent child Browse files
Show More
@@ -1,54 +1,66 b''
1 <%namespace name="vcss" file="/base/vcs_settings.html"/>
1 <%namespace name="vcss" file="/base/vcs_settings.html"/>
2
2
3 ${h.secure_form(url('admin_settings_vcs'), method='post')}
3 ${h.secure_form(url('admin_settings_vcs'), method='post')}
4 <div>
4 <div>
5 ${vcss.vcs_settings_fields(
5 ${vcss.vcs_settings_fields(
6 suffix='',
6 suffix='',
7 svn_tag_patterns=c.svn_tag_patterns,
7 svn_tag_patterns=c.svn_tag_patterns,
8 svn_branch_patterns=c.svn_branch_patterns,
8 svn_branch_patterns=c.svn_branch_patterns,
9 display_globals=True,
9 display_globals=True,
10 allow_repo_location_change=c.visual.allow_repo_location_change
10 allow_repo_location_change=c.visual.allow_repo_location_change
11 )}
11 )}
12 <div class="buttons">
12 <div class="buttons">
13 ${h.submit('save',_('Save settings'),class_="btn")}
13 ${h.submit('save',_('Save settings'),class_="btn")}
14 ${h.reset('reset',_('Reset'),class_="btn")}
14 ${h.reset('reset',_('Reset'),class_="btn")}
15 </div>
15 </div>
16 </div>
16 </div>
17 ${h.end_form()}
17 ${h.end_form()}
18
18
19 <script type="text/javascript">
19 <script type="text/javascript">
20
20
21 function ajaxDeletePattern(pattern_id, field_id) {
21 function ajaxDeletePattern(pattern_id, field_id) {
22 var sUrl = "${h.url('admin_settings_vcs')}";
22 var sUrl = "${h.url('admin_settings_vcs')}";
23 var callback = function (o) {
23 var callback = function (o) {
24 var elem = $("#"+field_id);
24 var elem = $("#"+field_id);
25 elem.remove();
25 elem.remove();
26 };
26 };
27 var postData = {
27 var postData = {
28 '_method': 'delete',
28 '_method': 'delete',
29 'delete_svn_pattern': pattern_id,
29 'delete_svn_pattern': pattern_id,
30 'csrf_token': CSRF_TOKEN
30 'csrf_token': CSRF_TOKEN
31 };
31 };
32 var request = $.post(sUrl, postData)
32 var request = $.post(sUrl, postData)
33 .done(callback)
33 .done(callback)
34 .fail(function (data, textStatus, errorThrown) {
34 .fail(function (data, textStatus, errorThrown) {
35 alert("Error while deleting hooks.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(this)[0].url));
35 alert("Error while deleting hooks.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(this)[0].url));
36 });
36 });
37 };
37 };
38
38
39 $(document).ready(function() {
39 $(document).ready(function() {
40
40
41 var unlockpath = function() {
41 var unlockpath = function() {
42 $('#path_unlock_icon').removeClass('icon-lock').addClass('icon-unlock');
42 $('#path_unlock_icon').removeClass('icon-lock').addClass('icon-unlock');
43 $('#paths_root_path').removeAttr('readonly').removeClass('disabled');
43 $('#paths_root_path').removeAttr('readonly').removeClass('disabled');
44 };
44 };
45
45
46 $('#path_unlock').on('click', function(e) {
46 $('#path_unlock').on('click', function(e) {
47 unlockpath();
47 unlockpath();
48 });
48 });
49
49
50 if ($('.locked_input').children().hasClass('error-message')) {
50 if ($('.locked_input').children().hasClass('error-message')) {
51 unlockpath();
51 unlockpath();
52 }
52 }
53 })
53
54 /* On click handler for the `Generate Apache Config` button. It sends a
55 POST request to trigger the (re)generation of the mod_dav_svn config. */
56 $('#vcs_svn_generate_cfg').on('click', function(event) {
57 event.preventDefault();
58 var url = "${h.route_path('admin_settings_vcs_svn_generate_cfg')}";
59 var jqxhr = $.post(url, {'csrf_token': CSRF_TOKEN});
60 jqxhr.done(function(data) {
61 $.Topic('/notifications').publish(data);
62 });
63 });
64
65 });
54 </script>
66 </script>
General Comments 0
You need to be logged in to leave comments. Login now