Show More
@@ -35,6 +35,7 b' from paste.httpexceptions import HTTPUna' | |||
|
35 | 35 | from paste.httpheaders import WWW_AUTHENTICATE, AUTHORIZATION |
|
36 | 36 | |
|
37 | 37 | import rhodecode |
|
38 | from rhodecode.apps._base import TemplateArgs | |
|
38 | 39 | from rhodecode.authentication.base import VCS_TYPE |
|
39 | 40 | from rhodecode.lib import auth, utils2 |
|
40 | 41 | from rhodecode.lib import helpers as h |
@@ -312,6 +313,10 b' def attach_context_attributes(context, r' | |||
|
312 | 313 | rc_config.get('rhodecode_dashboard_items', 100)) |
|
313 | 314 | context.visual.admin_grid_items = safe_int( |
|
314 | 315 | rc_config.get('rhodecode_admin_grid_items', 100)) |
|
316 | context.visual.show_revision_number = str2bool( | |
|
317 | rc_config.get('rhodecode_show_revision_number', True)) | |
|
318 | context.visual.show_sha_length = safe_int( | |
|
319 | rc_config.get('rhodecode_show_sha_length', 100)) | |
|
315 | 320 | context.visual.repository_fields = str2bool( |
|
316 | 321 | rc_config.get('rhodecode_repository_fields')) |
|
317 | 322 | context.visual.show_version = str2bool( |
@@ -551,7 +556,11 b' def bootstrap_request(**kwargs):' | |||
|
551 | 556 | from rhodecode.lib.partial_renderer import get_partial_renderer |
|
552 | 557 | return get_partial_renderer(request=self, tmpl_name=tmpl_name) |
|
553 | 558 | |
|
554 |
_call_context = |
|
|
559 | _call_context = TemplateArgs() | |
|
560 | _call_context.visual = TemplateArgs() | |
|
561 | _call_context.visual.show_sha_length = 12 | |
|
562 | _call_context.visual.show_revision_number = True | |
|
563 | ||
|
555 | 564 | @property |
|
556 | 565 | def call_context(self): |
|
557 | 566 | return self._call_context |
@@ -683,23 +683,25 b' def age_component(datetime_iso, value=No' | |||
|
683 | 683 | datetime_iso, title, tzinfo)) |
|
684 | 684 | |
|
685 | 685 | |
|
686 | def _shorten_commit_id(commit_id): | |
|
687 | from rhodecode import CONFIG | |
|
688 | def_len = safe_int(CONFIG.get('rhodecode_show_sha_length', 12)) | |
|
689 | return commit_id[:def_len] | |
|
686 | def _shorten_commit_id(commit_id, commit_len=None): | |
|
687 | if commit_len is None: | |
|
688 | request = get_current_request() | |
|
689 | commit_len = request.call_context.visual.show_sha_length | |
|
690 | return commit_id[:commit_len] | |
|
690 | 691 | |
|
691 | 692 | |
|
692 | def show_id(commit): | |
|
693 | def show_id(commit, show_idx=None, commit_len=None): | |
|
693 | 694 | """ |
|
694 | 695 | Configurable function that shows ID |
|
695 | 696 | by default it's r123:fffeeefffeee |
|
696 | 697 | |
|
697 | 698 | :param commit: commit instance |
|
698 | 699 | """ |
|
699 | from rhodecode import CONFIG | |
|
700 | show_idx = str2bool(CONFIG.get('rhodecode_show_revision_number', True)) | |
|
700 | if show_idx is None: | |
|
701 | request = get_current_request() | |
|
702 | show_idx = request.call_context.visual.show_revision_number | |
|
701 | 703 | |
|
702 | raw_id = _shorten_commit_id(commit.raw_id) | |
|
704 | raw_id = _shorten_commit_id(commit.raw_id, commit_len=commit_len) | |
|
703 | 705 | if show_idx: |
|
704 | 706 | return 'r%s:%s' % (commit.idx, raw_id) |
|
705 | 707 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now