##// END OF EJS Templates
api: allow uncached content fetching....
api: allow uncached content fetching. - this is mostly to optimize for memory of indexer

File last commit:

r2105:4ad1a937 default
r3479:58288c09 default
Show More
repo_edit_strip.mako
197 lines | 7.0 KiB | application/x-mako | MakoHtmlLexer
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 <div class="panel panel-default">
<div class="panel-heading">
strip: ui changes....
r1589 <h3 class="panel-title">${_('Strip commits from repository')}</h3>
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 </div>
<div class="panel-body">
apps: removed deprecated usage of c.repo_info
r2081 %if c.rhodecode_db_repo.repo_type != 'svn':
strip: ui changes....
r1589 <h4>${_('Please provide up to %d commits commits to strip') % c.strip_limit}</h4>
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 <p>
${_('In the first step commits will be verified for existance in the repository')}. </br>
${_('In the second step, correct commits will be available for stripping')}.
</p>
forms: unified usage of h.secure_form. Make sure we ALWAYS pass in...
r2105 ${h.secure_form(h.route_path('strip_check', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 <div id="change_body" class="field">
<div id="box-1" class="inputx locked_input">
strip: ui changes....
r1589 <input class="text" id="changeset_id-1" name="changeset_id-1" size="59"
placeholder="${_('Enter full 40 character commit sha')}" type="text" value="">
<div id="plus_icon-1" class="btn btn-default plus_input_button" onclick="addNew(1);return false">
<i class="icon-plus">${_('Add another commit')}</i>
</div>
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 </div>
</div>
strip: ui changes....
r1589
<div id="results" style="display:none; padding: 10px 0px;"></div>
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 <div class="buttons">
strip: improved html output....
r1662 <button id="strip_action" class="btn btn-small btn-primary" onclick="checkCommits();return false">
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 ${_('Check commits')}
</button>
</div>
${h.end_form()}
%else:
strip: ui changes....
r1589 <h4>${_('Sorry this functionality is not available for SVN repository')}</h4>
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 %endif
</div>
</div>
<script>
var plus_leaf = 1;
addNew = function(number){
if (number >= ${c.strip_limit}){
return;
}
Bartłomiej Wołyńczyk
strip: cleaning code, plus fixing changes after switch from <i/> to <div/>
r1605 var minus = '<i class="icon-minus">${_('Remove')}</i>';
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 $('#plus_icon-'+number).detach();
number++;
strip: ui changes....
r1589
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 var input = '<div id="box-'+number+'" class="inputx locked_input">'+
Bartłomiej Wołyńczyk
strip: cleaning code, plus fixing changes after switch from <i/> to <div/>
r1605 '<input class="text" id="changeset_id-'+number+'" name="changeset_id-'+number+'" size="59" type="text" value=""' +
'placeholder="${_('Enter full 40 character commit sha')}">'+
strip: ui changes....
r1589 '<div id="plus_icon-'+number+'" class="btn btn-default plus_input_button" onclick="addNew('+number+');return false">'+
Bartłomiej Wołyńczyk
strip: cleaning code, plus fixing changes after switch from <i/> to <div/>
r1605 '<i class="icon-plus">${_('Add another commit')}</i>'+
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 '</div>'+
strip: ui changes....
r1589 '<div id="minus_icon-'+number+'" class="btn btn-default minus_input_button" onclick="delOld('+(number)+');return false">'+
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 minus +
'</div>' +
'</div>';
$('#change_body').append(input);
plus_leaf++;
strip: cleanup JS code.
r1588 };
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587
strip: cleanup JS code.
r1588 reIndex = function(number){
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 for(var i=number;i<=plus_leaf;i++){
var check = $('#box-'+i);
if (check.length == 0){
var change = $('#box-'+(i+1));
change.attr('id','box-'+i);
var plus = $('#plus_icon-'+(i+1));
Bartłomiej Wołyńczyk
strip: cleaning code, plus fixing changes after switch from <i/> to <div/>
r1605
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 if (plus.length != 0){
plus.attr('id','plus_icon-'+i);
Bartłomiej Wołyńczyk
strip: cleaning code, plus fixing changes after switch from <i/> to <div/>
r1605 plus.attr('onclick','addNew('+i+');return false');
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 plus_leaf--;
}
var minus = $('#minus_icon-'+(i+1));
Bartłomiej Wołyńczyk
strip: cleaning code, plus fixing changes after switch from <i/> to <div/>
r1605
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 minus.attr('id','minus_icon-'+i);
Bartłomiej Wołyńczyk
strip: cleaning code, plus fixing changes after switch from <i/> to <div/>
r1605
minus.attr('onclick','delOld('+i+');re' +
'turn false');
var input = $('input#changeset_id-'+(i+1));
input.attr('name','changeset_id-'+i);
input.attr('id','changeset_id-'+i);
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 }
}
strip: cleanup JS code.
r1588 };
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587
delOld = function(number){
$('#box-'+number).remove();
number = number - 1;
var box = $('#box-'+number);
strip: ui changes....
r1589 var plus = '<div id="plus_icon-'+number+'" class="btn btn-default plus_input_button" onclick="addNew('+number +');return false">'+
'<i id="i_plus_icon-'+number+'" class="icon-plus">${_('Add another commit')}</i></div>';
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 var minus = $('#minus_icon-'+number);
if(number +1 == plus_leaf){
minus.detach();
box.append(plus);
box.append(minus);
Bartłomiej Wołyńczyk
strip: fix js bug
r1604 plus_leaf --;
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 }
strip: cleanup JS code.
r1588 reIndex(number+1);
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587
strip: cleanup JS code.
r1588 };
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587
security: added missing csrf checks in few missing views.
r1811 var resultData = {
'csrf_token': CSRF_TOKEN
};
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587
strip: cleanup JS code.
r1588 checkCommits = function() {
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 var postData = $('form').serialize();
$('#results').show();
$('#results').html('<h4>${_('Checking commits')}...</h4>');
apps: removed deprecated usage of c.repo_info
r2081 var url = "${h.route_path('strip_check', repo_name=c.rhodecode_db_repo.repo_name)}";
strip: improved html output....
r1662 var btn = $('#strip_action');
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 btn.attr('disabled', 'disabled');
btn.addClass('disabled');
var success = function (data) {
security: added missing csrf checks in few missing views.
r1811 resultData = {
'csrf_token': CSRF_TOKEN
};
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 var i = 0;
strip: improved html output....
r1662 var result = '<ol>';
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 $.each(data, function(index, value){
i= index;
var box = $('#box-'+index);
if (value.rev){
security: added missing csrf checks in few missing views.
r1811 resultData[index] = JSON.stringify(value);
strip: improved html output....
r1662
var verifiedHtml = (
'<li style="line-height:1.2em">' +
'<code>{0}</code>' +
'{1}' +
'<div style="white-space:pre">' +
'author: {2}\n' +
'description: {3}' +
'</div>' +
'</li>').format(
value.rev,
"${_(' commit verified positive')}",
value.author, value.comment
);
result += verifiedHtml;
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 }
strip: improved html output....
r1662 else {
var verifiedHtml = (
'<li style="line-height:1.2em">' +
'<code><strike>{0}</strike></code>' +
'{1}' +
'</li>').format(
value.commit,
"${_(' commit verified negative')}"
);
result += verifiedHtml;
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 }
box.remove();
});
strip: improved html output....
r1662 result += '</ol>';
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 var box = $('#box-'+(parseInt(i)+1));
box.remove();
$('#results').html(result);
};
btn.html('Strip');
btn.removeAttr('disabled');
btn.removeClass('disabled');
btn.attr('onclick','strip();return false;');
ajaxPOST(url, postData, success, null);
};
strip: improved html output....
r1662 strip = function() {
apps: removed deprecated usage of c.repo_info
r2081 var url = "${h.route_path('strip_execute', repo_name=c.rhodecode_db_repo.repo_name)}";
strip: improved html output....
r1662 var success = function(data) {
var result = '<h4>Strip executed</h4><ol>';
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 $.each(data, function(index, value){
strip: improved html output....
r1662 if(data[index]) {
result += '<li><code>' +index+ '</code> ${_(' commit striped successfully')}' + '</li>';
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 }
strip: improved html output....
r1662 else {
result += '<li><code>' +index+ '</code> ${_(' commit strip failed')}' + '</li>';
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 }
});
strip: improved html output....
r1662 if ($.isEmptyObject(data)) {
result += '<li>Nothing done...</li>'
}
result += '</ol>';
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587 $('#results').html(result);
};
security: added missing csrf checks in few missing views.
r1811 ajaxPOST(url, resultData, success, null);
strip: improved html output....
r1662 var btn = $('#strip_action');
btn.remove();
Bartłomiej Wołyńczyk
strip: added functionality to stip choosen commits on repo settings
r1587
};
</script>