diff --git a/media/css/seahub.css b/media/css/seahub.css index 3651e41bb7..e707de1c42 100644 --- a/media/css/seahub.css +++ b/media/css/seahub.css @@ -928,7 +928,9 @@ ul.with-bg li { color:#666; margin-left:5px; } -.lsch, .lsch-encrypted, .file-diff { +.lsch, +.lsch-encrypted, +.file-diff { font-size:12px; font-weight:normal; color:#666; @@ -1383,13 +1385,27 @@ ul.with-bg li { /* text file diff */ div.diff-desc { margin: 10px 0; } div.diff-desc p { margin: 10px 0; } -#text-diff-output table { margin-top: 20px; border: 1px solid gray; } -#text-diff-output thead { border: 1px solid gray; } -#text-diff-output th { background-color: #EED; text-align: center; } -#text-diff-output th, #text-diff-output td { border-bottom: none; } -#text-diff-output tr.hl { background-color: #afcde8; }/*highlight*/ -.diff_header { background-color: #EED; text-align: center; } -.diff_add { background-color: #DFD; } -.diff_sub { background-color: #FDD; } -.diff_chg { background-color: #FD8; } +#text-diff-output table { + margin-top: 20px; + border: 1px solid gray; +} + +#text-diff-output tr th { + background-color: #EED; + text-align: center; +} +#text-diff-output th, +#text-diff-output td { + border-bottom: none; +} +#text-diff-output tr.hl { + background-color: #afcde8; /*highlight*/ +} +.diff-header { + background-color: #EED; + text-align: center; +} +.diff-add { background-color: #DFD; } +.diff-sub { background-color: #FDD; } +.diff-chg { background-color: #FD8; } diff --git a/templates/repo_view_file.html b/templates/repo_view_file.html index daa5707325..52618997a4 100644 --- a/templates/repo_view_file.html +++ b/templates/repo_view_file.html @@ -82,7 +82,8 @@ {% if not view_history %}
-

{% avatar latest_contributor 20 %} {{ latest_contributor|email2nickname }} {{ last_modified|translate_commit_time}} 做了最新修改 +

+ {% avatar latest_contributor 20 %} {{ latest_contributor|email2nickname }} {{ last_modified|translate_commit_time}} 做了最新修改 {% if filetype == 'Text' or filetype == 'Markdown' %} {% if last_commit_id %} 详情 diff --git a/templates/snippets/file_view_js.html b/templates/snippets/file_view_js.html index dd30d97da3..c57589bd43 100644 --- a/templates/snippets/file_view_js.html +++ b/templates/snippets/file_view_js.html @@ -14,6 +14,3 @@ {% if filetype == 'Markdown' %} {% endif %} - -{% if filetype == 'Text' or filetype == 'Markdown' %} -{% endif %} diff --git a/templates/text_diff.html b/templates/text_diff.html index 77277eefc4..3a7030b3f4 100644 --- a/templates/text_diff.html +++ b/templates/text_diff.html @@ -3,7 +3,7 @@ {% load url from future %} {% block main_panel %} -

文件修改详情

+

文件修改详情

文件路径: @@ -23,16 +23,14 @@

{% else %}
- - +
+ - - - {{ diff_result_table|safe }} - + + {{ diff_result_table|safe }}
修改前 修改后
{% endif %} diff --git a/thirdpart/seaserv/htmldiff.py b/thirdpart/seaserv/htmldiff.py index 48c4a4a8e2..011a11e813 100644 --- a/thirdpart/seaserv/htmldiff.py +++ b/thirdpart/seaserv/htmldiff.py @@ -1875,17 +1875,21 @@ class HtmlDiff(object): cls = '' if '\0+' in text: - cls = 'diff_add' + cls = 'diff-add' elif '\0-' in text: - cls = 'diff_sub' + cls = 'diff-sub' elif '\0^' in text: - cls = 'diff_chg' + cls = 'diff-chg' + + text = text.replace('\0+', '').replace('\0-', ''). \ + replace('\0^', '').replace('\1', ''). \ + replace('\t',' ') if cls: - return '%s%s' \ + return '%s%s' \ % (linenum,cls,text) else: - return '%s%s' \ + return '%s%s' \ % (linenum,text) def _make_prefix(self): @@ -2004,11 +2008,13 @@ class HtmlDiff(object): data_rows = ''.join(s) - return data_rows.replace('\0+',''). \ - replace('\0-',''). \ - replace('\0^',''). \ - replace('\1',''). \ - replace('\t',' ') + return data_rows + + # return data_rows.replace('\0+',''). \ + # replace('\0-',''). \ + # replace('\0^',''). \ + # replace('\1',''). \ + # replace('\t',' ') del re