diff options
author | Unknown <joe2010xtmf@163.com> | 2014-03-06 11:12:37 -0500 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-03-06 11:12:37 -0500 |
commit | d8b92b4bc99d642c7fd9a6080bdfa8d782e8c325 (patch) | |
tree | ba54f16bd242d619bb4ffdc051ea07a6c2311117 /public/js/app.js | |
parent | 1249392c8390d9e348c388c0ad6e80fce208cd95 (diff) | |
parent | 4c1858c07b972e64d47218646f89b2fb5340a993 (diff) |
Merge branch 'master' of github.com:gogits/gogs
Conflicts:
templates/user/signup.tmpl
Diffstat (limited to 'public/js/app.js')
-rw-r--r-- | public/js/app.js | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/public/js/app.js b/public/js/app.js index 414af135..6a4c72bd 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1,7 +1,9 @@ -var Gogits = {}; +var Gogits = { + "PageIsSignup": false +}; -(function($){ - Gogits.showTooltips = function(){ +(function ($) { + Gogits.showTooltips = function () { $("body").tooltip({ selector: "[data-toggle=tooltip]" //container: "body" @@ -13,10 +15,48 @@ var Gogits = {}; } $(selector).tab("show"); $(selector).find("li:eq(" + index + ") a").tab("show"); - } + }; + Gogits.validateForm = function (selector, options) { + var $form = $(selector); + options = options || {}; + options.showErrors = function (map, list) { + var $error = $form.find('.form-error').addClass('hidden'); + $('.has-error').removeClass("has-error"); + $error.text(list[0].message).show().removeClass("hidden"); + $(list[0].element).parents(".form-group").addClass("has-error"); + }; + $form.validate(options); + }; })(jQuery); -function initCore(){ +function initCore() { Gogits.showTooltips(); +} + +function initRegister() { + $.getScript("/js/jquery.validate.min.js", function () { + Gogits.validateForm("#gogs-login-card", { + rules: { + "username": { + required: true, + minlength: 5, + maxlength: 30 + }, + "email": { + required: true, + email: true + }, + "passwd": { + required: true, + minlength: 6, + maxlength: 30 + }, + "re-passwd": { + required: true, + equalTo: "input[name=passwd]" + } + } + }); + }); }
\ No newline at end of file |