mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 07:55:36 +00:00
first : modify the editor to be resposed for pc and mobile;
second: change the editor menu style for different device;
This commit is contained in:
@@ -4234,3 +4234,91 @@ img.thumbnail {
|
||||
display:inline-block;
|
||||
margin-top:4px;
|
||||
}
|
||||
|
||||
/* mobile-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;
|
||||
}
|
||||
|
||||
/* // Medium devices (tablets, less than 992px) */
|
||||
@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%;
|
||||
}
|
||||
}
|
||||
|
@@ -141,9 +141,11 @@
|
||||
</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">
|
||||
<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>
|
||||
@@ -162,6 +164,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<% } else { %>
|
||||
<td>{% trans "Broken (please contact your administrator to fix this library)" %}</td>
|
||||
@@ -842,11 +845,12 @@
|
||||
</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">
|
||||
<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" href="<%= download_url %>">{% trans "Download" %}</a></li>
|
||||
<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>
|
||||
<% } %>
|
||||
@@ -874,7 +878,7 @@
|
||||
<% } %>
|
||||
<% } %>
|
||||
</ul>
|
||||
<div class="menu-inner-divider"></div>
|
||||
<!-- <div class="menu-inner-divider"></div> -->
|
||||
<ul>
|
||||
<% if (dirent.perm == 'rw') { %>
|
||||
<% if (app.pageOptions.enable_file_comment) { %>
|
||||
@@ -897,7 +901,6 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</script>
|
||||
|
||||
|
@@ -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>
|
||||
@@ -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');
|
||||
@@ -556,14 +573,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) {
|
||||
@@ -571,6 +580,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() {
|
||||
@@ -358,6 +361,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;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -367,6 +371,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]);
|
||||
@@ -392,6 +397,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'));
|
||||
@@ -418,6 +424,7 @@ define([
|
||||
},
|
||||
|
||||
rename: function() {
|
||||
this.hideMobileMenu();
|
||||
var _this = this;
|
||||
var dirent_name = this.model.get('obj_name');
|
||||
|
||||
@@ -532,6 +539,7 @@ define([
|
||||
},
|
||||
|
||||
mvcp: function(e) {
|
||||
this.hideMobileMenu();
|
||||
var op_type = $(e.currentTarget).hasClass('mv') ? 'mv' : 'cp';
|
||||
var options = {
|
||||
'dir': this.dir,
|
||||
@@ -552,6 +560,7 @@ define([
|
||||
},
|
||||
|
||||
setFolderPerm: function() {
|
||||
this.hideMobileMenu();
|
||||
var options = {
|
||||
'obj_name': this.model.get('obj_name'),
|
||||
'dir_path': this.dir.path,
|
||||
@@ -567,6 +576,7 @@ define([
|
||||
},
|
||||
|
||||
lockFile: function() {
|
||||
this.hideMobileMenu();
|
||||
var _this = this;
|
||||
this._hideMenu();
|
||||
this.model.lockFile({
|
||||
@@ -581,6 +591,7 @@ define([
|
||||
},
|
||||
|
||||
unlockFile: function() {
|
||||
this.hideMobileMenu();
|
||||
var _this = this;
|
||||
this._hideMenu();
|
||||
this.model.unlockFile({
|
||||
@@ -595,6 +606,7 @@ define([
|
||||
},
|
||||
|
||||
viewDetails: function() {
|
||||
this.hideMobileMenu();
|
||||
if (this.dirView.fileCommentsView.$el.is(':visible')) {
|
||||
this.dirView.fileCommentsView.hide();
|
||||
}
|
||||
@@ -699,6 +711,7 @@ define([
|
||||
},
|
||||
|
||||
viewFileComments: function() {
|
||||
this.hideMobileMenu();
|
||||
if (this.dirView.direntDetailsView.$el.is(':visible')) {
|
||||
this.dirView.direntDetailsView.hide();
|
||||
}
|
||||
@@ -717,8 +730,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({
|
||||
@@ -227,6 +233,7 @@ define([
|
||||
},
|
||||
|
||||
transfer: function() {
|
||||
this.hideMobileMenu();
|
||||
var _this = this;
|
||||
this.togglePopup(); // Close the popup
|
||||
|
||||
@@ -291,6 +298,7 @@ define([
|
||||
},
|
||||
|
||||
popupHistorySetting: function() {
|
||||
this.hideMobileMenu();
|
||||
var options = {
|
||||
'repo_name': this.model.get('name'),
|
||||
'repo_id': this.model.get('id'),
|
||||
@@ -302,6 +310,7 @@ define([
|
||||
},
|
||||
|
||||
popupShareLinkAdmin: function() {
|
||||
this.hideMobileMenu();
|
||||
var options = {
|
||||
'repo_name': this.model.get('name'),
|
||||
'repo_id': this.model.get('id')
|
||||
@@ -312,6 +321,7 @@ define([
|
||||
},
|
||||
|
||||
popupFolderPermAdmin: function() {
|
||||
this.hideMobileMenu();
|
||||
var options = {
|
||||
'repo_name': this.model.get('name'),
|
||||
'repo_id': this.model.get('id')
|
||||
@@ -332,6 +342,7 @@ define([
|
||||
},
|
||||
|
||||
viewDetails: function() {
|
||||
this.hideMobileMenu();
|
||||
var obj = this.model.toJSON();
|
||||
var icon_size = Common.isHiDPI() ? 48 : 24;
|
||||
var data = $.extend({}, obj, {
|
||||
@@ -447,6 +458,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