mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-17 07:41:26 +00:00
Merge pull request #2247 from haiwen/document-bug
repair editor menu style for different device
This commit is contained in:
@@ -1678,6 +1678,95 @@ button.sf-dropdown-toggle:focus {
|
||||
text-decoration:none;
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
/* mobile flie-menu */
|
||||
.mobile-menu-mask {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 99;
|
||||
background-color: #000;
|
||||
opacity: 0.1;
|
||||
}
|
||||
|
||||
.mobile-menu-content {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
z-index: 100;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.mobile-menu-content ul {
|
||||
border-top: solid 1px #eee;
|
||||
}
|
||||
|
||||
.mobile-menu-content ul li {
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mobile-menu-content ul li:hover{
|
||||
background-color: #eb8205;
|
||||
}
|
||||
|
||||
.mobile-menu-content a {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
/*mobiel editor-menu and responsed */
|
||||
@media (max-width: 991.98px) {
|
||||
#file-enc-cont {
|
||||
width: 100%;
|
||||
display: none;
|
||||
}
|
||||
.CodeMirror.CodeMirror-wrap{
|
||||
width: 100%;
|
||||
margin-top: -20px;
|
||||
}
|
||||
|
||||
.sf2-mobile-menu-toggle {
|
||||
font-size: 22px;
|
||||
line-height: 1;
|
||||
color: #999;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.sf2-mobile-menu-toggle:hover {
|
||||
text-decoration: none;
|
||||
color:#999;
|
||||
}
|
||||
|
||||
.sf2-mobile-menu {
|
||||
position: absolute;
|
||||
display: none;
|
||||
top: 50px;
|
||||
right: 10px;
|
||||
background:#fff;
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.sf2-mobile-menu ul li a {
|
||||
min-width: 10rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
}
|
||||
|
||||
#file-view {
|
||||
width: 100% !important;
|
||||
border-right: none !important;
|
||||
}
|
||||
|
||||
#pdf {
|
||||
width: 95% !important;
|
||||
}
|
||||
}
|
||||
|
||||
/**** discussions/comments ****/
|
||||
.msg {
|
||||
padding:5px 10px;
|
||||
@@ -2979,6 +3068,11 @@ button.sf-dropdown-toggle:focus {
|
||||
background:#fff;
|
||||
text-align:center;
|
||||
}
|
||||
@media (max-width:991.98px) {
|
||||
#file-view-tip {
|
||||
width: 80%;
|
||||
}
|
||||
}
|
||||
#docu-view {
|
||||
font-size:14px;/*override .ace_editor*/
|
||||
line-height:1.6em;
|
||||
@@ -3231,6 +3325,27 @@ button.sf-dropdown-toggle:focus {
|
||||
width: 500px;
|
||||
height: 30px;
|
||||
}
|
||||
@media (max-width: 991.98px){
|
||||
.video-container {
|
||||
margin: 0 auto;
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
}
|
||||
.sf-video-dimensions {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.audio-container {
|
||||
width: 350px;
|
||||
max-width: 500px;
|
||||
}
|
||||
.mejs-container {
|
||||
width: 100% !important;
|
||||
}
|
||||
.mejs-time-total {
|
||||
width: 60%
|
||||
}
|
||||
}
|
||||
|
||||
/* wiki page */
|
||||
.wiki-top {/* for lang with long words */
|
||||
|
@@ -5,4 +5,9 @@
|
||||
box-shadow: 0 0 6px #ccc;
|
||||
margin: auto;
|
||||
min-height: 500px;
|
||||
};
|
||||
}
|
||||
@media (max-width: 991.98px){
|
||||
#spreadsheet-container iframe {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
@@ -141,25 +141,28 @@
|
||||
</td>
|
||||
<td class="repo-op-td">
|
||||
<div class="op-container">
|
||||
<div class="sf-dropdown sf-dropdown-inline">
|
||||
<a href="#" class="sf2-icon-caret-down more-op-icon op-icon sf-dropdown-toggle" title="{% trans "More Operations" %}" aria-label="{% trans "More Operations" %}"></a>
|
||||
<ul class="hidden-op repo-hidden-op hide sf-dropdown-menu">
|
||||
<li><a href="#" class="repo-share-btn op">{% trans "Share" %}</a></li>
|
||||
<li><a href="#" class="repo-delete-btn op">{% trans "Delete" %}</a></li>
|
||||
<li><a class="op js-repo-rename" href="#">{% trans "Rename" %}</a></li>
|
||||
<li><a class="op js-repo-transfer" href="#">{% trans "Transfer" %}</a></li>
|
||||
<li><a class="op js-popup-history-setting" href="#">{% trans "History Setting" %}</a></li>
|
||||
<% if (encrypted) { %>
|
||||
<li><a class="op js-repo-change-password" href="#">{% trans "Change Password" %}</a></li>
|
||||
<% } %>
|
||||
<% if (!encrypted && (can_generate_share_link || can_generate_upload_link)) { %>
|
||||
<li><a class="op js-popup-share-link-admin" href="#">{% trans "Share Links" %}</a></li>
|
||||
<% } %>
|
||||
<% if (app.pageOptions.folder_perm_enabled) { %>
|
||||
<li><a class="op js-popup-folder-perm-admin" href="#">{% trans "Folder Permission" %}</a></li>
|
||||
<% } %>
|
||||
<li><a class="op js-repo-details" href="#">{% trans "Details" %}</a></li>
|
||||
</ul>
|
||||
<a href="#" class="mobile-menu-control sf2-icon-caret-down more-op-icon op-icon sf-dropdown-toggle" title="{% trans "More Operations" %}" aria-label="{% trans "More Operations" %}"></a>
|
||||
<div class="mobile-menu-container" style="display:none">
|
||||
<div class="mobile-menu-mask"></div>
|
||||
<div class="mobile-menu-content">
|
||||
<ul>
|
||||
<li><a href="#" class="repo-share-btn op">{% trans "Share" %}</a></li>
|
||||
<li><a href="#" class="repo-delete-btn op">{% trans "Delete" %}</a></li>
|
||||
<li><a class="op js-repo-rename" href="#">{% trans "Rename" %}</a></li>
|
||||
<li><a class="op js-repo-transfer" href="#">{% trans "Transfer" %}</a></li>
|
||||
<li><a class="op js-popup-history-setting" href="#">{% trans "History Setting" %}</a></li>
|
||||
<% if (encrypted) { %>
|
||||
<li><a class="op js-repo-change-password" href="#">{% trans "Change Password" %}</a></li>
|
||||
<% } %>
|
||||
<% if (!encrypted && (can_generate_share_link || can_generate_upload_link)) { %>
|
||||
<li><a class="op js-popup-share-link-admin" href="#">{% trans "Share Links" %}</a></li>
|
||||
<% } %>
|
||||
<% if (app.pageOptions.folder_perm_enabled) { %>
|
||||
<li><a class="op js-popup-folder-perm-admin" href="#">{% trans "Folder Permission" %}</a></li>
|
||||
<% } %>
|
||||
<li><a class="op js-repo-details" href="#">{% trans "Details" %}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -853,60 +856,60 @@
|
||||
</td>
|
||||
<td class="dirent-op">
|
||||
<div class="op-container">
|
||||
<div class="sf-dropdown sf-dropdown-inline">
|
||||
<a href="#" class="more-op-icon sf2-icon-caret-down op-icon sf-dropdown-toggle" title="{% trans "More Operations"%}" aria-label="{% trans "More Operations" %}"></a>
|
||||
<div class="hide sf-dropdown-menu">
|
||||
<ul>
|
||||
<li><a class="op download" href="<%= download_url %>">{% trans "Download" %}</a></li>
|
||||
<% if (!repo_encrypted && can_generate_share_link) { %>
|
||||
<li><a class="op share" href="#">{% trans "Share" %}</a></li>
|
||||
<% } %>
|
||||
<% if (dirent.perm == 'rw') { %>
|
||||
<% if (!dirent.is_locked || (dirent.is_locked && dirent.locked_by_me)) { %>
|
||||
<li><a class="op delete" href="#">{% trans "Delete" %}</a></li>
|
||||
<li><a class="op rename" href="#">{% trans "Rename" %}</a></li>
|
||||
<li><a class="op mv" href="#">{% trans "Move" %}</a></li>
|
||||
<% } %>
|
||||
<li><a class="op cp" href="#">{% trans "Copy" %}</a></li>
|
||||
<% if (is_pro) { %>
|
||||
<% if (dirent.is_locked) { %>
|
||||
<% if (dirent.locked_by_me) { %>
|
||||
<li><a class="op unlock-file" href="#">{% trans "Unlock" %}</a></li>
|
||||
<% } %>
|
||||
<% } else { %>
|
||||
<li><a class="op lock-file" href="#">{% trans "Lock" %}</a></li>
|
||||
<% } %>
|
||||
<a href="#" class="mobile-menu-control more-op-icon sf2-icon-caret-down op-icon sf-dropdown-toggle" title="{% trans "More Operations"%}" aria-label="{% trans "More Operations" %}"></a>
|
||||
<div class="mobile-menu-container" style="display:none">
|
||||
<div class="mobile-menu-mask"></div>
|
||||
<div class="mobile-menu-content">
|
||||
<ul>
|
||||
<li><a class="op download download-close-menu" href="<%= download_url %>">{% trans "Download" %}</a></li>
|
||||
<% if (!repo_encrypted && can_generate_share_link) { %>
|
||||
<li><a class="op share" href="#">{% trans "Share" %}</a></li>
|
||||
<% } %>
|
||||
<% if (dirent.perm == 'rw') { %>
|
||||
<% if (!dirent.is_locked || (dirent.is_locked && dirent.locked_by_me)) { %>
|
||||
<li><a class="op delete" href="#">{% trans "Delete" %}</a></li>
|
||||
<li><a class="op rename" href="#">{% trans "Rename" %}</a></li>
|
||||
<li><a class="op mv" href="#">{% trans "Move" %}</a></li>
|
||||
<% } %>
|
||||
<li><a class="op cp" href="#">{% trans "Copy" %}</a></li>
|
||||
<% if (is_pro) { %>
|
||||
<% if (dirent.is_locked) { %>
|
||||
<% if (dirent.locked_by_me) { %>
|
||||
<li><a class="op unlock-file" href="#">{% trans "Unlock" %}</a></li>
|
||||
<% } %>
|
||||
<% } else { %>
|
||||
<li><a class="op lock-file" href="#">{% trans "Lock" %}</a></li>
|
||||
<% } %>
|
||||
<% } %>
|
||||
<% } %>
|
||||
|
||||
<% if (dirent.perm == 'r') { %>
|
||||
<% if (!repo_encrypted) { %>
|
||||
<li><a class="op cp" href="#">{% trans "Copy" %}</a></li>
|
||||
<% if (dirent.perm == 'r') { %>
|
||||
<% if (!repo_encrypted) { %>
|
||||
<li><a class="op cp" href="#">{% trans "Copy" %}</a></li>
|
||||
<% } %>
|
||||
<% } %>
|
||||
</ul>
|
||||
<!-- <div class="menu-inner-divider"></div> -->
|
||||
<ul>
|
||||
<% if (dirent.perm == 'rw') { %>
|
||||
<% if (app.pageOptions.enable_file_comment) { %>
|
||||
<li><a class="op file-comment" href="#">{% trans "Comment" %}</a><li>
|
||||
<% } %>
|
||||
<li><a class="op file-history" href="{{ SITE_ROOT }}repo/file_revisions/<%= repo_id %>/?p=<% print(encodeURIComponent(dirent_path)); %>">{% trans "History" %}</a></li>
|
||||
<% if (is_pro) { %>
|
||||
<% if (file_audit_enabled) { %>
|
||||
<li><a class="op" href="{{ SITE_ROOT }}repo/file-access/<%= repo_id %>/?p=<% print(encodeURIComponent(dirent_path)); %>" target="_blank">{% trans "Access Log" %}</a></li>
|
||||
<% } %>
|
||||
<% } %>
|
||||
</ul>
|
||||
<div class="menu-inner-divider"></div>
|
||||
<ul>
|
||||
<% if (dirent.perm == 'rw') { %>
|
||||
<% if (app.pageOptions.enable_file_comment) { %>
|
||||
<li><a class="op file-comment" href="#">{% trans "Comment" %}</a><li>
|
||||
<% } %>
|
||||
<li><a class="op file-history" href="{{ SITE_ROOT }}repo/file_revisions/<%= repo_id %>/?p=<% print(encodeURIComponent(dirent_path)); %>">{% trans "History" %}</a></li>
|
||||
<% if (is_pro) { %>
|
||||
<% if (file_audit_enabled) { %>
|
||||
<li><a class="op" href="{{ SITE_ROOT }}repo/file-access/<%= repo_id %>/?p=<% print(encodeURIComponent(dirent_path)); %>" target="_blank">{% trans "Access Log" %}</a></li>
|
||||
<% } %>
|
||||
<% } %>
|
||||
<li><a class="op view-details" href="#">{% trans "Details" %}</a></li>
|
||||
<% } else if (dirent.perm == 'r') { %>
|
||||
<% if (app.pageOptions.enable_file_comment) { %>
|
||||
<li><a class="op file-comment" href="#">{% trans "Comment" %}</a><li>
|
||||
<% } %>
|
||||
<li><a class="op file-history" href="{{ SITE_ROOT }}repo/file_revisions/<%= repo_id %>/?p=<% print(encodeURIComponent(dirent_path)); %>">{% trans "History" %}</a></li>
|
||||
<li><a class="op view-details" href="#">{% trans "Details" %}</a></li>
|
||||
<li><a class="op view-details" href="#">{% trans "Details" %}</a></li>
|
||||
<% } else if (dirent.perm == 'r') { %>
|
||||
<% if (app.pageOptions.enable_file_comment) { %>
|
||||
<li><a class="op file-comment" href="#">{% trans "Comment" %}</a><li>
|
||||
<% } %>
|
||||
</ul>
|
||||
</div>
|
||||
<li><a class="op file-history" href="{{ SITE_ROOT }}repo/file_revisions/<%= repo_id %>/?p=<% print(encodeURIComponent(dirent_path)); %>">{% trans "History" %}</a></li>
|
||||
<li><a class="op view-details" href="#">{% trans "Details" %}</a></li>
|
||||
<% } %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
@@ -5,7 +5,7 @@ function showSharePopup(op, name, aj_data, type, cur_path) {
|
||||
var path = cur_path + name;
|
||||
|
||||
var form = $('#file-share');
|
||||
form.modal({appendTo: "#main", focus:false});
|
||||
var modal = form.modal({appendTo: "#main", focus:false});
|
||||
|
||||
var hd = $('#file-share .hd');
|
||||
hd.html(hd.html().replace('%(name)s', '<span class="op-target">' + HTMLescape(trimFilename(name, 30)) + '</span>'));
|
||||
@@ -31,6 +31,7 @@ function showSharePopup(op, name, aj_data, type, cur_path) {
|
||||
$('input[name="file_shared_type"]').val(type);
|
||||
|
||||
$('#simplemodal-container').css({'height':'auto', 'width':'auto'});
|
||||
modal.setPosition();
|
||||
}
|
||||
|
||||
$('#send-link').on('click', function() {
|
||||
|
@@ -3,7 +3,9 @@
|
||||
|
||||
|
||||
{% block sub_title %}{{filename}} - {% endblock %}
|
||||
{% block viewport %}{% endblock %}
|
||||
{% block viewport %}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_style %}
|
||||
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/file_view_extra.css" />
|
||||
@@ -56,41 +58,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sf-btn-group file-view-op">
|
||||
<a class="sf-btn-group-btn sf-btn-group-btn-first sf-btn-link op-icon sf2-icon-folder" href="{{ SITE_ROOT }}#common/lib/{{ repo.id }}/{{ parent_dir|strip_slash }}" title="{% trans "Open parent folder" %}"></a>
|
||||
|
||||
{% if can_lock_unlock_file %}
|
||||
{% if not file_locked %}
|
||||
<button id="lock-file" class="sf-btn-group-btn op-icon sf2-icon-lock" title="{% trans "Lock" %}"></button>
|
||||
<button id="unlock-file" class="sf-btn-group-btn op-icon sf2-icon-unlock hide" title="{% trans "Unlock" %}"></button>
|
||||
{% elif locked_by_me %}
|
||||
<button id="unlock-file" class="sf-btn-group-btn op-icon sf2-icon-unlock" title="{% trans "Unlock" %}"></button>
|
||||
<button id="lock-file" class="sf-btn-group-btn op-icon sf2-icon-lock hide" title="{% trans "Lock" %}"></button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if not repo.encrypted %}
|
||||
{% if request.user.permissions.can_generate_share_link %}
|
||||
<button id="share" class="sf-btn-group-btn op-icon sf2-icon-share" data-link="{{ file_shared_link }}" data-token="{{ fileshare.token }}" title="{% trans "Share" %}"></button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if file_perm == 'rw' %}
|
||||
<a class="sf-btn-group-btn sf-btn-link op-icon sf2-icon-clock" id="history" href="{% url 'file_revisions' repo.id %}?p={{ path|urlencode }}" title="{% trans "History" %}"></a>
|
||||
{% endif %}
|
||||
|
||||
{% if request.user.is_authenticated and can_edit_file %}
|
||||
{% block edit_file %}
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
|
||||
{% if enable_file_comment %}
|
||||
<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>
|
||||
{% else %}
|
||||
<a class="sf-btn-group-btn sf-btn-group-btn-last sf-btn-link op-icon sf2-icon-download" href="?dl=1" id="download" title="{% trans "Download"%}"></a>
|
||||
{% endif %}
|
||||
|
||||
<div id="file-view-op" class="sf-btn-group file-view-op">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -104,7 +72,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% block file_view %}{% endblock %}
|
||||
{% block file_view %}{% endblock %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div id="file-discussions" class="comments-panel" style="display:none;"></div>
|
||||
@@ -159,6 +127,91 @@
|
||||
</li>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="editor-tools-tmpl">
|
||||
<a class="sf-btn-group-btn sf-btn-group-btn-first sf-btn-link op-icon sf2-icon-folder" href="{{ SITE_ROOT }}#common/lib/{{ repo.id }}/{{ parent_dir|strip_slash }}" title="{% trans "Open parent folder" %}"></a>
|
||||
|
||||
{% if can_lock_unlock_file %}
|
||||
{% if not file_locked %}
|
||||
<button id="lock-file" class="sf-btn-group-btn op-icon sf2-icon-lock" title="{% trans "Lock" %}"></button>
|
||||
<button id="unlock-file" class="sf-btn-group-btn op-icon sf2-icon-unlock hide" title="{% trans "Unlock" %}"></button>
|
||||
{% elif locked_by_me %}
|
||||
<button id="unlock-file" class="sf-btn-group-btn op-icon sf2-icon-unlock" title="{% trans "Unlock" %}"></button>
|
||||
<button id="lock-file" class="sf-btn-group-btn op-icon sf2-icon-lock hide" title="{% trans "Lock" %}"></button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if not repo.encrypted %}
|
||||
{% if request.user.permissions.can_generate_share_link %}
|
||||
<button id="share" class="sf-btn-group-btn op-icon sf2-icon-share" data-link="{{ file_shared_link }}" data-token="{{ fileshare.token }}" title="{% trans "Share" %}"></button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if file_perm == 'rw' %}
|
||||
<a class="sf-btn-group-btn sf-btn-link op-icon sf2-icon-clock" id="history" href="{% url 'file_revisions' repo.id %}?p={{ path|urlencode }}" title="{% trans "History" %}"></a>
|
||||
{% endif %}
|
||||
|
||||
{% if request.user.is_authenticated and can_edit_file %}
|
||||
{% block edit_file %}
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
|
||||
{% if enable_file_comment %}
|
||||
<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>
|
||||
{% else %}
|
||||
<a class="sf-btn-group-btn sf-btn-group-btn-last sf-btn-link op-icon sf2-icon-download" href="?dl=1" id="download" title="{% trans "Download"%}"></a>
|
||||
{% endif %}
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="mobile-editor-tools-tmpl">
|
||||
<a class="sf2-icon-more sf2-mobile-menu-toggle"></a>
|
||||
<div class="sf-dropdown-menu sf2-mobile-menu">
|
||||
<ul>
|
||||
<li>
|
||||
<a id="openParent" class="op openfolder" href="{{ SITE_ROOT }}#common/lib/{{ repo.id }}/{{ parent_dir|strip_slash }}" title="{% trans "Open parent folder" %}">{% trans "Open parent folder" %}</a>
|
||||
</li>
|
||||
|
||||
{% if can_lock_unlock_file %}
|
||||
{% if not file_locked %}
|
||||
<li id="lock-file">
|
||||
<a class="op lock-file" title="{% trans "Lock" %}">{% trans "Lock" %}</a>
|
||||
</li>
|
||||
<li id="unlock-file" class="hide">
|
||||
<a class="op unlock-file" title="{% trans "Unlock" %}">{% trans "Unlock" %}</a>
|
||||
</li>
|
||||
{% elif locked_by_me %}
|
||||
<li id="unlock-file">
|
||||
<a class="op unlock-file" title="{% trans "Unlock" %}">{% trans "Unlock" %}</a>
|
||||
</li>
|
||||
<li id="lock-file" class="hide">
|
||||
<a class="op lock-file" title="{% trans "Lock" %}">{% trans "Lock" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if not repo.encrypted %}
|
||||
{% if request.user.permissions.can_generate_share_link %}
|
||||
<li>
|
||||
<a id="share" class="op share" data-link="{{ file_shared_link }}" data-token="{{ fileshare.token }}" title="{% trans "Share" %}">{% trans "Share" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if file_perm == 'rw' %}
|
||||
<li>
|
||||
<a id="history" class="op history" href="{% url 'file_revisions' repo.id %}?p={{ path|urlencode }}" title="{% trans "History" %}">{% trans "History" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<li>
|
||||
<a id="download" class="op download" href="?dl=1" title="{% trans "Download"%}">{% trans "Download"%}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div>
|
||||
</script>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_script %}
|
||||
@@ -178,22 +231,6 @@ $(function() {
|
||||
|
||||
// share link
|
||||
{% include "snippets/shared_link_js.html" %}
|
||||
$('#share').on('click', function() {
|
||||
var op = $(this),
|
||||
name = "{{filename|escapejs}}",
|
||||
path = "{{path|escapejs}}",
|
||||
aj_data = {
|
||||
'repo_id': "{{ repo.id }}",
|
||||
'path': path
|
||||
},
|
||||
type = 'f',
|
||||
cur_path = path.substr(0, path.length - name.length);
|
||||
|
||||
showSharePopup(op, name, aj_data, type, cur_path);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
// star file
|
||||
$('#file-star').on('click', function() {
|
||||
@@ -235,26 +272,6 @@ $('#file-star').on('click', function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
{% if can_lock_unlock_file %}
|
||||
// lock/unlock file
|
||||
$('#lock-file, #unlock-file').on('click', function() {
|
||||
var op = $(this).attr('id') == 'lock-file' ? 'lock' : 'unlock',
|
||||
path = '{{path|escapejs}}';
|
||||
$.ajax({
|
||||
url: '{% url 'api-v2.1-file-view' repo.id %}' + '?p=' + encodeURIComponent(path),
|
||||
type: 'PUT',
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
beforeSend: prepareCSRFToken,
|
||||
data: {'operation': op},
|
||||
success: function() {
|
||||
$('#lock-file, #unlock-file, .file-locked-icon').toggleClass('hide');
|
||||
},
|
||||
error: ajaxErrorHandler
|
||||
});
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
// set 'side toolbar' position
|
||||
function setToolbarPos() {
|
||||
var toolbar = $('#side-toolbar');
|
||||
@@ -538,14 +555,6 @@ var fileDiscussions = {
|
||||
};
|
||||
// init
|
||||
fileDiscussions.init();
|
||||
|
||||
$('#discuss').on('click', function() {
|
||||
if (fileDiscussions.$el.is(':visible')) {
|
||||
fileDiscussions.hide();
|
||||
} else {
|
||||
fileDiscussions.show();
|
||||
}
|
||||
});
|
||||
$(document).on('keydown', function(e) {
|
||||
// ESCAPE key pressed
|
||||
if (e.which == 27) {
|
||||
@@ -553,6 +562,123 @@ $(document).on('keydown', function(e) {
|
||||
}
|
||||
});
|
||||
|
||||
var DropDownMenu = {
|
||||
$el: $("#file-view-op"),
|
||||
$mobileTmp: _.template($("#mobile-editor-tools-tmpl").html()),
|
||||
$deviceTmp: _.template($("#editor-tools-tmpl").html()),
|
||||
|
||||
init: function() {
|
||||
var _this = this;
|
||||
this.render();
|
||||
window.onresize = function(){
|
||||
_this.render();
|
||||
}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var _this = this;
|
||||
var template = $(window).width() > 992 ? this.$deviceTmp : this.$mobileTmp;
|
||||
this.$el.html(template);
|
||||
|
||||
//bind click event for the menu item;
|
||||
{% if can_lock_unlock_file %}
|
||||
// lock/unlock file
|
||||
$('#lock-file, #unlock-file').on('click', function(event) {
|
||||
var eventSource = this;
|
||||
_this.clickToggleLock(eventSource);
|
||||
})
|
||||
{% endif %}
|
||||
|
||||
$('#share').on('click', function() {
|
||||
var eventSource = $(this);
|
||||
_this.clickToShare(eventSource);
|
||||
});
|
||||
|
||||
$('#discuss').on('click', function() {
|
||||
_this.clickToCommet();
|
||||
});
|
||||
|
||||
//if mobile : bind the popmenu event
|
||||
if ($(".sf2-mobile-menu-toggle").length) {
|
||||
$(".sf2-mobile-menu-toggle").on('click',function(){
|
||||
_this.clickToShowPopMenu();
|
||||
return false;
|
||||
})
|
||||
$(document).on('click', function(e){
|
||||
var target = e.target || event.srcElement;
|
||||
var isDisplay = $('.sf2-mobile-menu').css('display') === "block" ? true : false;
|
||||
if (!isDisplay) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!$('.sf2-mobile-menu').is(target) &&
|
||||
!$('.sf2-mobile-menu').find('*').is(target)) {
|
||||
$('.sf2-mobile-menu').hide();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
$("#download").on("click", function(){
|
||||
_this.clickToClosePopMenu();
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
clickToggleLock: function(eventSource) {
|
||||
this.clickToClosePopMenu();
|
||||
var op = $(eventSource).attr('id') == 'lock-file' ? 'lock' : 'unlock',
|
||||
path = '{{path|escapejs}}';
|
||||
$.ajax({
|
||||
url: '{% url 'api-v2.1-file-view' repo.id %}' + '?p=' + encodeURIComponent(path),
|
||||
type: 'PUT',
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
beforeSend: prepareCSRFToken,
|
||||
data: {'operation': op},
|
||||
success: function() {
|
||||
$('#lock-file, #unlock-file, .file-locked-icon').toggleClass('hide');
|
||||
},
|
||||
error: ajaxErrorHandler
|
||||
});
|
||||
},
|
||||
|
||||
clickToShare: function(eventSource) {
|
||||
this.clickToClosePopMenu();
|
||||
var op = $(eventSource),
|
||||
name = "{{filename|escapejs}}",
|
||||
path = "{{path|escapejs}}",
|
||||
aj_data = {
|
||||
'repo_id': "{{ repo.id }}",
|
||||
'path': path
|
||||
},
|
||||
type = 'f',
|
||||
cur_path = path.substr(0, path.length - name.length);
|
||||
|
||||
showSharePopup(op, name, aj_data, type, cur_path);
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
clickToCommet: function() {
|
||||
if (fileDiscussions.$el.is(':visible')) {
|
||||
fileDiscussions.hide();
|
||||
} else {
|
||||
fileDiscussions.show();
|
||||
}
|
||||
},
|
||||
|
||||
clickToClosePopMenu: function() {
|
||||
$(".sf2-mobile-menu-mask").hide();
|
||||
$(".sf2-mobile-menu").hide();
|
||||
},
|
||||
|
||||
clickToShowPopMenu: function() {
|
||||
$(".sf2-mobile-menu-mask").show();
|
||||
$(".sf2-mobile-menu").show();
|
||||
}
|
||||
}
|
||||
|
||||
DropDownMenu.init();
|
||||
|
||||
// for 'go back'
|
||||
var $history = $('#history');
|
||||
$history.attr('href', $history.attr('href') + '&referer=' + encodeURIComponent(location.href));
|
||||
|
@@ -80,7 +80,7 @@ define([
|
||||
el: this.$('.sf-dropdown'),
|
||||
right: '0'
|
||||
});
|
||||
|
||||
this.mobileMenu = this.$(".mobile-menu-container");
|
||||
// for image files
|
||||
this.$('.img-name-link').magnificPopup(this.dirView.magnificPopupOptions);
|
||||
|
||||
@@ -114,7 +114,10 @@ define([
|
||||
'click .unlock-file': 'unlockFile',
|
||||
'click .view-details': 'viewDetails',
|
||||
'click .file-comment': 'viewFileComments',
|
||||
'click .open-via-client': 'open_via_client'
|
||||
'click .open-via-client': 'open_via_client',
|
||||
'click .mobile-menu-control': 'showMobileMenu',
|
||||
'click .mobile-menu-mask': 'closeMobileMenu',
|
||||
'click .download-close-menu': 'hideMobileMenu'
|
||||
},
|
||||
|
||||
getSmartLink: function() {
|
||||
@@ -354,6 +357,7 @@ define([
|
||||
if ($(window).width() < 768 &&
|
||||
!this.model.get('is_img')) { // dir or non image file
|
||||
location.href = this.$('.dirent-name a').attr('href');
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -363,6 +367,7 @@ define([
|
||||
},
|
||||
|
||||
share: function() {
|
||||
this.hideMobileMenu();
|
||||
var dir = this.dir,
|
||||
obj_name = this.model.get('obj_name'),
|
||||
dirent_path = Common.pathJoin([dir.path, obj_name]);
|
||||
@@ -388,6 +393,7 @@ define([
|
||||
},
|
||||
|
||||
del: function() {
|
||||
this.hideMobileMenu();
|
||||
var _this = this;
|
||||
if (this.model.get('is_img')) {
|
||||
var index = $('.img-name-link', this.dirView.$table).index(this.$('.img-name-link'));
|
||||
@@ -414,6 +420,7 @@ define([
|
||||
},
|
||||
|
||||
rename: function() {
|
||||
this.hideMobileMenu();
|
||||
var _this = this;
|
||||
var dirent_name = this.model.get('obj_name');
|
||||
|
||||
@@ -523,6 +530,7 @@ define([
|
||||
},
|
||||
|
||||
mvcp: function(e) {
|
||||
this.hideMobileMenu();
|
||||
var op_type = $(e.currentTarget).hasClass('mv') ? 'mv' : 'cp';
|
||||
var options = {
|
||||
'dir': this.dir,
|
||||
@@ -543,6 +551,7 @@ define([
|
||||
},
|
||||
|
||||
setFolderPerm: function() {
|
||||
this.hideMobileMenu();
|
||||
var options = {
|
||||
'obj_name': this.model.get('obj_name'),
|
||||
'dir_path': this.dir.path,
|
||||
@@ -558,6 +567,7 @@ define([
|
||||
},
|
||||
|
||||
lockFile: function() {
|
||||
this.hideMobileMenu();
|
||||
var _this = this;
|
||||
this._hideMenu();
|
||||
this.model.lockFile({
|
||||
@@ -572,6 +582,7 @@ define([
|
||||
},
|
||||
|
||||
unlockFile: function() {
|
||||
this.hideMobileMenu();
|
||||
var _this = this;
|
||||
this._hideMenu();
|
||||
this.model.unlockFile({
|
||||
@@ -586,6 +597,7 @@ define([
|
||||
},
|
||||
|
||||
viewDetails: function() {
|
||||
this.hideMobileMenu();
|
||||
if (this.dirView.fileCommentsView.$el.is(':visible')) {
|
||||
this.dirView.fileCommentsView.hide();
|
||||
}
|
||||
@@ -678,6 +690,7 @@ define([
|
||||
},
|
||||
|
||||
viewFileComments: function() {
|
||||
this.hideMobileMenu();
|
||||
if (this.dirView.direntDetailsView.$el.is(':visible')) {
|
||||
this.dirView.direntDetailsView.hide();
|
||||
}
|
||||
@@ -696,8 +709,29 @@ define([
|
||||
},
|
||||
|
||||
open_via_client: function() {
|
||||
this.hideMobileMenu();
|
||||
this._hideMenu();
|
||||
return true;
|
||||
},
|
||||
|
||||
showMobileMenu: function(event) {
|
||||
var mobileMenu = this.mobileMenu.length ? this.mobileMenu : null;
|
||||
if (mobileMenu) {
|
||||
mobileMenu.slideDown('fast');
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
hideMobileMenu: function() {
|
||||
var mobileMenu = this.mobileMenu.length ? this.mobileMenu : null;
|
||||
if (mobileMenu) {
|
||||
mobileMenu.slideUp('fast');
|
||||
}
|
||||
},
|
||||
|
||||
closeMobileMenu: function() {
|
||||
this.hideMobileMenu();
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
@@ -36,7 +36,9 @@ define([
|
||||
'click .js-popup-share-link-admin': 'popupShareLinkAdmin',
|
||||
'click .js-popup-folder-perm-admin': 'popupFolderPermAdmin',
|
||||
'click .js-repo-details': 'viewDetails',
|
||||
'click .js-add-label': 'addLabel'
|
||||
'click .js-add-label': 'addLabel',
|
||||
'click .mobile-menu-control': 'showMobileMenu',
|
||||
'click .mobile-menu-mask': 'closeMobileMenu'
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
@@ -68,6 +70,7 @@ define([
|
||||
this.dropdown = new DropdownView($.extend({
|
||||
el: this.$('.sf-dropdown')
|
||||
}, dropdownOptions));
|
||||
this.mobileMenu = this.$(".mobile-menu-container");
|
||||
return this;
|
||||
},
|
||||
|
||||
@@ -86,6 +89,7 @@ define([
|
||||
},
|
||||
|
||||
del: function() {
|
||||
this.hideMobileMenu();
|
||||
var _this = this;
|
||||
var repo_name = this.model.get('name');
|
||||
var popupTitle = gettext("Delete Library");
|
||||
@@ -115,6 +119,7 @@ define([
|
||||
},
|
||||
|
||||
share: function() {
|
||||
this.hideMobileMenu();
|
||||
var options = {
|
||||
'is_repo_owner': true,
|
||||
'is_virtual': this.model.get('virtual'),
|
||||
@@ -134,6 +139,7 @@ define([
|
||||
},
|
||||
|
||||
rename: function() {
|
||||
this.hideMobileMenu();
|
||||
var repo_name = this.model.get('name');
|
||||
|
||||
var form = $(this.renameTemplate({
|
||||
@@ -222,6 +228,7 @@ define([
|
||||
},
|
||||
|
||||
transfer: function() {
|
||||
this.hideMobileMenu();
|
||||
var _this = this;
|
||||
this.togglePopup(); // Close the popup
|
||||
|
||||
@@ -280,6 +287,7 @@ define([
|
||||
},
|
||||
|
||||
popupHistorySetting: function() {
|
||||
this.hideMobileMenu();
|
||||
var options = {
|
||||
'repo_name': this.model.get('name'),
|
||||
'repo_id': this.model.get('id'),
|
||||
@@ -291,6 +299,7 @@ define([
|
||||
},
|
||||
|
||||
popupShareLinkAdmin: function() {
|
||||
this.hideMobileMenu();
|
||||
var options = {
|
||||
'repo_name': this.model.get('name'),
|
||||
'repo_id': this.model.get('id')
|
||||
@@ -301,6 +310,7 @@ define([
|
||||
},
|
||||
|
||||
popupFolderPermAdmin: function() {
|
||||
this.hideMobileMenu();
|
||||
var options = {
|
||||
'repo_name': this.model.get('name'),
|
||||
'repo_id': this.model.get('id')
|
||||
@@ -321,6 +331,7 @@ define([
|
||||
},
|
||||
|
||||
viewDetails: function() {
|
||||
this.hideMobileMenu();
|
||||
var obj = this.model.toJSON();
|
||||
var icon_size = Common.isHiDPI() ? 48 : 24;
|
||||
var data = $.extend({}, obj, {
|
||||
@@ -429,6 +440,26 @@ define([
|
||||
return false;
|
||||
});
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
showMobileMenu: function(event) {
|
||||
var mobileMenu = this.mobileMenu.length ? this.mobileMenu : null;
|
||||
if (mobileMenu) {
|
||||
mobileMenu.slideDown('fast');
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
hideMobileMenu: function() {
|
||||
var mobileMenu = this.mobileMenu.length ? this.mobileMenu : null;
|
||||
if (mobileMenu) {
|
||||
mobileMenu.slideUp('fast');
|
||||
}
|
||||
},
|
||||
|
||||
closeMobileMenu: function() {
|
||||
this.hideMobileMenu();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user