1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-16 07:08:55 +00:00

Drafts module (#2375)

This commit is contained in:
shanshuirenjia
2018-09-15 16:14:17 +08:00
committed by Daniel Pan
parent 0a3296d304
commit e793730939
29 changed files with 1037 additions and 3 deletions

View File

@@ -110,6 +110,7 @@ define([
'click .rename': 'rename',
'click .mv': 'mvcp',
'click .cp': 'mvcp',
'click .new-draft': 'newDraft',
'click .set-folder-permission': 'setFolderPerm',
'click .lock-file': 'lockFile',
'click .unlock-file': 'unlockFile',
@@ -608,6 +609,34 @@ define([
return false;
},
newDraft: function() {
var repoID = this.dir.repo_id;
var filePath = Common.pathJoin([this.dir.path, this.model.get('obj_name')]);
var data = {
repo_id: repoID,
file_path: filePath
};
$.ajax({
url: Common.getUrl({name: 'new-draft'}),
dataType: 'json',
data: data,
cache: false,
type: 'POST',
beforeSend: Common.prepareCSRFToken,
success: function(res) {
var msg = gettext("New Success.");
Common.feedback(msg, 'success');
},
error: function() {
var err_msg = gettext("The draft is already exist.");
Common.feedback(err_msg, 'error');
}
});
this.hideMobileMenu();
this._hideMenu();
return false;
},
viewDetails: function() {
this.hideMobileMenu();
if (this.dirView.fileCommentsView.$el.is(':visible')) {

View File

@@ -224,6 +224,9 @@ define([
case 'org-admin-group-owned-library': return siteRoot + 'api/v2.1/org/' + options.org_id + '/admin/groups/' + options.group_id + '/group-owned-libraries/' + options.repo_id + '/';
case 'license': return siteRoot + 'api/v2.1/admin/license/';
//drafts
case 'new-draft': return siteRoot + 'api/v2.1/drafts/';
}
},