# HG changeset patch # User Marcin Lulek # Date 2018-10-01 08:15:33 # Node ID c6e455365b1e948a1aa12723ce39bc9646315e20 # Parent abc83359cad64aeb57a4efc1c13baef4338a7996 diffs: added handy quick file selector in diffs views. diff --git a/rhodecode/public/css/code-block.less b/rhodecode/public/css/code-block.less --- a/rhodecode/public/css/code-block.less +++ b/rhodecode/public/css/code-block.less @@ -648,6 +648,7 @@ pre.literal-block, .codehilite pre{ @cb-text-padding: 5px; @pill-padding: 2px 7px; +@pill-padding-small: 2px 2px 1px 2px; input.filediff-collapse-state { display: none; @@ -725,11 +726,20 @@ input.filediff-collapse-state { } } +.filelist { + .pill { + display: block; + float: left; + padding: @pill-padding-small; + } +} + .pill { display: block; float: left; padding: @pill-padding; } + .pill-group { .pill { opacity: .8; @@ -815,6 +825,56 @@ input.filediff-collapse-state { } } + .filediff-collapse-button, .filediff-expand-button { + cursor: pointer; + } + .filediff-collapse-button { + display: inline; + } + .filediff-expand-button { + display: none; + } + .filediff-collapsed .filediff-collapse-button { + display: none; + } + .filediff-collapsed .filediff-expand-button { + display: inline; + } + + /**** COMMENTS ****/ + + .filediff-menu { + .show-comment-button { + display: none; + } + } + &.hide-comments { + .inline-comments { + display: none; + } + .filediff-menu { + .show-comment-button { + display: inline; + } + .hide-comment-button { + display: none; + } + } + } + + .hide-line-comments { + .inline-comments { + display: none; + } + } + + /**** END COMMENTS ****/ + +} + + + +.filediff, .filelist { .pill { &[op="name"] { background: none; @@ -868,53 +928,8 @@ input.filediff-collapse-state { color: white; } } - - .filediff-collapse-button, .filediff-expand-button { - cursor: pointer; - } - .filediff-collapse-button { - display: inline; - } - .filediff-expand-button { - display: none; - } - .filediff-collapsed .filediff-collapse-button { - display: none; - } - .filediff-collapsed .filediff-expand-button { - display: inline; - } - - /**** COMMENTS ****/ +} - .filediff-menu { - .show-comment-button { - display: none; - } - } - &.hide-comments { - .inline-comments { - display: none; - } - .filediff-menu { - .show-comment-button { - display: inline; - } - .hide-comment-button { - display: none; - } - } - } - - .hide-line-comments { - .inline-comments { - display: none; - } - } - - /**** END COMMENTS ****/ - -} .filediff-outdated { padding: 8px 0; diff --git a/rhodecode/templates/changeset/changeset.mako b/rhodecode/templates/changeset/changeset.mako --- a/rhodecode/templates/changeset/changeset.mako +++ b/rhodecode/templates/changeset/changeset.mako @@ -211,7 +211,7 @@
<%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/> - ${cbdiffs.render_diffset_menu()} + ${cbdiffs.render_diffset_menu(c.changes[c.commit.raw_id])} ${cbdiffs.render_diffset( c.changes[c.commit.raw_id], commit=c.commit, use_comments=True,inline_comments=c.inline_comments )}
diff --git a/rhodecode/templates/changeset/changeset_range.mako b/rhodecode/templates/changeset/changeset_range.mako --- a/rhodecode/templates/changeset/changeset_range.mako +++ b/rhodecode/templates/changeset/changeset_range.mako @@ -3,9 +3,9 @@ <%def name="title()"> ${_('%s Commits') % c.repo_name} - - r${c.commit_ranges[0].revision}:${h.short_id(c.commit_ranges[0].raw_id)} + r${c.commit_ranges[0].idx}:${h.short_id(c.commit_ranges[0].raw_id)} ... - r${c.commit_ranges[-1].revision}:${h.short_id(c.commit_ranges[-1].raw_id)} + r${c.commit_ranges[-1].idx}:${h.short_id(c.commit_ranges[-1].raw_id)} ${_ungettext('(%s commit)','(%s commits)', len(c.commit_ranges)) % len(c.commit_ranges)} %if c.rhodecode_name: · ${h.branding(c.rhodecode_name)} @@ -14,9 +14,9 @@ <%def name="breadcrumbs_links()"> ${_('Commits')} - - r${c.commit_ranges[0].revision}:${h.short_id(c.commit_ranges[0].raw_id)} + r${c.commit_ranges[0].idx}:${h.short_id(c.commit_ranges[0].raw_id)} ... - r${c.commit_ranges[-1].revision}:${h.short_id(c.commit_ranges[-1].raw_id)} + r${c.commit_ranges[-1].idx}:${h.short_id(c.commit_ranges[-1].raw_id)} ${_ungettext('(%s commit)','(%s commits)', len(c.commit_ranges)) % len(c.commit_ranges)} @@ -43,7 +43,7 @@

${_('Commit Range')} - r${c.commit_ranges[0].revision}:${h.short_id(c.commit_ranges[0].raw_id)}...r${c.commit_ranges[-1].revision}:${h.short_id(c.commit_ranges[-1].raw_id)} + r${c.commit_ranges[0].idx}:${h.short_id(c.commit_ranges[0].raw_id)}...r${c.commit_ranges[-1].idx}:${h.short_id(c.commit_ranges[-1].raw_id)}

@@ -54,7 +54,7 @@ ${_('Diff option')}:
-
+
- %if commit: - ${'r%s:%s' % (commit.revision,h.short_id(commit.raw_id))} - - ${h.age_component(commit.date)} - - %endif - - %if diffset.limited_diff: - ${_('The requested commit is too big and content was truncated.')} - - ${_ungettext('%(num)s file changed.', '%(num)s files changed.', diffset.changed_files) % {'num': diffset.changed_files}} - ${_('Show full diff')} - %else: - ${_ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted', - '%(num)s files changed: %(linesadd)s inserted, %(linesdel)s deleted', diffset.changed_files) % {'num': diffset.changed_files, 'linesadd': diffset.lines_added, 'linesdel': diffset.lines_deleted}} - %endif + ## invidual commit + % if commit: + ${('r%s:%s' % (commit.idx,h.short_id(commit.raw_id)))} - + ${h.age_component(commit.date)} + % if diffset.limited_diff: + - ${_('The requested commit is too big and content was truncated.')} + ${_ungettext('%(num)s file changed.', '%(num)s files changed.', diffset.changed_files) % {'num': diffset.changed_files}} + ${_('Show full diff')} + % elif hasattr(c, 'commit_ranges') and len(c.commit_ranges) > 1: + ## compare diff, has no file-selector and we want to show stats anyway + ${_ungettext('{num} file changed: {linesadd} inserted, ''{linesdel} deleted', + '{num} files changed: {linesadd} inserted, {linesdel} deleted', diffset.changed_files) \ + .format(num=diffset.changed_files, linesadd=diffset.lines_added, linesdel=diffset.lines_deleted)} + % endif + % else: + ## pull requests/compare + ${_('File Changes')} + % endif
@@ -432,7 +436,7 @@ from rhodecode.lib.diffs import NEW_FILE <%def name="nice_mode(filemode)"> - ${filemode.startswith('100') and filemode[3:] or filemode} + ${(filemode.startswith('100') and filemode[3:] or filemode)} <%def name="diff_menu(filediff, use_comments=False)"> @@ -693,7 +697,7 @@ def get_comments_for(diff_type, comments %endif %if use_comments: ${render_add_comment_button()} @@ -727,7 +731,7 @@ def get_comments_for(diff_type, comments -<%def name="render_diffset_menu()"> +<%def name="render_diffset_menu(diffset=None)">
@@ -749,6 +753,9 @@ def get_comments_for(diff_type, comments
+
+ ${h.hidden('file_filter')} +
${_('Wide Mode Diff')} +
+ + % if diffset: + + %if diffset.limited_diff: + <% file_placeholder = _ungettext('%(num)s file changed', '%(num)s files changed', diffset.changed_files) % {'num': diffset.changed_files}%> + %else: + <% file_placeholder = _ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted', '%(num)s files changed: %(linesadd)s inserted, %(linesdel)s deleted', diffset.changed_files) % {'num': diffset.changed_files, 'linesadd': diffset.lines_added, 'linesdel': diffset.lines_deleted}%> + %endif + + + % endif + diff --git a/rhodecode/templates/compare/compare_commits.mako b/rhodecode/templates/compare/compare_commits.mako --- a/rhodecode/templates/compare/compare_commits.mako +++ b/rhodecode/templates/compare/compare_commits.mako @@ -40,7 +40,7 @@ - r${commit.revision}:${h.short_id(commit.raw_id)} + r${commit.idx}:${h.short_id(commit.raw_id)} ${h.hidden('revisions',commit.raw_id)} diff --git a/rhodecode/templates/compare/compare_diff.mako b/rhodecode/templates/compare/compare_diff.mako --- a/rhodecode/templates/compare/compare_diff.mako +++ b/rhodecode/templates/compare/compare_diff.mako @@ -322,7 +322,7 @@
## commit compare generated below <%include file="compare_commits.mako"/> - ${cbdiffs.render_diffset_menu()} + ${cbdiffs.render_diffset_menu(c.diffset)} ${cbdiffs.render_diffset(c.diffset)}
% endif @@ -330,4 +330,4 @@
- \ No newline at end of file + diff --git a/rhodecode/templates/pullrequests/pullrequest_show.mako b/rhodecode/templates/pullrequests/pullrequest_show.mako --- a/rhodecode/templates/pullrequests/pullrequest_show.mako +++ b/rhodecode/templates/pullrequests/pullrequest_show.mako @@ -568,7 +568,7 @@
<%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/> - ${cbdiffs.render_diffset_menu()} + ${cbdiffs.render_diffset_menu(c.diffset)} ${cbdiffs.render_diffset( c.diffset, use_comments=True, collapse_when_files_over=30,