Show More
@@ -406,7 +406,8 b' def bool2icon(value):' | |||
|
406 | 406 | |
|
407 | 407 | |
|
408 | 408 | def action_parser(user_log, feed=False): |
|
409 | """This helper will action_map the specified string action into translated | |
|
409 | """ | |
|
410 | This helper will action_map the specified string action into translated | |
|
410 | 411 | fancy names with icons and links |
|
411 | 412 | |
|
412 | 413 | :param user_log: user log instance |
@@ -424,63 +425,75 b' def action_parser(user_log, feed=False):' | |||
|
424 | 425 | def get_cs_links(): |
|
425 | 426 | revs_limit = 3 #display this amount always |
|
426 | 427 | revs_top_limit = 50 #show upto this amount of changesets hidden |
|
427 | revs = action_params.split(',') | |
|
428 | revs_ids = action_params.split(',') | |
|
428 | 429 | repo_name = user_log.repository.repo_name |
|
429 | 430 | |
|
430 | from rhodecode.model.scm import ScmModel | |
|
431 | 431 | repo = user_log.repository.scm_instance |
|
432 | 432 | |
|
433 |
message = lambda rev: |
|
|
434 | cs_links = [] | |
|
435 | cs_links.append(" " + ', '.join ([link_to(rev, | |
|
436 | url('changeset_home', | |
|
437 |
|
|
|
438 |
|
|
|
439 | class_='tooltip') for rev in revs[:revs_limit] ])) | |
|
433 | message = lambda rev: rev.message | |
|
434 | lnk = lambda rev, repo_name: ( | |
|
435 | link_to('r%s:%s' % (rev.revision, rev.short_id), | |
|
436 | url('changeset_home', repo_name=repo_name, | |
|
437 | revision=rev.raw_id), | |
|
438 | title=tooltip(message(rev)), class_='tooltip') | |
|
439 | ) | |
|
440 | # get only max revs_top_limit of changeset for performance/ui reasons | |
|
441 | revs = [ | |
|
442 | x for x in repo.get_changesets(revs_ids[0], | |
|
443 | revs_ids[:revs_top_limit][-1]) | |
|
444 | ] | |
|
440 | 445 | |
|
441 | compare_view = (' <div class="compare_view tooltip" title="%s">' | |
|
442 | '<a href="%s">%s</a> ' | |
|
443 | '</div>' % (_('Show all combined changesets %s->%s' \ | |
|
444 | % (revs[0], revs[-1])), | |
|
445 | url('changeset_home', repo_name=repo_name, | |
|
446 | revision='%s...%s' % (revs[0], revs[-1]) | |
|
447 | ), | |
|
448 | _('compare view')) | |
|
446 | cs_links = [] | |
|
447 | cs_links.append(" " + ', '.join( | |
|
448 | [lnk(rev, repo_name) for rev in revs[:revs_limit]] | |
|
449 | ) | |
|
449 | 450 | ) |
|
450 | 451 | |
|
451 | # if we have exactly one more than normally displayed: | |
|
452 | # just display it, takes less space than displaying "and 1 more revisions" | |
|
453 | if len(revs) == revs_limit + 1: | |
|
452 | compare_view = ( | |
|
453 | ' <div class="compare_view tooltip" title="%s">' | |
|
454 | '<a href="%s">%s</a> </div>' % ( | |
|
455 | _('Show all combined changesets %s->%s') % ( | |
|
456 | revs_ids[0], revs_ids[-1] | |
|
457 | ), | |
|
458 | url('changeset_home', repo_name=repo_name, | |
|
459 | revision='%s...%s' % (revs_ids[0], revs_ids[-1]) | |
|
460 | ), | |
|
461 | _('compare view') | |
|
462 | ) | |
|
463 | ) | |
|
464 | ||
|
465 | # if we have exactly one more than normally displayed | |
|
466 | # just display it, takes less space than displaying | |
|
467 | # "and 1 more revisions" | |
|
468 | if len(revs_ids) == revs_limit + 1: | |
|
454 | 469 | rev = revs[revs_limit] |
|
455 |
cs_links.append(", " + l |
|
|
456 | url('changeset_home', | |
|
457 | repo_name=repo_name, | |
|
458 | revision=rev), title=tooltip(message(rev)), | |
|
459 | class_='tooltip') ) | |
|
470 | cs_links.append(", " + lnk(rev, repo_name)) | |
|
460 | 471 | |
|
461 | 472 | # hidden-by-default ones |
|
462 | if len(revs) > revs_limit + 1: | |
|
463 | uniq_id = revs[0] | |
|
464 |
html_tmpl = ( |
|
|
465 |
'<a class="show_more" id="_%s" |
|
|
466 |
'%s</span>' |
|
|
473 | if len(revs_ids) > revs_limit + 1: | |
|
474 | uniq_id = revs_ids[0] | |
|
475 | html_tmpl = ( | |
|
476 | '<span> %s <a class="show_more" id="_%s" ' | |
|
477 | 'href="#more">%s</a> %s</span>' | |
|
478 | ) | |
|
467 | 479 | if not feed: |
|
468 |
cs_links.append(html_tmpl % ( |
|
|
469 | % (len(revs) - revs_limit), | |
|
470 | _('revisions'))) | |
|
480 | cs_links.append(html_tmpl % ( | |
|
481 | _('and'), | |
|
482 | uniq_id, _('%s more') % (len(revs_ids) - revs_limit), | |
|
483 | _('revisions') | |
|
484 | ) | |
|
485 | ) | |
|
471 | 486 | |
|
472 | 487 | if not feed: |
|
473 | 488 | html_tmpl = '<span id="%s" style="display:none">, %s </span>' |
|
474 | 489 | else: |
|
475 | 490 | html_tmpl = '<span id="%s"> %s </span>' |
|
476 | 491 | |
|
477 |
morelinks = ', '.join( |
|
|
478 | url('changeset_home', | |
|
479 | repo_name=repo_name, revision=rev), | |
|
480 | title=message(rev), class_='tooltip') | |
|
481 | for rev in revs[revs_limit:revs_top_limit]]) | |
|
492 | morelinks = ', '.join( | |
|
493 | [lnk(rev, repo_name) for rev in revs[revs_limit:]] | |
|
494 | ) | |
|
482 | 495 | |
|
483 | if len(revs) > revs_top_limit: | |
|
496 | if len(revs_ids) > revs_top_limit: | |
|
484 | 497 | morelinks += ', ...' |
|
485 | 498 | |
|
486 | 499 | cs_links.append(html_tmpl % (uniq_id, morelinks)) |
@@ -514,7 +527,8 b' def action_parser(user_log, feed=False):' | |||
|
514 | 527 | if feed: |
|
515 | 528 | action = action_str[0].replace('[', '').replace(']', '') |
|
516 | 529 | else: |
|
517 | action = action_str[0].replace('[', '<span class="journal_highlight">')\ | |
|
530 | action = action_str[0]\ | |
|
531 | .replace('[', '<span class="journal_highlight">')\ | |
|
518 | 532 |
|
|
519 | 533 | |
|
520 | 534 |
action_params_func = lambda |
General Comments 0
You need to be logged in to leave comments.
Login now