From fbd13ef3817b7ed883d386da0963fc4f6e96aae5 Mon Sep 17 00:00:00 2001 From: llj Date: Wed, 28 Nov 2012 15:24:11 +0800 Subject: [PATCH] modified md file view, edit, preview;modified shared-file and history-file view for md & seaf --- media/css/file_view_extra.css | 50 +++++++++++++++ templates/repo_edit_file.html | 11 ++-- templates/repo_view_file.html | 91 +++++++++++---------------- templates/snippets/repo_file_get.html | 2 +- templates/view_shared_file.html | 24 ++++++- 5 files changed, 114 insertions(+), 64 deletions(-) create mode 100644 media/css/file_view_extra.css diff --git a/media/css/file_view_extra.css b/media/css/file_view_extra.css new file mode 100644 index 0000000000..7338ecfd2b --- /dev/null +++ b/media/css/file_view_extra.css @@ -0,0 +1,50 @@ +#main { + width:100%; +} +#view-hd, +#view-path-op, +#file-op, +#sf-commit-op { + width:950px; + margin:0 auto; +} +#file-op { + padding:0; + border:0; +} +#file-op .avatar, +#file-op .name, +#file-op .time, +#file-op span { + vertical-align:middle; +} +#file-op .time { + color:#666; + margin:0 2px 0 8px; +} +#file-op .file-diff { + font-size:100%; +} +#file-op .contributors { + margin-left:8px; +} +#file { + padding:0; + background:#fff; +} +#file-view { + padding:30px 0 10px; + min-height:400px; + background:#f4f4f4; + border:1px solid #ededed; + margin-top:12px; +} +#sf, +#md-view { + width:624px; + padding:40px 96px; + border:1px solid #ccc; + margin:0 auto; + box-shadow:0 0 6px #ccc; + min-height:400px; +} diff --git a/templates/repo_edit_file.html b/templates/repo_edit_file.html index 70aa85dbb5..96951f0a6f 100644 --- a/templates/repo_edit_file.html +++ b/templates/repo_edit_file.html @@ -40,14 +40,9 @@ background:#f4f4f4; border-top:1px solid #ededed; } -#md-view { - width:690px; -} -#sf { +#sf, #md-view { width:624px; padding:40px 96px; -} -#sf, #md-view { box-shadow:0 0 6px #ccc; min-height:400px; border:1px solid #ccc; @@ -61,7 +56,11 @@ z-index:1010;/*make seaf image show below path-op*/ } .CodeMirror { + {% if filetype == 'Markdown' %} + width:818px; + {% else %} width:950px; + {% endif %} margin:0 auto; box-shadow:0 0 6px #272822; } diff --git a/templates/repo_view_file.html b/templates/repo_view_file.html index 8695966690..617f166355 100644 --- a/templates/repo_view_file.html +++ b/templates/repo_view_file.html @@ -6,53 +6,8 @@ {% if filetype == 'Text' %} {% endif %} -{% if filetype == 'Sf' %} - +{% if filetype == 'Sf' or filetype == 'Markdown' %} + {% endif %} {% endblock %} @@ -84,7 +39,15 @@ {% endif %} + {% if filetype == 'Sf' or filetype == 'Markdown'%} + {% if view_history %} +
+ {% else %} +
+ {% endif %} + {% else %}
+ {% endif %}

{% trans "Current Path: "%} @@ -130,12 +93,12 @@ {% endif %}

- {% if not view_history and filetype != 'Sf' %} + {% if not view_history and filetype != 'Sf' and filetype != 'Markdown' %}

{% avatar latest_contributor 20 %} {{ latest_contributor|email2nickname }}{{ last_modified|translate_seahub_time}}{% trans "updated this file"%} - {% if filetype == 'Text' or filetype == 'Markdown' %} + {% if filetype == 'Text' %} {% if last_commit_id %} {% trans "Detail"%} {% endif %} @@ -161,9 +124,19 @@

{% endif %} - {% if not view_history and filetype == 'Sf' %} + {% if not view_history %} + {% if filetype == 'Sf' or filetype == 'Markdown' %}
- {% avatar latest_contributor 20 %} {{ latest_contributor|email2nickname }}{{ last_modified|translate_seahub_time}}{% trans "updated this file"%}. + {% avatar latest_contributor 20 %} {{ latest_contributor|email2nickname }}{{ last_modified|translate_seahub_time}} + {% if filetype == 'Markdown' %} + {% if last_commit_id %} + {% trans "updated this file"%}, {% trans "Detail"%}. + {% endif %} + {% endif %} + + {% if filetype == 'Sf' %} + {% trans "updated this file"%}. + {% endif %} {% blocktrans count counter=contributors|length %}one contributor{% plural %} {{ counter }} contributors {% endblocktrans %} {% for user in contributors %} {% avatar user 16 %} @@ -172,6 +145,7 @@ {% if user_perm == 'rw' %} {% endif %} + {% endif %} {% endif %} {% if not view_history and request.user.is_authenticated %} @@ -199,7 +173,13 @@ {% endif %} {% endifnotequal %} {% else %} -

{% trans "Loading..."%}

+ {% if filetype == 'Markdown' %} +
+

{% trans "Loading..."%}

+
+ {% else %} +

{% trans "Loading..."%}

+ {% endif %} {% endif %}
@@ -601,13 +581,16 @@ $('#back').click(function() { {% endif %} {% endif %} -{% if filetype == 'Sf' %} +{% if filetype == 'Sf' or filetype == 'Markdown' %} {% if not view_history %} $('#file-op .history').click(function () { location.href = $(this).data('url'); }); -{% endif %} $('#main-panel').css({'margin-bottom':0}); +{% else %} +$('.path').css('margin-top', '.5em'); +$('#file-op').prepend($('.path')); +{% endif %} {% endif %} {% endblock %} diff --git a/templates/snippets/repo_file_get.html b/templates/snippets/repo_file_get.html index 772cb43340..f602976a41 100644 --- a/templates/snippets/repo_file_get.html +++ b/templates/snippets/repo_file_get.html @@ -101,7 +101,7 @@ {% endifnotequal %} {% if err %} - $('#file-view').html('

{{ err }}

').addClass('file-view-tip'); + $('#file-view').html('

{{ err }}

'); {% endif %} {% endif %} diff --git a/templates/view_shared_file.html b/templates/view_shared_file.html index 4628434839..0823538bd9 100644 --- a/templates/view_shared_file.html +++ b/templates/view_shared_file.html @@ -2,21 +2,33 @@ {% load seahub_tags i18n %} {% block extra_style %} +{% if filetype == 'Text' %} +{% endif %} +{% if filetype == 'Sf' or filetype == 'Markdown' %} + +{% endif %} {% endblock %} {% block main_panel %} -

{{ file_name }}

+

{{ file_name }}

+ {% if filetype != 'Markdown' and filetype != 'Sf' %}

{% trans "Shared by: " %}{{ username }}

+ {% endif %}
{% if filetype == 'PDF' and not pdf_use_flas %}
{% else %}
{% endif %} + {% if filetype == 'Markdown' or filetype == 'Sf' %} +

{% trans "Shared by: " %}{{ username }}

+ {% endif %} + {% if filetype == 'Text' or filetype == 'Image' or filetype == 'SVG' or filetype == 'Markdown' %} {% endif %} +
@@ -25,11 +37,17 @@ {% if filetype == 'Text' %} {% else %} -
{{ file_content|safe }}
+
{{ file_content|safe }}
{% endif %} {% endifnotequal %} {% else %} -

{% trans "Loading..." %}

+ {% if filetype == 'Markdown' %} +
+

{% trans "Loading..."%}

+
+ {% else %} +

{% trans "Loading..." %}

+ {% endif %} {% endif %}