1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-18 16:36:15 +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
"owner": username,
"owner_nickname": email2nickname(username),
"share_from_me": True,
}
return Response(group_repo, status=200)

View File

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

View File

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

View File

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

View File

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