1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-18 00:00:00 +00:00

modified 'repo create' for myhome/group/org

This commit is contained in:
llj
2015-04-22 18:45:28 +08:00
parent b00d29c8e2
commit 5c75344bfa
5 changed files with 20 additions and 15 deletions

View File

@@ -3123,6 +3123,7 @@ class GroupRepos(APIView):
"permission": 'rw', # Always have read-write permission to owned repo "permission": 'rw', # Always have read-write permission to owned repo
"owner": username, "owner": username,
"owner_nickname": email2nickname(username), "owner_nickname": email2nickname(username),
"share_from_me": True,
} }
return Response(group_repo, status=200) return Response(group_repo, status=200)

View File

@@ -15,17 +15,17 @@ define([
initialize: function(repos) { initialize: function(repos) {
this.repos = repos; this.repos = repos;
this.listenTo(repos, 'invalid', this.displayValidationErrors);
},
events: { this.render();
"submit": "addRepo", this.$el.modal();
"click #encrypt-switch": "togglePasswdInput" $("#simplemodal-container").css({'height':'auto'});
this.listenTo(repos, 'invalid', this.displayValidationErrors);
}, },
render: function() { render: function() {
this.$el.html(this.template(this.templateData())); this.$el.html(this.template(this.templateData()));
this.$el.modal(); return this;
}, },
templateData: function() { templateData: function() {
@@ -34,6 +34,11 @@ define([
}; };
}, },
events: {
"submit": "addRepo",
"click #encrypt-switch": "togglePasswdInput"
},
// Generate the attributes for a new GroupRepo item. // Generate the attributes for a new GroupRepo item.
newAttributes: function() { newAttributes: function() {
return { return {
@@ -48,19 +53,20 @@ define([
// TODO: move to common // TODO: move to common
displayValidationErrors: function(model, error, options) { displayValidationErrors: function(model, error, options) {
this.$('.error').html(error).show(); this.$('.error').html(error).show();
$("#simplemodal-container").css({'height':'auto'});
}, },
addRepo: function(e) { addRepo: function(e) {
e.preventDefault(); e.preventDefault();
this.repos.create(this.newAttributes(), { var repos = this.repos;
repos.create(this.newAttributes(), {
wait: true, wait: true,
validate: true, validate: true,
prepend: true, // show newly created repo at first line prepend: true, // show newly created repo at first line
success: function() { success: function() {
// No need to show feedback if (repos.length == 1) {
// Common.feedback('Success', 'success', Common.SUCCESS_TIMEOUT); repos.fetch({reset: true});
}
}, },
error: function(xhr, textStatus, errorThrown) { error: function(xhr, textStatus, errorThrown) {
// TODO: handle error gracefully // TODO: handle error gracefully

View File

@@ -97,8 +97,7 @@ define([
}, },
createRepo: function() { createRepo: function() {
var addGroupRepoView = new AddGroupRepoView(this.repos); new AddGroupRepoView(this.repos);
addGroupRepoView.render();
}, },
sortByName: function() { sortByName: function() {

View File

@@ -81,8 +81,7 @@ define([
}, },
createRepo: function() { createRepo: function() {
var addRepoView = new AddRepoView(this.repos); new AddRepoView(this.repos);
addRepoView.render();
}, },
sortByName: function() { sortByName: function() {

View File

@@ -36,7 +36,7 @@ define([
}, },
createRepo: function() { createRepo: function() {
new AddPubRepoView(this.repos).render(); new AddPubRepoView(this.repos);
}, },
addOne: function(repo, collection, options) { addOne: function(repo, collection, options) {