mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-12 13:24:52 +00:00
[fileupload] use dropdown
This commit is contained in:
@@ -2098,7 +2098,7 @@ button.dropdown-toggle:focus {
|
||||
}
|
||||
#upload-menu .item {
|
||||
position:relative;
|
||||
text-align:left;
|
||||
white-space:nowrap;
|
||||
overflow:hidden; /* for 'hover', as long 'input' in it. */
|
||||
}
|
||||
.fixed-upload-file-dialog {
|
||||
|
@@ -105,7 +105,9 @@
|
||||
<input type="file" name="file" multiple />
|
||||
</div>
|
||||
<% if (enable_upload_folder) { %>
|
||||
<ul id="upload-menu" class="hide">
|
||||
<div id="advanced-upload" class="dropdown dropdown-inline" style="display:none;">
|
||||
<button class="dropdown-toggle op-btn">{% trans "Upload" %}</button>
|
||||
<ul id="upload-menu" class="dropdown-menu hide">
|
||||
<li class="item">
|
||||
<span>{% trans "Upload Files" %}</span>
|
||||
<input type="file" name="file" multiple />
|
||||
@@ -115,6 +117,7 @@
|
||||
<input type="file" name="file" multiple directory webkitdirectory />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% } %>
|
||||
<button id="add-new-dir" class="op-btn">{% trans "New Folder" %}</button>
|
||||
<button id="add-new-file" class="op-btn">{% trans "New File" %}</button>
|
||||
|
@@ -12,10 +12,11 @@ define([
|
||||
'app/views/dirent',
|
||||
'app/views/dirent-grid',
|
||||
'app/views/fileupload',
|
||||
'app/views/share'
|
||||
'app/views/share',
|
||||
'app/views/widgets/dropdown'
|
||||
], function($, progressbar, magnificPopup, simplemodal, _, Backbone, Common,
|
||||
FileTree, Cookies, DirentCollection, DirentView, DirentGridView,
|
||||
FileUploadView, ShareView) {
|
||||
FileUploadView, ShareView, DropdownView) {
|
||||
'use strict';
|
||||
|
||||
var DirView = Backbone.View.extend({
|
||||
@@ -205,6 +206,10 @@ define([
|
||||
this.render_dirents_slice(this.dir.last_start, this.dir.limit);
|
||||
|
||||
this.fileUploadView.setFileInput();
|
||||
this.upload_dropdown = new DropdownView({
|
||||
el: this.$('#advanced-upload')
|
||||
});
|
||||
|
||||
this.getImageThumbnail();
|
||||
},
|
||||
|
||||
|
@@ -422,15 +422,6 @@ define([
|
||||
window.location.href.replace(/\/repo\/[-a-z0-9]{36}\/.*/, app.config.mediaUrl + 'cors/result.html?%s')
|
||||
);
|
||||
|
||||
$(document).click(function(e) {
|
||||
var target = e.target || event.srcElement;
|
||||
var closePopup = function(popup, popup_switch) {
|
||||
if (!popup.hasClass('hide') && !popup.is(target) && !popup.find('*').is(target) && !popup_switch.is(target) && !popup_switch.find('*').is(target) ) {
|
||||
popup.addClass('hide');
|
||||
}
|
||||
};
|
||||
closePopup(dirView.$('#upload-menu'), dirView.$('#upload-file'));
|
||||
});
|
||||
},
|
||||
|
||||
events: {
|
||||
@@ -476,7 +467,9 @@ define([
|
||||
|
||||
if (dir.user_perm && dir.user_perm == 'rw' &&
|
||||
'webkitdirectory' in $('input[type="file"]', upload_btn)[0]) {
|
||||
upload_btn.find('input').remove().end().addClass('cspt');
|
||||
upload_btn.remove();
|
||||
$('#advanced-upload').removeAttr('style'); // show it
|
||||
|
||||
$('.item', upload_menu).click(function() {
|
||||
popup.fileupload(
|
||||
'option',
|
||||
@@ -492,13 +485,6 @@ define([
|
||||
$(this).css({'background':'transparent'});
|
||||
}
|
||||
);
|
||||
upload_btn.click(function () {
|
||||
upload_menu.toggleClass('hide');
|
||||
upload_menu.css({
|
||||
'left': upload_btn.position().left,
|
||||
'top': parseInt(dirView.$('.repo-op').css('padding-top')) + upload_btn.outerHeight(true)
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user