mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +00:00
modified 'repo create' for myhome/group/org
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user