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

Move scripts from media to static folder

This commit is contained in:
zhengxie
2015-04-03 11:02:11 +08:00
committed by Daniel Pan
parent 62fe930d3a
commit f022b4902e
62 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
define([
'underscore',
'backbone'
], function(_, Backbone) {
'use strict';
var Repo = Backbone.Model.extend({
defaults: {
id: null,
name: "",
desc: "",
mtime: 0,
mtime_relative: "",
encrypted: false,
owner: "-",
owner_nickname: "-"
},
parse: function(response) {
var attrs = _.clone(response);
attrs.id = response.id || response.repo_id;
attrs.name = response.name || response.repo_name;
attrs.desc = response.desc || response.repo_desc;
attrs.size_formatted = response.size_formatted || response.repo_size_formatted;
return attrs;
},
validate: function(attrs, options) {
if (!attrs.name) return gettext("Name is required");
if (attrs.encrypted) {
if (!attrs.passwd1) return gettext("Please enter password");
if (!attrs.passwd2) return gettext("Please enter the password again");
if (attrs.passwd1.length < app.pageOptions.repo_password_min_length) {
return gettext("Password is too short");
}
if (attrs.passwd1 != attrs.passwd2) return gettext("Passwords don't match");
}
}
});
return Repo;
});