Browse Source

username & repo-name changing help message

pull/68/head
FuXiaoHei 11 years ago
parent
commit
d3a987eded
  1. 27
      public/js/app.js
  2. 5
      templates/repo/setting.tmpl
  3. 5
      templates/user/setting.tmpl

27
public/js/app.js

@ -354,6 +354,7 @@ function initRegister() {
} }
function initUserSetting() { function initUserSetting() {
// ssh confirmation
$('#ssh-keys .delete').confirmation({ $('#ssh-keys .delete').confirmation({
singleton: true, singleton: true,
onConfirm: function (e, $this) { onConfirm: function (e, $this) {
@ -366,6 +367,18 @@ function initUserSetting() {
}); });
} }
}); });
// profile form
(function () {
$('#user-setting-username').on("keyup", function () {
var $this = $(this);
if ($this.val() != $this.attr('title')) {
$this.next('.help-block').toggleShow();
} else {
$this.next('.help-block').toggleHide();
}
});
}())
} }
function initRepository() { function initRepository() {
@ -383,7 +396,7 @@ function initRepository() {
$clone.find('span.clone-url').text($this.data('link')); $clone.find('span.clone-url').text($this.data('link'));
} }
}).eq(0).trigger("click"); }).eq(0).trigger("click");
$("#repo-clone").on("shown.bs.dropdown",function () { $("#repo-clone").on("shown.bs.dropdown", function () {
Gogits.bindCopy("[data-init=copy]"); Gogits.bindCopy("[data-init=copy]");
}); });
Gogits.bindCopy("[data-init=copy]:visible"); Gogits.bindCopy("[data-init=copy]:visible");
@ -438,6 +451,18 @@ function initRepository() {
$item.find(".bar .add").css("width", addPercent + "%"); $item.find(".bar .add").css("width", addPercent + "%");
}); });
}()); }());
// repo setting form
(function () {
$('#repo-setting-name').on("keyup", function () {
var $this = $(this);
if ($this.val() != $this.attr('title')) {
$this.next('.help-block').toggleShow();
} else {
$this.next('.help-block').toggleHide();
}
});
}())
} }
function initInstall() { function initInstall() {

5
templates/repo/setting.tmpl

@ -23,9 +23,10 @@
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<input type="hidden" name="action" value="update"> <input type="hidden" name="action" value="update">
<div class="form-group"> <div class="form-group">
<label class="col-md-3 text-right">Name</label> <label class="col-md-3 text-right" for="repo-setting-name">Name</label>
<div class="col-md-9"> <div class="col-md-9">
<input class="form-control" name="name" value="{{.Repository.Name}}" title="{{.Repository.Name}}" /> <input class="form-control" name="name" value="{{.Repository.Name}}" title="{{.Repository.Name}}" id="repo-setting-name"/>
<p class="help-block hidden"><span class="text-danger">Cautious : </span>your repository name is changing !</p>
</div> </div>
</div> </div>

5
templates/user/setting.tmpl

@ -10,9 +10,10 @@
{{if .IsSuccess}}<p class="alert alert-success">Your profile has been successfully updated.</p>{{else if .HasError}}<p class="alert alert-danger form-error">{{.ErrorMsg}}</p>{{end}} {{if .IsSuccess}}<p class="alert alert-success">Your profile has been successfully updated.</p>{{else if .HasError}}<p class="alert alert-danger form-error">{{.ErrorMsg}}</p>{{end}}
<p>Your Email will be public and used for Account related notifications and any web based operations made via the web.</p> <p>Your Email will be public and used for Account related notifications and any web based operations made via the web.</p>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">Username<strong class="text-danger">*</strong></label> <label class="col-md-2 control-label" for="user-setting-username">Username<strong class="text-danger">*</strong></label>
<div class="col-md-8"> <div class="col-md-8">
<input name="username" class="form-control" placeholder="Type your user name" required="required" value="{{.SignedUser.Name}}" title="{{.SignedUser.Name}}"> <input name="username" class="form-control" placeholder="Type your user name" required="required" value="{{.SignedUser.Name}}" title="{{.SignedUser.Name}}" id="user-setting-username">
<p class="help-block hidden"><span class="text-danger">Cautious : </span>your username is changing !</p>
</div> </div>
</div> </div>

Loading…
Cancel
Save