# HG changeset patch # User Marcin Kuzminski # Date 2017-04-18 22:48:45 # Node ID db3a7961b5d3e3a8b77060891a4959d7abd1f397 # Parent 079b2ef0f94c60e78721db020968391254229021 strip: improved html output. - consistent formatting - nicer messages on success/errors diff --git a/rhodecode/templates/admin/repos/repo_edit_strip.mako b/rhodecode/templates/admin/repos/repo_edit_strip.mako --- a/rhodecode/templates/admin/repos/repo_edit_strip.mako +++ b/rhodecode/templates/admin/repos/repo_edit_strip.mako @@ -23,7 +23,7 @@
-
@@ -111,27 +111,49 @@ checkCommits = function() { $('#results').show(); $('#results').html('

${_('Checking commits')}...

'); var url = "${h.route_path('strip_check', repo_name=c.repo_info.repo_name)}"; - var btn = $('button'); + var btn = $('#strip_action'); btn.attr('disabled', 'disabled'); btn.addClass('disabled'); var success = function (data) { result_data = {}; var i = 0; - result =''; + var result = '
    '; $.each(data, function(index, value){ i= index; var box = $('#box-'+index); if (value.rev){ result_data[index] = JSON.stringify(value); - msg = '${_("author")}: ' + value.author + ' ${_("comment")}: ' + value.comment; - result += '

    ' +value.rev+ '${_(' commit verified positive')}
    '+ msg + '

    '; + + var verifiedHtml = ( + '
  1. ' + + '{0}' + + '{1}' + + '
    ' + + 'author: {2}\n' + + 'description: {3}' + + '
    ' + + '
  2. ').format( + value.rev, + "${_(' commit verified positive')}", + value.author, value.comment + ); + result += verifiedHtml; } - else{ - result += '

    ' +value.commit+ '${_(' commit verified negative')}' + '

    '; + else { + var verifiedHtml = ( + '
  3. ' + + '{0}' + + '{1}' + + '
  4. ').format( + value.commit, + "${_(' commit verified negative')}" + ); + result += verifiedHtml; } box.remove(); }); + result += '
'; var box = $('#box-'+(parseInt(i)+1)); box.remove(); $('#results').html(result); @@ -144,25 +166,28 @@ checkCommits = function() { ajaxPOST(url, postData, success, null); }; -strip = function(){ +strip = function() { var url = "${h.route_path('strip_execute', repo_name=c.repo_info.repo_name)}"; - var success = function(data){ - result = ''; + var success = function(data) { + var result = '

Strip executed

    '; $.each(data, function(index, value){ - if(data[index]){ - result += '

    ' +index+ '${_(' commit striped successful')}' + '

    '; + if(data[index]) { + result += '
  1. ' +index+ ' ${_(' commit striped successfully')}' + '
  2. '; } - else{ - result += '

    ' +index+ '${_(' commit striped failed')}' + '

    '; + else { + result += '
  3. ' +index+ ' ${_(' commit strip failed')}' + '
  4. '; } }); + if ($.isEmptyObject(data)) { + result += '
  5. Nothing done...
  6. ' + } + result += '
'; $('#results').html(result); }; ajaxPOST(url, result_data, success, null); - var btn = $('button'); - btn.attr('disabled', 'disabled'); - btn.addClass('disabled'); + var btn = $('#strip_action'); + btn.remove(); };