##// END OF EJS Templates
archiving: make it explicit archiving a repo is irreversible.
archiving: make it explicit archiving a repo is irreversible.

File last commit:

r4449:5be9b639 default
r4689:fb78c106 stable
Show More
files_upload.mako
211 lines | 7.0 KiB | application/x-mako | MakoHtmlLexer
files: split add/upload templaates
r3710 <%inherit file="/base/base.mako"/>
<%def name="title()">
dan
file: new file editors...
r3754 ${_('{} Files Upload').format(c.repo_name)}
files: split add/upload templaates
r3710 %if c.rhodecode_name:
&middot; ${h.branding(c.rhodecode_name)}
%endif
</%def>
<%def name="menu_bar_nav()">
${self.menu_items(active='repositories')}
</%def>
dan
file: new file editors...
r3754 <%def name="breadcrumbs_links()"></%def>
files: split add/upload templaates
r3710
<%def name="menu_bar_subnav()">
${self.repo_menu(active='files')}
</%def>
<%def name="main()">
dan
file: new file editors...
r3754
files: split add/upload templaates
r3710 <div class="box">
dan
file: new file editors...
r3754 ## Template for uploads
<div style="display: none" id="tpl-dropzone">
<div class="dz-preview dz-file-preview">
<div class="dz-details">
<div class="dz-filename">
<span data-dz-name></span>
</div>
<div class="dz-filename-size">
<span class="dz-size" data-dz-size></span>
files: split add/upload templaates
r3710
dan
file: new file editors...
r3754 </div>
<div class="dz-sending" style="display: none">${_('Uploading...')}</div>
<div class="dz-response" style="display: none">
${_('Uploaded')} 100%
</div>
</div>
<div class="dz-progress">
<span class="dz-upload" data-dz-uploadprogress></span>
</div>
<div class="dz-error-message">
</div>
</div>
files: split add/upload templaates
r3710 </div>
dan
file: new file editors...
r3754 <div class="edit-file-title">
<span class="title-heading">${_('Upload new file')} @ <code>${h.show_id(c.commit)}</code></span>
dan
files: fixed branch icon for SVN...
r3755 % if c.commit.branch:
<span class="tag branchtag">
<i class="icon-branch"></i> ${c.commit.branch}
</span>
% endif
dan
file: new file editors...
r3754 </div>
<% form_url = h.route_path('repo_files_upload_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path) %>
##${h.secure_form(form_url, id='eform', enctype="multipart/form-data", request=request)}
files: split add/upload templaates
r3710 <div class="edit-file-fieldset">
dan
file: new file editors...
r3754 <div class="path-items">
dan
ui: added secondary action instead of two buttons on files page....
r4449 <ul class="tooltip" title="Repository path to store uploaded files. To change it, navigate to different path and click upload from there.">
dan
file: new file editors...
r3754 <li class="breadcrumb-path">
files: split add/upload templaates
r3710 <div>
dan
file: new file editors...
r3754 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path='')}"><i class="icon-home"></i></a> /
dan
ui: added secondary action instead of two buttons on files page....
r4449 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">${c.f_path}</a>${('/' if c.f_path else '')}
files: split add/upload templaates
r3710 </div>
dan
file: new file editors...
r3754 </li>
<li class="location-path">
</li>
</ul>
files: split add/upload templaates
r3710 </div>
dan
file: new file editors...
r3754 </div>
<div class="upload-form table">
ui: new commits page....
r3882 <div>
files: split add/upload templaates
r3710
dan
ui: added secondary action instead of two buttons on files page....
r4449 <div class="dropzone-wrapper" id="file-uploader" style="border: none; padding: 40px 0">
dan
file: new file editors...
r3754 <div class="dropzone-pure">
<div class="dz-message">
<i class="icon-upload" style="font-size:36px"></i></br>
${_("Drag'n Drop files here or")} <span class="link">${_('Choose your files')}</span>.<br>
</div>
</div>
files: split add/upload templaates
r3710 </div>
</div>
</div>
dan
file: new file editors...
r3754 <div class="upload-form edit-file-fieldset">
<div class="fieldset">
<div class="message">
<textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
files: split add/upload templaates
r3710 </div>
dan
file: new file editors...
r3754 </div>
<div class="pull-left">
${h.submit('commit_btn',_('Commit changes'), class_="btn btn-small btn-success")}
files: split add/upload templaates
r3710 </div>
</div>
dan
file: new file editors...
r3754 ##${h.end_form()}
files: split add/upload templaates
r3710
dan
file: new file editors...
r3754 <div class="file-upload-transaction-wrapper" style="display: none">
<div class="file-upload-transaction">
dan
files: add pre-commit checks on file operations to prevent loosing content while editing when repositories change....
r4302 <h3>${_('Committing...')}</h3>
dan
file: new file editors...
r3754 <p>${_('Please wait while the files are being uploaded')}</p>
<p class="error" style="display: none">
</p>
<i class="icon-spin animate-spin"></i>
<p></p>
files: split add/upload templaates
r3710 </div>
dan
file: new file editors...
r3754 </div>
files: split add/upload templaates
r3710 </div>
dan
file: new file editors...
r3754
files: split add/upload templaates
r3710 <script type="text/javascript">
dan
file: new file editors...
r3754 $(document).ready(function () {
files: split add/upload templaates
r3710
dan
file: new file editors...
r3754 //see: https://www.dropzonejs.com/#configuration
myDropzone = new Dropzone("div#file-uploader", {
url: "${form_url}",
headers: {"X-CSRF-Token": CSRF_TOKEN},
paramName: function () {
return "files_upload"
}, // The name that will be used to transfer the file
parallelUploads: 20,
maxFiles: 20,
uploadMultiple: true,
//chunking: true, // use chunking transfer, not supported at the moment
//maxFilesize: 2, // in MBs
autoProcessQueue: false, // if false queue will not be processed automatically.
createImageThumbnails: false,
previewTemplate: document.querySelector('#tpl-dropzone').innerHTML,
accept: function (file, done) {
done();
},
init: function () {
this.on("addedfile", function (file) {
files: split add/upload templaates
r3710
dan
file: new file editors...
r3754 });
this.on("sending", function (file, xhr, formData) {
formData.append("message", $('#commit').val());
$(file.previewElement).find('.dz-sending').show();
});
files: split add/upload templaates
r3710
dan
file: new file editors...
r3754 this.on("success", function (file, response) {
$(file.previewElement).find('.dz-sending').hide();
$(file.previewElement).find('.dz-response').show();
if (response.error !== null) {
$('.file-upload-transaction-wrapper .error').html('ERROR: {0}'.format(response.error));
$('.file-upload-transaction-wrapper .error').show();
$('.file-upload-transaction-wrapper i').hide()
}
var redirect_url = response.redirect_url || '/';
window.location = redirect_url
files: split add/upload templaates
r3710
dan
file: new file editors...
r3754 });
this.on("error", function (file, errorMessage, xhr) {
var error = null;
files: split add/upload templaates
r3710
dan
file: new file editors...
r3754 if (xhr !== undefined){
var httpStatus = xhr.status + " " + xhr.statusText;
uploads: handle server errors nicer
r3994 if (xhr !== undefined && xhr.status >= 500) {
dan
file: new file editors...
r3754 error = httpStatus;
}
}
files: split add/upload templaates
r3710
dan
file: new file editors...
r3754 if (error === null) {
error = errorMessage.error || errorMessage || httpStatus;
}
$(file.previewElement).find('.dz-error-message').html('ERROR: {0}'.format(error));
});
}
});
files: split add/upload templaates
r3710
dan
file: new file editors...
r3754 $('#commit_btn').on('click', function(e) {
e.preventDefault();
var button = $(this);
if (button.hasClass('clicked')) {
button.attr('disabled', true);
} else {
button.addClass('clicked');
}
files: split add/upload templaates
r3710
dan
file: new file editors...
r3754 var files = myDropzone.getQueuedFiles();
if (files.length === 0) {
alert("Missing files");
e.preventDefault();
}
$('.upload-form').hide();
$('.file-upload-transaction-wrapper').show();
myDropzone.processQueue();
});
files: split add/upload templaates
r3710 });
</script>
</%def>