##// END OF EJS Templates
issue-tracker: link to proper documentation link.
marcink -
r1606:db41e32b default
parent child Browse files
Show More
@@ -1,219 +1,218 b''
1 ## snippet for displaying issue tracker settings
1 ## snippet for displaying issue tracker settings
2 ## usage:
2 ## usage:
3 ## <%namespace name="its" file="/base/issue_tracker_settings.mako"/>
3 ## <%namespace name="its" file="/base/issue_tracker_settings.mako"/>
4 ## ${its.issue_tracker_settings_table(patterns, form_url, delete_url)}
4 ## ${its.issue_tracker_settings_table(patterns, form_url, delete_url)}
5 ## ${its.issue_tracker_settings_test(test_url)}
5 ## ${its.issue_tracker_settings_test(test_url)}
6
6
7 <%def name="issue_tracker_settings_table(patterns, form_url, delete_url)">
7 <%def name="issue_tracker_settings_table(patterns, form_url, delete_url)">
8 <table class="rctable issuetracker">
8 <table class="rctable issuetracker">
9 <tr>
9 <tr>
10 <th>${_('Description')}</th>
10 <th>${_('Description')}</th>
11 <th>${_('Pattern')}</th>
11 <th>${_('Pattern')}</th>
12 <th>${_('Url')}</th>
12 <th>${_('Url')}</th>
13 <th>${_('Prefix')}</th>
13 <th>${_('Prefix')}</th>
14 <th ></th>
14 <th ></th>
15 </tr>
15 </tr>
16 <tr>
16 <tr>
17 <td class="td-description issue-tracker-example">Example</td>
17 <td class="td-description issue-tracker-example">Example</td>
18 <td class="td-regex issue-tracker-example">${'(?:#)(?P<issue_id>\d+)'}</td>
18 <td class="td-regex issue-tracker-example">${'(?:#)(?P<issue_id>\d+)'}</td>
19 <td class="td-url issue-tracker-example">${'https://myissueserver.com/${repo}/issue/${issue_id}'}</td>
19 <td class="td-url issue-tracker-example">${'https://myissueserver.com/${repo}/issue/${issue_id}'}</td>
20 <td class="td-prefix issue-tracker-example">#</td>
20 <td class="td-prefix issue-tracker-example">#</td>
21 ## TODO(skreft): add a link to the correct location of the Issue Tracker documentation.
21 <td class="issue-tracker-example"><a href="https://docs.rhodecode.com/RhodeCode-Enterprise/issue-trackers/issue-trackers.html" target="_blank">${_('Read more')}</a></td>
22 <td class="issue-tracker-example"><a href="https://rhodecode.com/docs" target="_blank">${_('Read more')}</a></td>
23 </tr>
22 </tr>
24 %for uid, entry in patterns:
23 %for uid, entry in patterns:
25 <tr id="entry_${uid}">
24 <tr id="entry_${uid}">
26 <td class="td-description issuetracker_desc">
25 <td class="td-description issuetracker_desc">
27 <span class="entry">
26 <span class="entry">
28 ${entry.desc}
27 ${entry.desc}
29 </span>
28 </span>
30 <span class="edit">
29 <span class="edit">
31 ${h.text('new_pattern_description_'+uid, class_='medium-inline', value=entry.desc or '')}
30 ${h.text('new_pattern_description_'+uid, class_='medium-inline', value=entry.desc or '')}
32 </span>
31 </span>
33 </td>
32 </td>
34 <td class="td-regex issuetracker_pat">
33 <td class="td-regex issuetracker_pat">
35 <span class="entry">
34 <span class="entry">
36 ${entry.pat}
35 ${entry.pat}
37 </span>
36 </span>
38 <span class="edit">
37 <span class="edit">
39 ${h.text('new_pattern_pattern_'+uid, class_='medium-inline', value=entry.pat or '')}
38 ${h.text('new_pattern_pattern_'+uid, class_='medium-inline', value=entry.pat or '')}
40 </span>
39 </span>
41 </td>
40 </td>
42 <td class="td-url issuetracker_url">
41 <td class="td-url issuetracker_url">
43 <span class="entry">
42 <span class="entry">
44 ${entry.url}
43 ${entry.url}
45 </span>
44 </span>
46 <span class="edit">
45 <span class="edit">
47 ${h.text('new_pattern_url_'+uid, class_='medium-inline', value=entry.url or '')}
46 ${h.text('new_pattern_url_'+uid, class_='medium-inline', value=entry.url or '')}
48 </span>
47 </span>
49 </td>
48 </td>
50 <td class="td-prefix issuetracker_pref">
49 <td class="td-prefix issuetracker_pref">
51 <span class="entry">
50 <span class="entry">
52 ${entry.pref}
51 ${entry.pref}
53 </span>
52 </span>
54 <span class="edit">
53 <span class="edit">
55 ${h.text('new_pattern_prefix_'+uid, class_='medium-inline', value=entry.pref or '')}
54 ${h.text('new_pattern_prefix_'+uid, class_='medium-inline', value=entry.pref or '')}
56 </span>
55 </span>
57 </td>
56 </td>
58 <td class="td-action">
57 <td class="td-action">
59 <div class="grid_edit">
58 <div class="grid_edit">
60 <span class="entry">
59 <span class="entry">
61 <a class="edit_issuetracker_entry" href="">${_('Edit')}</a>
60 <a class="edit_issuetracker_entry" href="">${_('Edit')}</a>
62 </span>
61 </span>
63 <span class="edit">
62 <span class="edit">
64 ${h.hidden('uid', uid)}
63 ${h.hidden('uid', uid)}
65 </span>
64 </span>
66 </div>
65 </div>
67 <div class="grid_delete">
66 <div class="grid_delete">
68 <span class="entry">
67 <span class="entry">
69 <a class="btn btn-link btn-danger delete_issuetracker_entry" data-desc="${entry.desc}" data-uid="${uid}">
68 <a class="btn btn-link btn-danger delete_issuetracker_entry" data-desc="${entry.desc}" data-uid="${uid}">
70 ${_('Delete')}
69 ${_('Delete')}
71 </a>
70 </a>
72 </span>
71 </span>
73 <span class="edit">
72 <span class="edit">
74 <a class="btn btn-link btn-danger edit_issuetracker_cancel" data-uid="${uid}">${_('Cancel')}</a>
73 <a class="btn btn-link btn-danger edit_issuetracker_cancel" data-uid="${uid}">${_('Cancel')}</a>
75 </span>
74 </span>
76 </div>
75 </div>
77 </td>
76 </td>
78 </tr>
77 </tr>
79 %endfor
78 %endfor
80 <tr id="last-row"></tr>
79 <tr id="last-row"></tr>
81 </table>
80 </table>
82 <p>
81 <p>
83 <a id="add_pattern" class="link">
82 <a id="add_pattern" class="link">
84 ${_('Add new')}
83 ${_('Add new')}
85 </a>
84 </a>
86 </p>
85 </p>
87
86
88 <script type="text/javascript">
87 <script type="text/javascript">
89 var newEntryLabel = $('label[for="new_entry"]');
88 var newEntryLabel = $('label[for="new_entry"]');
90
89
91 var resetEntry = function() {
90 var resetEntry = function() {
92 newEntryLabel.text("${_('New Entry')}:");
91 newEntryLabel.text("${_('New Entry')}:");
93 };
92 };
94
93
95 var delete_pattern = function(entry) {
94 var delete_pattern = function(entry) {
96 if (confirm("${_('Confirm to remove this pattern:')} "+$(entry).data('desc'))) {
95 if (confirm("${_('Confirm to remove this pattern:')} "+$(entry).data('desc'))) {
97 var request = $.ajax({
96 var request = $.ajax({
98 type: "POST",
97 type: "POST",
99 url: "${delete_url}",
98 url: "${delete_url}",
100 data: {
99 data: {
101 '_method': 'delete',
100 '_method': 'delete',
102 'csrf_token': CSRF_TOKEN,
101 'csrf_token': CSRF_TOKEN,
103 'uid':$(entry).data('uid')
102 'uid':$(entry).data('uid')
104 },
103 },
105 success: function(){
104 success: function(){
106 location.reload();
105 location.reload();
107 },
106 },
108 error: function(data, textStatus, errorThrown){
107 error: function(data, textStatus, errorThrown){
109 alert("Error while deleting entry.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(entry)[0].url));
108 alert("Error while deleting entry.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(entry)[0].url));
110 }
109 }
111 });
110 });
112 };
111 };
113 }
112 }
114
113
115 $('.delete_issuetracker_entry').on('click', function(e){
114 $('.delete_issuetracker_entry').on('click', function(e){
116 e.preventDefault();
115 e.preventDefault();
117 delete_pattern(this);
116 delete_pattern(this);
118 });
117 });
119
118
120 $('.edit_issuetracker_entry').on('click', function(e){
119 $('.edit_issuetracker_entry').on('click', function(e){
121 e.preventDefault();
120 e.preventDefault();
122 $(this).parents('tr').addClass('editopen');
121 $(this).parents('tr').addClass('editopen');
123 });
122 });
124
123
125 $('.edit_issuetracker_cancel').on('click', function(e){
124 $('.edit_issuetracker_cancel').on('click', function(e){
126 e.preventDefault();
125 e.preventDefault();
127 $(this).parents('tr').removeClass('editopen');
126 $(this).parents('tr').removeClass('editopen');
128 // Reset to original value
127 // Reset to original value
129 var uid = $(this).data('uid');
128 var uid = $(this).data('uid');
130 $('#'+uid+' input').each(function(e) {
129 $('#'+uid+' input').each(function(e) {
131 this.value = this.defaultValue;
130 this.value = this.defaultValue;
132 });
131 });
133 });
132 });
134
133
135 $('input#reset').on('click', function(e) {
134 $('input#reset').on('click', function(e) {
136 resetEntry();
135 resetEntry();
137 });
136 });
138
137
139 $('#add_pattern').on('click', function(e) {
138 $('#add_pattern').on('click', function(e) {
140 addNewPatternInput();
139 addNewPatternInput();
141 });
140 });
142 </script>
141 </script>
143 </%def>
142 </%def>
144
143
145 <%def name="issue_tracker_new_row()">
144 <%def name="issue_tracker_new_row()">
146 <table id="add-row-tmpl" style="display: none;">
145 <table id="add-row-tmpl" style="display: none;">
147 <tbody>
146 <tbody>
148 <tr class="new_pattern">
147 <tr class="new_pattern">
149 <td class="td-description issuetracker_desc">
148 <td class="td-description issuetracker_desc">
150 <span class="entry">
149 <span class="entry">
151 <input class="medium-inline" id="description_##UUID##" name="new_pattern_description_##UUID##" value="##DESCRIPTION##" type="text">
150 <input class="medium-inline" id="description_##UUID##" name="new_pattern_description_##UUID##" value="##DESCRIPTION##" type="text">
152 </span>
151 </span>
153 </td>
152 </td>
154 <td class="td-regex issuetracker_pat">
153 <td class="td-regex issuetracker_pat">
155 <span class="entry">
154 <span class="entry">
156 <input class="medium-inline" id="pattern_##UUID##" name="new_pattern_pattern_##UUID##" placeholder="Pattern"
155 <input class="medium-inline" id="pattern_##UUID##" name="new_pattern_pattern_##UUID##" placeholder="Pattern"
157 value="##PATTERN##" type="text">
156 value="##PATTERN##" type="text">
158 </span>
157 </span>
159 </td>
158 </td>
160 <td class="td-url issuetracker_url">
159 <td class="td-url issuetracker_url">
161 <span class="entry">
160 <span class="entry">
162 <input class="medium-inline" id="url_##UUID##" name="new_pattern_url_##UUID##" placeholder="Url" value="##URL##" type="text">
161 <input class="medium-inline" id="url_##UUID##" name="new_pattern_url_##UUID##" placeholder="Url" value="##URL##" type="text">
163 </span>
162 </span>
164 </td>
163 </td>
165 <td class="td-prefix issuetracker_pref">
164 <td class="td-prefix issuetracker_pref">
166 <span class="entry">
165 <span class="entry">
167 <input class="medium-inline" id="prefix_##UUID##" name="new_pattern_prefix_##UUID##" placeholder="Prefix" value="##PREFIX##" type="text">
166 <input class="medium-inline" id="prefix_##UUID##" name="new_pattern_prefix_##UUID##" placeholder="Prefix" value="##PREFIX##" type="text">
168 </span>
167 </span>
169 </td>
168 </td>
170 <td class="td-action">
169 <td class="td-action">
171 </td>
170 </td>
172 <input id="uid_##UUID##" name="uid_##UUID##" type="hidden" value="">
171 <input id="uid_##UUID##" name="uid_##UUID##" type="hidden" value="">
173 </tr>
172 </tr>
174 </tbody>
173 </tbody>
175 </table>
174 </table>
176 </%def>
175 </%def>
177
176
178 <%def name="issue_tracker_settings_test(test_url)">
177 <%def name="issue_tracker_settings_test(test_url)">
179 <div class="form-vertical">
178 <div class="form-vertical">
180 <div class="fields">
179 <div class="fields">
181 <div class="field">
180 <div class="field">
182 <div class='textarea-full'>
181 <div class='textarea-full'>
183 <textarea id="test_pattern_data" >
182 <textarea id="test_pattern_data" >
184 This commit fixes ticket #451.
183 This commit fixes ticket #451.
185 This is an example text for testing issue tracker patterns, add a pattern here and
184 This is an example text for testing issue tracker patterns, add a pattern here and
186 hit preview to see the link
185 hit preview to see the link
187 </textarea>
186 </textarea>
188 </div>
187 </div>
189 </div>
188 </div>
190 </div>
189 </div>
191 <div class="test_pattern_preview">
190 <div class="test_pattern_preview">
192 <div id="test_pattern" class="btn btn-small" >${_('Preview')}</div>
191 <div id="test_pattern" class="btn btn-small" >${_('Preview')}</div>
193 <p>${_('Test Pattern Preview')}</p>
192 <p>${_('Test Pattern Preview')}</p>
194 <div id="test_pattern_result"></div>
193 <div id="test_pattern_result"></div>
195 </div>
194 </div>
196 </div>
195 </div>
197
196
198 <script type="text/javascript">
197 <script type="text/javascript">
199 $('#test_pattern').on('click', function(e) {
198 $('#test_pattern').on('click', function(e) {
200 $.ajax({
199 $.ajax({
201 type: "POST",
200 type: "POST",
202 url: "${test_url}",
201 url: "${test_url}",
203 data: {
202 data: {
204 'test_text': $('#test_pattern_data').val(),
203 'test_text': $('#test_pattern_data').val(),
205 'csrf_token': CSRF_TOKEN
204 'csrf_token': CSRF_TOKEN
206 },
205 },
207 success: function(data){
206 success: function(data){
208 $('#test_pattern_result').html(data);
207 $('#test_pattern_result').html(data);
209 },
208 },
210 error: function(jqXHR, textStatus, errorThrown){
209 error: function(jqXHR, textStatus, errorThrown){
211 $('#test_pattern_result').html('Error: ' + errorThrown);
210 $('#test_pattern_result').html('Error: ' + errorThrown);
212 }
211 }
213 });
212 });
214 $('#test_pattern_result').show();
213 $('#test_pattern_result').show();
215 });
214 });
216 </script>
215 </script>
217 </%def>
216 </%def>
218
217
219
218
General Comments 0
You need to be logged in to leave comments. Login now