1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 10:58:33 +00:00

Merge pull request #1496 from haiwen/file-view

[file view] modification
This commit is contained in:
Daniel Pan
2017-02-24 10:19:42 +08:00
committed by GitHub
7 changed files with 72 additions and 109 deletions

View File

@@ -2629,6 +2629,16 @@ button.sf-dropdown-toggle:focus {
} }
/* file view online, file edit */ /* file view online, file edit */
.file-view-hd {
font-size:1.4em;
margin-bottom:0px;
}
.file-view-op {
margin-top:10px;
}
.file-view-meta-info {
margin:0;
}
#shared-link, #shared-link,
#shared-upload-link, #shared-upload-link,
#shared-link-text, #shared-link-text,
@@ -2664,7 +2674,7 @@ button.sf-dropdown-toggle:focus {
#file-view-tip { #file-view-tip {
height:130px; height:130px;
padding:30px 10px 10px; padding:30px 10px 10px;
width:930px; width:950px;
background:#fff; background:#fff;
text-align:center; text-align:center;
} }
@@ -2674,24 +2684,28 @@ button.sf-dropdown-toggle:focus {
font-family: Consolas,"Liberation Mono",Courier,monospace;/*override .ace_editor*/ font-family: Consolas,"Liberation Mono",Courier,monospace;/*override .ace_editor*/
min-height: 200px; min-height: 200px;
} }
#img-prev { #img-prev,
#img-next {
position:absolute; position:absolute;
top:48%;
text-decoration:none;
color:#888;
width:50px;
height:50px;
background:#fff;
border-radius:100%;
line-height:50px;
}
#img-prev {
left:15px; left:15px;
} }
#img-next { #img-next {
position:absolute;
right:15px; right:15px;
} }
#img-prev,
#img-next { #img-prev:hover,
top:48%; #img-next:hover {
text-decoration:none; color:#333;
color: #333;
width: 50px;
height: 50px;
background: #fff;
border-radius: 100%;
line-height: 50px;
} }
#image-view { #image-view {
padding:1px; padding:1px;
@@ -3465,7 +3479,7 @@ button.sf-dropdown-toggle:focus {
} }
.shared-file-op-btn { .shared-file-op-btn {
padding:7px; padding:7px;
margin-top:11px; margin-top:9px;
} }
/*random password */ /*random password */
#share-popup .passwd-wrapper, #share-popup .passwd-wrapper,

View File

@@ -13,7 +13,7 @@
{% endif %} {% endif %}
<div id="shared-file-view-hd" class="ovhd"> <div id="shared-file-view-hd" class="ovhd">
<div class="fleft js-file-info"> <div class="fleft js-file-info">
<h2 class="ellipsis no-bold" title="{{ file_name }}">{{ file_name }}</h2> <h2 class="file-view-hd ellipsis no-bold" title="{{ file_name }}">{{ file_name }}</h2>
{% if zipped %} {% if zipped %}
<p class="cur-path ellipsis"> <p class="cur-path ellipsis">
{% trans "Current path: "%} {% trans "Current path: "%}
@@ -42,10 +42,7 @@
</div> </div>
</div> </div>
<div id="file"> {% include 'snippets/file_content_html.html' %}
{% include 'snippets/file_content_html.html' %}
</div>
<form id="file-save-form" action="{{save_to_link}}" method="post" class="file-choose-form hide">{% csrf_token %} <form id="file-save-form" action="{{save_to_link}}" method="post" class="file-choose-form hide">{% csrf_token %}
<h3>{% trans "Save To:" %}</h3> <h3>{% trans "Save To:" %}</h3>

View File

@@ -4,7 +4,7 @@
content of files that can be viewed online shows here. content of files that can be viewed online shows here.
For details please refer to 'snippets/file_content_js.html'. For details please refer to 'snippets/file_content_js.html'.
{% endcomment %} {% endcomment %}
<div id="file-view" {% if filetype == 'Image' %}class="image-file-view"{% endif %}> <div id="file-view" {% if filetype == 'Image' and not err %}class="image-file-view"{% endif %}>
{% include 'snippets/file_encoding.html' %} {% include 'snippets/file_encoding.html' %}
{% if not err %} {% if not err %}
{% if filetype == 'Text' or filetype == 'Markdown' %} {% if filetype == 'Text' or filetype == 'Markdown' %}

View File

@@ -13,47 +13,32 @@
{% block main_css_class %}{% endblock %} {# remove the padding-top css #} {% block main_css_class %}{% endblock %} {# remove the padding-top css #}
{% block main_content %} {% block main_content %}
<div id="view-hd"> <div id="view-hd" class="ovhd">
<h2>{{ filename }} <div class="fleft">
{% if is_starred %} <h2 class="file-view-hd">
<a id="file-star" class="no-deco icon-star" href="#" title="{% trans "starred" %}" aria-label="{% trans "starred" %}"></a> <span class="vam">{{ filename }}</span>
{% else %} {% if is_starred %}
<a id="file-star" class="no-deco icon-star-empty" href="#" title="{% trans "unstarred" %}" aria-label="{% trans "unstarred" %}"></a> <a id="file-star" class="vam no-deco icon-star" href="#" title="{% trans "starred" %}" aria-label="{% trans "starred" %}"></a>
{% endif %} {% else %}
<a id="file-star" class="vam no-deco icon-star-empty" href="#" title="{% trans "unstarred" %}" aria-label="{% trans "unstarred" %}"></a>
{% endif %}
{% if is_pro %} {% if is_pro %}
<img class="file-locked-icon cspt vam {% if not file_locked %}hide{% endif %}" width="16" src="{{ MEDIA_URL }}img/file-locked-32.png" alt="{% trans "locked" %}" title="{% trans "locked" %}" aria-label="{% trans "locked" %}" /> <img class="file-locked-icon cspt vam {% if not file_locked %}hide{% endif %}" width="16" src="{{ MEDIA_URL }}img/file-locked-32.png" alt="{% trans "locked" %}" title="{% trans "locked" %}" aria-label="{% trans "locked" %}" />
{% endif %} {% endif %}
</h2> </h2>
</div> <div class="commit">
<a href="{% url 'user_profile' latest_contributor %}" class="name vam">{{ latest_contributor|email2nickname }}</a>
<div id="view-path-op">
<p class="file-path">
{% trans "Current Path: "%}
{% for name, link in zipped %}
{% if not forloop.last %}
<a href="{% url 'view_common_lib_dir' repo.id link|strip_slash %}">{{ name }}</a> /
{% else %}
{{ name }}
{% endif %}
{% endfor %}
</p>
</div>
<div id="file">
<div id="file-op" class="ovhd">
<div class="commit fleft">
{% avatar latest_contributor 24 %} <a href="{% url 'user_profile' latest_contributor %}" class="name vam">{{ latest_contributor|email2nickname }}</a>
<span class="time vam">{{ last_modified|translate_seahub_time}}</span> <span class="time vam">{{ last_modified|translate_seahub_time}}</span>
{% block update_detail %} {% block update_detail %}
{% if last_commit_id %} {% if last_commit_id %}
<span class="vam">{% trans "updated this file"%}.</span> <span class="vam">{% trans "updated this file"%}.</span>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
</div> </div>
</div>
<div class="fright sf-btn-group"> <div class="sf-btn-group file-view-op fright">
{% if can_lock_unlock_file %} {% if can_lock_unlock_file %}
{% if not file_locked %} {% if not file_locked %}
<button id="lock-file" class="sf-btn-group-btn sf-btn-group-btn-first op-icon sf2-icon-lock" title="{% trans "Lock" %}"></button> <button id="lock-file" class="sf-btn-group-btn sf-btn-group-btn-first op-icon sf2-icon-lock" title="{% trans "Lock" %}"></button>
@@ -82,22 +67,21 @@
<a class="sf-btn-group-btn sf-btn-link op-icon sf2-icon-download" href="?dl=1" id="download" title="{% trans "Download"%}"></a> <a class="sf-btn-group-btn sf-btn-link op-icon sf2-icon-download" href="?dl=1" id="download" title="{% trans "Download"%}"></a>
<button id="discuss" class="sf-btn-group-btn sf-btn-group-btn-last op-icon sf2-icon-msgs" title="{% trans "Comment" %}"></button> <button id="discuss" class="sf-btn-group-btn sf-btn-group-btn-last op-icon sf2-icon-msgs" title="{% trans "Comment" %}"></button>
</div>
<div id="file-discussions" class="right-side-panel"></div>
</div> </div>
<div id="file-view" {% if filetype == 'Image' %}class="image-file-view"{% endif %}> <div id="file-discussions" class="right-side-panel"></div>
{% if err %} </div>
<div id="file-view-tip">
{% if err != 'invalid extension' %} <div id="file-view" {% if filetype == 'Image' and not err %}class="image-file-view"{% endif %}>
<p class="error">{{ err }}</p> {% if err %}
{% endif %} <div id="file-view-tip">
</div> {% if err != 'invalid extension' %}
{% else %} <p class="error">{{ err }}</p>
{% endif %}
</div>
{% else %}
{% block file_view %}{% endblock %} {% block file_view %}{% endblock %}
{% endif %} {% endif %}
</div>
</div> </div>
{% include "snippets/file_share_popup.html" %} {% include "snippets/file_share_popup.html" %}
@@ -301,7 +285,7 @@ if (ref_list.length > 1 && ref_list[0].indexOf('search') > 0) {
$(window).load(function() { $(window).load(function() {
if (highlight_kw) { if (highlight_kw) {
// hl kw in file title // hl kw in file title
highlight_kw($('#view-hd')[0]); highlight_kw($('.file-view-hd span')[0]);
// hl kw in file content // hl kw in file content
if ('{{filetype}}' == 'Markdown') { if ('{{filetype}}' == 'Markdown') {

View File

@@ -12,30 +12,18 @@
{% block main_css_class %}{% endblock %} {# remove the padding-top css #} {% block main_css_class %}{% endblock %} {# remove the padding-top css #}
{% block main_content %} {% block main_content %}
<div id="view-hd"> <div id="view-hd" class="ovhd">
{% block view_hd %} <div class="fleft">
<h2> <h2 class="file-view-hd">{{file_name}}</h2>
{{file_name}} {% block file_path %}
<span class="commit-time">({{ current_commit.props.ctime|tsstr_sec }})</span> <p class="file-view-meta-info">{{ current_commit.props.ctime|tsstr_sec }}</p>
</h2> {% endblock %}
{% endblock %}
</div>
<div id="file">
<div id="file-op" class="ovhd">
<p class="history-file-path fleft">
{% block file_path %}
{% trans "Current Path: "%}
{% for name, link in zipped %}
{% if not forloop.last %} {{ name }} / {% else %} {{ name }} {% endif %}
{% endfor %}
{% endblock %}
</p>
<a class="sf-btn-link fright" href="{% url 'download_file' repo.id obj_id%}?file_name={{ file_name|urlencode }}&p={{path|urlencode}}" id="download">{% trans "Download"%}</a>
</div> </div>
{% include 'snippets/file_content_html.html' %}
<a class="file-view-op sf-btn-link fright" href="{% url 'download_file' repo.id obj_id%}?file_name={{ file_name|urlencode }}&p={{path|urlencode}}" id="download">{% trans "Download"%}</a>
</div> </div>
{% include 'snippets/file_content_html.html' %}
{% endblock %} {% endblock %}
{% block extra_script %} {% block extra_script %}

View File

@@ -1,17 +1 @@
{% extends 'view_history_file.html' %} {% extends 'view_history_file.html' %}
{% load seahub_tags i18n %}
{% load url from future %}
{% block view_hd %}
<h2>
{{file_name}}
<span class="commit-time">({{ current_commit.props.ctime|tsstr_sec }})</span>
</h2>
{% endblock %}
{% block file_path %}
{% trans "Current Path: "%}
{% for name, link in zipped %}
{% if not forloop.last %} <a href="{% url 'repo_history_view' repo.id %}?commit_id={{ current_commit.id }}&p={{ link|urlencode }}">{{ name }}</a> / {% else %} {{ name }} {% endif %}
{% endfor %}
{% endblock %}

View File

@@ -2,10 +2,6 @@
{% load i18n %} {% load i18n %}
{% load url from future %} {% load url from future %}
{% block view_hd %}
<h2>{{file_name}}</h2>
{% endblock %}
{% block file_path %} {% block file_path %}
{% trans "Current Path: "%}{% trans "Trash" %} <p class="file-view-meta-info">{% trans "Current Path: "%}{% trans "Trash" %}</p>
{% endblock %} {% endblock %}