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