0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-22 13:54:17 +01:00

work on #470 and fix miror JS issue when choose targets on compare and pull

This commit is contained in:
Unknwon 2015-10-29 21:09:48 -04:00
parent 706b0f72e2
commit 7d72c8333e
7 changed files with 26 additions and 18 deletions

View file

@ -111,7 +111,7 @@ admin_title = Admin Account Settings
admin_name = Username
admin_password = Password
confirm_password = Confirm Password
admin_email = E-mail
admin_email = Admin E-mail
install_gogs = Install Gogs
test_git_failed = Fail to test 'git' command: %v
sqlite3_not_available = Your release version does not support SQLite3, please download the official binary version from %s, NOT the gobuild version.
@ -192,6 +192,7 @@ min_size_error = ` must contain at least %s characters.`
max_size_error = ` must contain at most %s characters.`
email_error = ` is not a valid e-mail address.`
url_error = ` is not a valid URL.`
include_error = ` must contain substring '%s'.`
unknown_error = Unknown error:
captcha_incorrect = Captcha didn't match.
password_not_match = Password and confirm password are not same.

View file

@ -181,7 +181,7 @@ func AssignForm(form interface{}, data map[string]interface{}) {
}
}
func getSize(field reflect.StructField, prefix string) string {
func getRuleBody(field reflect.StructField, prefix string) string {
for _, rule := range strings.Split(field.Tag.Get("binding"), ";") {
if strings.HasPrefix(rule, prefix) {
return rule[len(prefix) : len(rule)-1]
@ -191,15 +191,19 @@ func getSize(field reflect.StructField, prefix string) string {
}
func GetSize(field reflect.StructField) string {
return getSize(field, "Size(")
return getRuleBody(field, "Size(")
}
func GetMinSize(field reflect.StructField) string {
return getSize(field, "MinSize(")
return getRuleBody(field, "MinSize(")
}
func GetMaxSize(field reflect.StructField) string {
return getSize(field, "MaxSize(")
return getRuleBody(field, "MaxSize(")
}
func GetInclude(field reflect.StructField) string {
return getRuleBody(field, "Include(")
}
// FIXME: struct contains a struct
@ -260,6 +264,8 @@ func validate(errs binding.Errors, data map[string]interface{}, f Form, l macaro
data["ErrorMsg"] = trName + l.Tr("form.email_error")
case binding.ERR_URL:
data["ErrorMsg"] = trName + l.Tr("form.url_error")
case binding.ERR_INCLUDE:
data["ErrorMsg"] = trName + l.Tr("form.include_error", GetInclude(field))
default:
data["ErrorMsg"] = l.Tr("form.unknown_error") + " " + errs[0].Classification
}

View file

@ -44,7 +44,7 @@ type InstallForm struct {
AdminName string `binding:"OmitEmpty;AlphaDashDot;MaxSize(30)" locale:"install.admin_name"`
AdminPasswd string `binding:"OmitEmpty;MaxSize(255)" locale:"install.admin_password"`
AdminConfirmPasswd string
AdminEmail string `binding:"OmitEmpty;Email;MaxSize(50)" locale:"install.admin_email"`
AdminEmail string `binding:"OmitEmpty;MinSize(3);MaxSize(50);Include(@)" locale:"install.admin_email"`
}
func (f *InstallForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {

File diff suppressed because one or more lines are too long

View file

@ -384,9 +384,7 @@ function initRepository() {
// Diff
if ($('.repository.diff').length > 0) {
var $counter = $('.diff-counter');
if ($counter.length < 1) {
return;
}
if ($counter.length >= 1) {
$counter.each(function (i, item) {
var $item = $(item);
var addLine = $item.find('span[data-line].add').data("line");
@ -395,6 +393,7 @@ function initRepository() {
$item.find(".bar .add").css("width", addPercent + "%");
});
}
}
// Quick start
if ($('.repository.quickstart').length > 0) {
@ -419,6 +418,7 @@ function initRepository() {
fullTextSearch: true,
onChange: function (text, value, $choice) {
window.location.href = $choice.data('url');
console.log($choice.data('url'))
},
message: {noResults: $branch_dropdown.data('no-results')}
});

View file

@ -173,6 +173,7 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) {
ctx.HTML(200, INSTALL)
return
}
return
if _, err := exec.LookPath("git"); err != nil {
ctx.RenderWithErr(ctx.Tr("install.test_git_failed", err), INSTALL, &form)

View file

@ -214,7 +214,7 @@
</div>
<div class="inline field {{if .Err_AdminEmail}}error{{end}}">
<label for="admin_email">{{.i18n.Tr "install.admin_email"}}</label>
<input id="admin_email" name="admin_email" value="{{.admin_email}}">
<input id="admin_email" name="admin_email" type="email1" value="{{.admin_email}}">
</div>
</div>
</div>