Show More
@@ -23,7 +23,7 b'' | |||||
23 | <div id="results" style="display:none; padding: 10px 0px;"></div> |
|
23 | <div id="results" style="display:none; padding: 10px 0px;"></div> | |
24 |
|
24 | |||
25 | <div class="buttons"> |
|
25 | <div class="buttons"> | |
26 | <button class="btn btn-small btn-primary" onclick="checkCommits();return false"> |
|
26 | <button id="strip_action" class="btn btn-small btn-primary" onclick="checkCommits();return false"> | |
27 | ${_('Check commits')} |
|
27 | ${_('Check commits')} | |
28 | </button> |
|
28 | </button> | |
29 | </div> |
|
29 | </div> | |
@@ -111,27 +111,49 b' checkCommits = function() {' | |||||
111 | $('#results').show(); |
|
111 | $('#results').show(); | |
112 | $('#results').html('<h4>${_('Checking commits')}...</h4>'); |
|
112 | $('#results').html('<h4>${_('Checking commits')}...</h4>'); | |
113 | var url = "${h.route_path('strip_check', repo_name=c.repo_info.repo_name)}"; |
|
113 | var url = "${h.route_path('strip_check', repo_name=c.repo_info.repo_name)}"; | |
114 |
var btn = $(' |
|
114 | var btn = $('#strip_action'); | |
115 | btn.attr('disabled', 'disabled'); |
|
115 | btn.attr('disabled', 'disabled'); | |
116 | btn.addClass('disabled'); |
|
116 | btn.addClass('disabled'); | |
117 |
|
117 | |||
118 | var success = function (data) { |
|
118 | var success = function (data) { | |
119 | result_data = {}; |
|
119 | result_data = {}; | |
120 | var i = 0; |
|
120 | var i = 0; | |
121 | result =''; |
|
121 | var result = '<ol>'; | |
122 | $.each(data, function(index, value){ |
|
122 | $.each(data, function(index, value){ | |
123 | i= index; |
|
123 | i= index; | |
124 | var box = $('#box-'+index); |
|
124 | var box = $('#box-'+index); | |
125 | if (value.rev){ |
|
125 | if (value.rev){ | |
126 | result_data[index] = JSON.stringify(value); |
|
126 | result_data[index] = JSON.stringify(value); | |
127 | msg = '${_("author")}: ' + value.author + ' ${_("comment")}: ' + value.comment; |
|
127 | ||
128 | result += '<h4><code>' +value.rev+ '</code>${_(' commit verified positive')}</br> '+ msg + '</h4>'; |
|
128 | var verifiedHtml = ( | |
|
129 | '<li style="line-height:1.2em">' + | |||
|
130 | '<code>{0}</code>' + | |||
|
131 | '{1}' + | |||
|
132 | '<div style="white-space:pre">' + | |||
|
133 | 'author: {2}\n' + | |||
|
134 | 'description: {3}' + | |||
|
135 | '</div>' + | |||
|
136 | '</li>').format( | |||
|
137 | value.rev, | |||
|
138 | "${_(' commit verified positive')}", | |||
|
139 | value.author, value.comment | |||
|
140 | ); | |||
|
141 | result += verifiedHtml; | |||
129 | } |
|
142 | } | |
130 | else{ |
|
143 | else { | |
131 | result += '<h4><code>' +value.commit+ '</code>${_(' commit verified negative')}' + '</h4>'; |
|
144 | var verifiedHtml = ( | |
|
145 | '<li style="line-height:1.2em">' + | |||
|
146 | '<code><strike>{0}</strike></code>' + | |||
|
147 | '{1}' + | |||
|
148 | '</li>').format( | |||
|
149 | value.commit, | |||
|
150 | "${_(' commit verified negative')}" | |||
|
151 | ); | |||
|
152 | result += verifiedHtml; | |||
132 | } |
|
153 | } | |
133 | box.remove(); |
|
154 | box.remove(); | |
134 | }); |
|
155 | }); | |
|
156 | result += '</ol>'; | |||
135 | var box = $('#box-'+(parseInt(i)+1)); |
|
157 | var box = $('#box-'+(parseInt(i)+1)); | |
136 | box.remove(); |
|
158 | box.remove(); | |
137 | $('#results').html(result); |
|
159 | $('#results').html(result); | |
@@ -147,22 +169,25 b' checkCommits = function() {' | |||||
147 | strip = function(){ |
|
169 | strip = function() { | |
148 | var url = "${h.route_path('strip_execute', repo_name=c.repo_info.repo_name)}"; |
|
170 | var url = "${h.route_path('strip_execute', repo_name=c.repo_info.repo_name)}"; | |
149 | var success = function(data){ |
|
171 | var success = function(data) { | |
150 | result = ''; |
|
172 | var result = '<h4>Strip executed</h4><ol>'; | |
151 | $.each(data, function(index, value){ |
|
173 | $.each(data, function(index, value){ | |
152 | if(data[index]){ |
|
174 | if(data[index]) { | |
153 |
result += '< |
|
175 | result += '<li><code>' +index+ '</code> ${_(' commit striped successfully')}' + '</li>'; | |
154 | } |
|
176 | } | |
155 | else{ |
|
177 | else { | |
156 |
result += '< |
|
178 | result += '<li><code>' +index+ '</code> ${_(' commit strip failed')}' + '</li>'; | |
157 | } |
|
179 | } | |
158 | }); |
|
180 | }); | |
|
181 | if ($.isEmptyObject(data)) { | |||
|
182 | result += '<li>Nothing done...</li>' | |||
|
183 | } | |||
|
184 | result += '</ol>'; | |||
159 | $('#results').html(result); |
|
185 | $('#results').html(result); | |
160 |
|
186 | |||
161 | }; |
|
187 | }; | |
162 | ajaxPOST(url, result_data, success, null); |
|
188 | ajaxPOST(url, result_data, success, null); | |
163 |
var btn = $(' |
|
189 | var btn = $('#strip_action'); | |
164 | btn.attr('disabled', 'disabled'); |
|
190 | btn.remove(); | |
165 | btn.addClass('disabled'); |
|
|||
166 |
|
191 | |||
167 | }; |
|
192 | }; | |
168 | </script> |
|
193 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now