mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-25 14:50:29 +00:00
fix bug in create repo
This commit is contained in:
@@ -4,24 +4,29 @@ define([
|
|||||||
'backbone',
|
'backbone',
|
||||||
'common',
|
'common',
|
||||||
'app/collections/repos',
|
'app/collections/repos',
|
||||||
], function($, _, Backbone, Common, Repos) {
|
'text!' + app.config._tmplRoot + 'create-repo.html',
|
||||||
|
], function($, _, Backbone, Common, Repos, CreateRepoTemplate) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var AddRepoView = Backbone.View.extend({
|
var AddRepoView = Backbone.View.extend({
|
||||||
el: '#repo-create-form',
|
|
||||||
|
|
||||||
events: {
|
tagName: 'div',
|
||||||
"submit": "addRepo",
|
|
||||||
"click #encrypt-switch": "togglePasswdInput"
|
template: _.template(CreateRepoTemplate),
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function(repos) {
|
initialize: function(repos) {
|
||||||
this.repos = repos;
|
this.repos = repos;
|
||||||
this.listenTo(repos, 'invalid', this.displayValidationErrors);
|
this.listenTo(repos, 'invalid', this.displayValidationErrors);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
events: {
|
||||||
|
"submit": "addRepo",
|
||||||
|
"click #encrypt-switch": "togglePasswdInput"
|
||||||
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
this.$el.modal({appendTo: '#main', autoResize: true});
|
this.$el.html(this.template({}));
|
||||||
|
this.$el.modal();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Generate the attributes for a new GroupRepo item.
|
// Generate the attributes for a new GroupRepo item.
|
||||||
|
@@ -70,8 +70,8 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
createRepo: function() {
|
createRepo: function() {
|
||||||
var dialog = new AddRepoView(this.repos);
|
var addRepoView = new AddRepoView(this.repos);
|
||||||
dialog.render();
|
addRepoView.render();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
27
seahub/templates/js/create-repo.html
Normal file
27
seahub/templates/js/create-repo.html
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{% load i18n %}
|
||||||
|
<form id="repo-create-form" action="" method="post">{% csrf_token %}
|
||||||
|
<h3>{% trans "New Library"%}</h3>
|
||||||
|
<label>{% trans "Name"%}</label><br/>
|
||||||
|
<input type="text" name="repo_name" value="" maxlength="{{max_file_name}}" class="input" /><br />
|
||||||
|
<label>{% trans "Description"%}</label><br/>
|
||||||
|
<textarea name="repo_desc" class="textarea"></textarea><br />
|
||||||
|
{% if create_shared_repo %}
|
||||||
|
<label>{% trans "Share Permission"%}</label><br />
|
||||||
|
<select name="permission" class="perm">
|
||||||
|
<option value="rw" selected="selected">{% trans "Read-Write"%}</option>
|
||||||
|
<option value="r">{% trans "Read-Only"%}</option>
|
||||||
|
</select>
|
||||||
|
{% endif %}
|
||||||
|
<div class="repo-create-encryption">
|
||||||
|
<label class="checkbox-label">
|
||||||
|
<span class="checkbox"><input type="checkbox" name="encryption" id="encrypt-switch" class="checkbox-orig" /></span>
|
||||||
|
<span class="checkbox-option">{% trans "Encrypt"%}</span>
|
||||||
|
</label>
|
||||||
|
<label>{% trans "Password"%}</label><span class="tip">{% blocktrans %}(at least {{repo_password_min_length}} characters){% endblocktrans %}</span><br />
|
||||||
|
<input type="password" name="passwd" disabled="disabled" class="input input-disabled" /><br />
|
||||||
|
<label>{% trans "Password again"%}</label><br />
|
||||||
|
<input type="password" name="passwd_again" disabled="disabled" class="input input-disabled" />
|
||||||
|
</div>
|
||||||
|
<p class="error hide"></p>
|
||||||
|
<input type="submit" value="{% trans "Submit"%}" class="submit" />
|
||||||
|
</form>
|
Reference in New Issue
Block a user