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