commit
50cd67cd4b
|
@ -272,8 +272,9 @@ func runWeb(ctx *cli.Context) {
|
||||||
m.Post("/email", bindIgnErr(auth.AddEmailForm{}), user.SettingsEmailPost)
|
m.Post("/email", bindIgnErr(auth.AddEmailForm{}), user.SettingsEmailPost)
|
||||||
m.Get("/password", user.SettingsPassword)
|
m.Get("/password", user.SettingsPassword)
|
||||||
m.Post("/password", bindIgnErr(auth.ChangePasswordForm{}), user.SettingsPasswordPost)
|
m.Post("/password", bindIgnErr(auth.ChangePasswordForm{}), user.SettingsPasswordPost)
|
||||||
m.Get("/ssh", user.SettingsSSHKeys)
|
m.Combo("/ssh").Get(user.SettingsSSHKeys).
|
||||||
m.Post("/ssh", bindIgnErr(auth.AddSSHKeyForm{}), user.SettingsSSHKeysPost)
|
Post(bindIgnErr(auth.AddSSHKeyForm{}), user.SettingsSSHKeysPost)
|
||||||
|
m.Post("/ssh/delete", user.DeleteSSHKey)
|
||||||
m.Get("/social", user.SettingsSocial)
|
m.Get("/social", user.SettingsSocial)
|
||||||
m.Combo("/applications").Get(user.SettingsApplications).
|
m.Combo("/applications").Get(user.SettingsApplications).
|
||||||
Post(bindIgnErr(auth.NewAccessTokenForm{}), user.SettingsApplicationsPost)
|
Post(bindIgnErr(auth.NewAccessTokenForm{}), user.SettingsApplicationsPost)
|
||||||
|
|
|
@ -276,6 +276,9 @@ key_name = Key Name
|
||||||
key_content = Content
|
key_content = Content
|
||||||
add_key_success = New SSH key '%s' has been added successfully!
|
add_key_success = New SSH key '%s' has been added successfully!
|
||||||
delete_key = Delete
|
delete_key = Delete
|
||||||
|
ssh_key_deletion = SSH Key Deletion
|
||||||
|
ssh_key_deletion_desc = Delete this SSH key will remove all related accesses for your account. Do you want to continue?
|
||||||
|
ssh_key_deletion_success = SSH key has been deleted successfully!
|
||||||
add_on = Added on
|
add_on = Added on
|
||||||
last_used = Last used on
|
last_used = Last used on
|
||||||
no_activity = No recent activity
|
no_activity = No recent activity
|
||||||
|
|
|
@ -169,6 +169,12 @@ func ParsePatch(pid int64, maxlines int, cmd *exec.Cmd, reader io.Reader) (*Diff
|
||||||
beg := len(DIFF_HEAD)
|
beg := len(DIFF_HEAD)
|
||||||
a := line[beg : (len(line)-beg)/2+beg]
|
a := line[beg : (len(line)-beg)/2+beg]
|
||||||
|
|
||||||
|
// In case file name is surrounded by double quotes(it happens only in git-shell).
|
||||||
|
if a[0] == '"' {
|
||||||
|
a = a[1 : len(a)-1]
|
||||||
|
a = strings.Replace(a, `\"`, `"`, -1)
|
||||||
|
}
|
||||||
|
|
||||||
curFile = &DiffFile{
|
curFile = &DiffFile{
|
||||||
Name: a[strings.Index(a, "/")+1:],
|
Name: a[strings.Index(a, "/")+1:],
|
||||||
Index: len(diff.Files) + 1,
|
Index: len(diff.Files) + 1,
|
||||||
|
|
|
@ -466,7 +466,15 @@ func deletePublicKey(e *xorm.Session, key *PublicKey) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeletePublicKey deletes SSH key information both in database and authorized_keys file.
|
// DeletePublicKey deletes SSH key information both in database and authorized_keys file.
|
||||||
func DeletePublicKey(key *PublicKey) (err error) {
|
func DeletePublicKey(id int64) (err error) {
|
||||||
|
key := &PublicKey{ID: id}
|
||||||
|
has, err := x.Id(key.ID).Get(key)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
} else if !has {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
sess := x.NewSession()
|
sess := x.NewSession()
|
||||||
defer sessionRelease(sess)
|
defer sessionRelease(sess)
|
||||||
if err = sess.Begin(); err != nil {
|
if err = sess.Begin(); err != nil {
|
||||||
|
|
|
@ -166,6 +166,13 @@ type Repository struct {
|
||||||
Updated time.Time `xorm:"UPDATED"`
|
Updated time.Time `xorm:"UPDATED"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) AfterSet(colName string, _ xorm.Cell) {
|
||||||
|
switch colName {
|
||||||
|
case "updated":
|
||||||
|
repo.Updated = regulateTimeZone(repo.Updated)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (repo *Repository) getOwner(e Engine) (err error) {
|
func (repo *Repository) getOwner(e Engine) (err error) {
|
||||||
if repo.Owner == nil {
|
if repo.Owner == nil {
|
||||||
repo.Owner, err = getUserByID(e, repo.OwnerID)
|
repo.Owner, err = getUserByID(e, repo.OwnerID)
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -275,9 +275,11 @@ func (repo *Repository) searchCommits(id sha1, keyword string) (*list.List, erro
|
||||||
return parsePrettyFormatLog(repo, stdout)
|
return parsePrettyFormatLog(repo, stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var CommitsRangeSize = 50
|
||||||
|
|
||||||
func (repo *Repository) commitsByRange(id sha1, page int) (*list.List, error) {
|
func (repo *Repository) commitsByRange(id sha1, page int) (*list.List, error) {
|
||||||
stdout, stderr, err := com.ExecCmdDirBytes(repo.Path, "git", "log", id.String(),
|
stdout, stderr, err := com.ExecCmdDirBytes(repo.Path, "git", "log", id.String(),
|
||||||
"--skip="+com.ToStr((page-1)*50), "--max-count=50", prettyLogFormat)
|
"--skip="+com.ToStr((page-1)*CommitsRangeSize), "--max-count="+com.ToStr(CommitsRangeSize), prettyLogFormat)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.New(string(stderr))
|
return nil, errors.New(string(stderr))
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,13 @@ func parseTreeData(tree *Tree, data []byte) ([]*TreeEntry, error) {
|
||||||
|
|
||||||
step = bytes.IndexByte(data[pos:], '\n')
|
step = bytes.IndexByte(data[pos:], '\n')
|
||||||
entry.name = string(data[pos : pos+step])
|
entry.name = string(data[pos : pos+step])
|
||||||
|
|
||||||
|
// In case entry name is surrounded by double quotes(it happens only in git-shell).
|
||||||
|
if entry.name[0] == '"' {
|
||||||
|
entry.name = string(data[pos+1 : pos+step-1])
|
||||||
|
entry.name = strings.Replace(entry.name, `\"`, `"`, -1)
|
||||||
|
}
|
||||||
|
|
||||||
pos += step + 1
|
pos += step + 1
|
||||||
entries = append(entries, entry)
|
entries = append(entries, entry)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,33 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type loginAuth struct {
|
||||||
|
username, password string
|
||||||
|
}
|
||||||
|
|
||||||
|
// SMTP AUTH LOGIN Auth Handler
|
||||||
|
func LoginAuth(username, password string) smtp.Auth {
|
||||||
|
return &loginAuth{username, password}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *loginAuth) Start(server *smtp.ServerInfo) (string, []byte, error) {
|
||||||
|
return "LOGIN", []byte{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *loginAuth) Next(fromServer []byte, more bool) ([]byte, error) {
|
||||||
|
if more {
|
||||||
|
switch string(fromServer) {
|
||||||
|
case "Username:":
|
||||||
|
return []byte(a.username), nil
|
||||||
|
case "Password:":
|
||||||
|
return []byte(a.password), nil
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unknwon fromServer: %s", string(fromServer))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
type Message struct {
|
type Message struct {
|
||||||
To []string
|
To []string
|
||||||
From string
|
From string
|
||||||
|
@ -135,6 +162,9 @@ func sendMail(settings *setting.Mailer, recipients []string, msgContent []byte)
|
||||||
auth = smtp.CRAMMD5Auth(settings.User, settings.Passwd)
|
auth = smtp.CRAMMD5Auth(settings.User, settings.Passwd)
|
||||||
} else if strings.Contains(options, "PLAIN") {
|
} else if strings.Contains(options, "PLAIN") {
|
||||||
auth = smtp.PlainAuth("", settings.User, settings.Passwd, host)
|
auth = smtp.PlainAuth("", settings.User, settings.Passwd, host)
|
||||||
|
} else if strings.Contains(options, "LOGIN") {
|
||||||
|
// Patch for AUTH LOGIN
|
||||||
|
auth = LoginAuth(settings.User, settings.Passwd)
|
||||||
}
|
}
|
||||||
|
|
||||||
if auth != nil {
|
if auth != nil {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -339,6 +339,25 @@ function initRepository() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Diff
|
||||||
|
if ($('.repository.diff').length > 0) {
|
||||||
|
$('.diff-detail-box .toggle.button').click(function () {
|
||||||
|
$($(this).data('target')).slideToggle(100);
|
||||||
|
})
|
||||||
|
|
||||||
|
var $counter = $('.diff-counter');
|
||||||
|
if ($counter.length < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$counter.each(function (i, item) {
|
||||||
|
var $item = $(item);
|
||||||
|
var addLine = $item.find('span[data-line].add').data("line");
|
||||||
|
var delLine = $item.find('span[data-line].del').data("line");
|
||||||
|
var addPercent = parseFloat(addLine) / (parseFloat(addLine) + parseFloat(delLine)) * 100;
|
||||||
|
$item.find(".bar .add").css("width", addPercent + "%");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Pull request
|
// Pull request
|
||||||
if ($('.repository.compare.pull').length > 0) {
|
if ($('.repository.compare.pull').length > 0) {
|
||||||
var $branch_dropdown = $('.choose.branch .dropdown')
|
var $branch_dropdown = $('.choose.branch .dropdown')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.admin {
|
.admin {
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
padding-bottom: @footer-margin * 3;
|
padding-bottom: @footer-margin * 2;
|
||||||
|
|
||||||
.table.segment {
|
.table.segment {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
|
@ -92,6 +92,13 @@ img {
|
||||||
&.small {
|
&.small {
|
||||||
font-size: 0.75em;
|
font-size: 0.75em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.truncate {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.message {
|
.message {
|
||||||
|
@ -111,6 +118,19 @@ img {
|
||||||
border-color: #F0C36D;
|
border-color: #F0C36D;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.info {
|
||||||
|
&.header {
|
||||||
|
background-color: #d9edf7!important;
|
||||||
|
border-color: #85c5e5;
|
||||||
|
}
|
||||||
|
&.segment {
|
||||||
|
border-color: #85c5e5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.normal.header {
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
.avatar.image {
|
.avatar.image {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
|
|
@ -9,7 +9,11 @@
|
||||||
.ui.attached.header {
|
.ui.attached.header {
|
||||||
background: #f0f0f0;
|
background: #f0f0f0;
|
||||||
.right {
|
.right {
|
||||||
margin-top: -6px;
|
margin-top: -5px;
|
||||||
|
.button {
|
||||||
|
padding: 8px 10px;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.repository {
|
.repository {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.home {
|
.home {
|
||||||
padding-bottom: @footer-margin * 3;
|
padding-bottom: @footer-margin * 2;
|
||||||
.logo {
|
.logo {
|
||||||
max-width: 250px;
|
max-width: 250px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.install {
|
.install {
|
||||||
padding-top: 45px;
|
padding-top: 45px;
|
||||||
padding-bottom: @footer-margin * 3;
|
padding-bottom: @footer-margin * 2;
|
||||||
form {
|
form {
|
||||||
@input-padding: 320px !important;
|
@input-padding: 320px !important;
|
||||||
label {
|
label {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
@mega-octicon-width: 30px;
|
@mega-octicon-width: 30px;
|
||||||
|
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
padding-bottom: @footer-margin * 3;
|
padding-bottom: @footer-margin * 2;
|
||||||
|
|
||||||
.head {
|
.head {
|
||||||
.column {
|
.column {
|
||||||
|
@ -424,6 +424,187 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.commits {
|
||||||
|
.header {
|
||||||
|
.ui.right {
|
||||||
|
.search {
|
||||||
|
input {
|
||||||
|
font-weight: normal;
|
||||||
|
padding: 5px 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.button {
|
||||||
|
float: right;
|
||||||
|
margin-left: 5px;
|
||||||
|
margin-top: 1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.commits.table {
|
||||||
|
font-size: 13px;
|
||||||
|
th, td {
|
||||||
|
&:first-child {
|
||||||
|
padding-left: 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
td {
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.author {
|
||||||
|
min-width: 180px;
|
||||||
|
}
|
||||||
|
.message span {
|
||||||
|
max-width: 500px;
|
||||||
|
}
|
||||||
|
.date {
|
||||||
|
width: 120px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sha.label {
|
||||||
|
font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 6px 10px 4px 10px;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-detail-box {
|
||||||
|
margin: 15px 0;
|
||||||
|
line-height: 30px;
|
||||||
|
ol {
|
||||||
|
clear: both;
|
||||||
|
padding-left: 0;
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-bottom: 28px;
|
||||||
|
li {
|
||||||
|
list-style: none;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
border-bottom: 1px dashed #DDD;
|
||||||
|
padding-left: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
span.status{
|
||||||
|
display: inline-block;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
margin-right: 8px;
|
||||||
|
vertical-align: middle;
|
||||||
|
&.modify {
|
||||||
|
background-color: #f0db88;
|
||||||
|
}
|
||||||
|
&.add {
|
||||||
|
background-color: #b4e2b4;
|
||||||
|
}
|
||||||
|
&.del {
|
||||||
|
background-color: #e9aeae;
|
||||||
|
}
|
||||||
|
&.rename {
|
||||||
|
background-color: #dad8ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.diff-box {
|
||||||
|
.count {
|
||||||
|
margin-right: 12px;
|
||||||
|
.bar {
|
||||||
|
background-color: #e75316;
|
||||||
|
height: 12px;
|
||||||
|
width: 40px;
|
||||||
|
display: inline-block;
|
||||||
|
margin: 2px 4px 0 4px;
|
||||||
|
vertical-align: text-top;
|
||||||
|
.add {
|
||||||
|
background-color: #77c64a;
|
||||||
|
height: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.file {
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.diff-file-box {
|
||||||
|
.header {
|
||||||
|
border-bottom: 1px solid #d4d4d5!important;
|
||||||
|
}
|
||||||
|
.file-body.file-code {
|
||||||
|
.lines-num {
|
||||||
|
text-align: right;
|
||||||
|
color: #999;
|
||||||
|
background: #fafafa;
|
||||||
|
width: 1%;
|
||||||
|
}
|
||||||
|
.lines-num-old {
|
||||||
|
border-right: 1px solid #DDD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.code-diff {
|
||||||
|
font-size: 13px;
|
||||||
|
td {
|
||||||
|
padding: 0;
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.lines-num {
|
||||||
|
border-right: 1px solid #d4d4d5;
|
||||||
|
padding: 0 5px;
|
||||||
|
}
|
||||||
|
tbody {
|
||||||
|
tr {
|
||||||
|
&.tag-code {
|
||||||
|
td, pre {
|
||||||
|
background-color: #E0E0E0 !important;
|
||||||
|
border-color: #ADADAD!important;
|
||||||
|
}
|
||||||
|
// td.selected-line, td.selected-line pre {
|
||||||
|
// background-color: #ffffdd !important;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
// &.same-code {
|
||||||
|
// td.selected-line, td.selected-line pre {
|
||||||
|
// background-color: #ffffdd !important;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
&.del-code {
|
||||||
|
td, pre {
|
||||||
|
background-color: #ffe2dd !important;
|
||||||
|
border-color: #e9aeae !important;
|
||||||
|
}
|
||||||
|
// td.selected-line, td.selected-line pre {
|
||||||
|
// background-color: #ffffdd !important;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
&.add-code {
|
||||||
|
td, pre {
|
||||||
|
background-color: #d1ffd6 !important;
|
||||||
|
border-color: #b4e2b4 !important;
|
||||||
|
}
|
||||||
|
// td.selected-line, td.selected-line pre {
|
||||||
|
// background-color: #ffffdd !important;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
td {
|
||||||
|
background-color: #FFF8D2 !important;
|
||||||
|
border-color: #F0DB88 !important;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.code-view {
|
||||||
|
overflow: auto;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui.comments {
|
.ui.comments {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.user {
|
.user {
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
padding-bottom: @footer-margin * 3;
|
padding-bottom: @footer-margin * 2;
|
||||||
|
|
||||||
&.settings {
|
&.settings {
|
||||||
.key.list {
|
.key.list {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
"github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
|
"github.com/Unknwon/paginater"
|
||||||
|
|
||||||
"github.com/gogits/gogs/models"
|
"github.com/gogits/gogs/models"
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
|
@ -44,7 +45,7 @@ func RenderIssueLinks(oldCommits *list.List, repoLink string) *list.List {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Commits(ctx *middleware.Context) {
|
func Commits(ctx *middleware.Context) {
|
||||||
ctx.Data["IsRepoToolbarCommits"] = true
|
ctx.Data["PageIsCommits"] = true
|
||||||
|
|
||||||
userName := ctx.Repo.Owner.Name
|
userName := ctx.Repo.Owner.Name
|
||||||
repoName := ctx.Repo.Repository.Name
|
repoName := ctx.Repo.Repository.Name
|
||||||
|
@ -64,19 +65,11 @@ func Commits(ctx *middleware.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate and validate page number.
|
page := ctx.QueryInt("page")
|
||||||
page, _ := com.StrTo(ctx.Query("p")).Int()
|
if page <= 1 {
|
||||||
if page < 1 {
|
|
||||||
page = 1
|
page = 1
|
||||||
}
|
}
|
||||||
lastPage := page - 1
|
ctx.Data["Page"] = paginater.New(commitsCount, git.CommitsRangeSize, page, 5)
|
||||||
if lastPage < 0 {
|
|
||||||
lastPage = 0
|
|
||||||
}
|
|
||||||
nextPage := page + 1
|
|
||||||
if page*50 > commitsCount {
|
|
||||||
nextPage = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// Both `git log branchName` and `git log commitId` work.
|
// Both `git log branchName` and `git log commitId` work.
|
||||||
commits, err := ctx.Repo.Commit.CommitsByRange(page)
|
commits, err := ctx.Repo.Commit.CommitsByRange(page)
|
||||||
|
@ -91,14 +84,11 @@ func Commits(ctx *middleware.Context) {
|
||||||
ctx.Data["Username"] = userName
|
ctx.Data["Username"] = userName
|
||||||
ctx.Data["Reponame"] = repoName
|
ctx.Data["Reponame"] = repoName
|
||||||
ctx.Data["CommitCount"] = commitsCount
|
ctx.Data["CommitCount"] = commitsCount
|
||||||
ctx.Data["LastPageNum"] = lastPage
|
|
||||||
ctx.Data["NextPageNum"] = nextPage
|
|
||||||
ctx.HTML(200, COMMITS)
|
ctx.HTML(200, COMMITS)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SearchCommits(ctx *middleware.Context) {
|
func SearchCommits(ctx *middleware.Context) {
|
||||||
ctx.Data["IsSearchPage"] = true
|
ctx.Data["PageIsCommits"] = true
|
||||||
ctx.Data["IsRepoToolbarCommits"] = true
|
|
||||||
|
|
||||||
keyword := ctx.Query("q")
|
keyword := ctx.Query("q")
|
||||||
if len(keyword) == 0 {
|
if len(keyword) == 0 {
|
||||||
|
@ -199,7 +189,7 @@ func FileHistory(ctx *middleware.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Diff(ctx *middleware.Context) {
|
func Diff(ctx *middleware.Context) {
|
||||||
ctx.Data["IsRepoToolbarCommits"] = true
|
ctx.Data["PageIsDiff"] = true
|
||||||
|
|
||||||
userName := ctx.Repo.Owner.Name
|
userName := ctx.Repo.Owner.Name
|
||||||
repoName := ctx.Repo.Repository.Name
|
repoName := ctx.Repo.Repository.Name
|
||||||
|
@ -253,7 +243,7 @@ func Diff(ctx *middleware.Context) {
|
||||||
ctx.Data["Parents"] = parents
|
ctx.Data["Parents"] = parents
|
||||||
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
|
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
|
||||||
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", commitId)
|
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", commitId)
|
||||||
if (commit.ParentCount() > 0) {
|
if commit.ParentCount() > 0 {
|
||||||
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", parents[0])
|
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", parents[0])
|
||||||
}
|
}
|
||||||
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", commitId)
|
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", commitId)
|
||||||
|
|
|
@ -677,6 +677,13 @@ func SettingsDeployKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||||
ctx.Data["PageIsSettingsKeys"] = true
|
ctx.Data["PageIsSettingsKeys"] = true
|
||||||
|
|
||||||
|
keys, err := models.ListDeployKeys(ctx.Repo.Repository.ID)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "ListDeployKeys", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Data["Deploykeys"] = keys
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, DEPLOY_KEYS)
|
ctx.HTML(200, DEPLOY_KEYS)
|
||||||
return
|
return
|
||||||
|
|
|
@ -269,12 +269,12 @@ func SettingsSSHKeys(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsSSHKeys"] = true
|
ctx.Data["PageIsSettingsSSHKeys"] = true
|
||||||
|
|
||||||
var err error
|
keys, err := models.ListPublicKeys(ctx.User.Id)
|
||||||
ctx.Data["Keys"], err = models.ListPublicKeys(ctx.User.Id)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "ssh.ListPublicKey", err)
|
ctx.Handle(500, "ListPublicKeys", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ctx.Data["Keys"] = keys
|
||||||
|
|
||||||
ctx.HTML(200, SETTINGS_SSH_KEYS)
|
ctx.HTML(200, SETTINGS_SSH_KEYS)
|
||||||
}
|
}
|
||||||
|
@ -283,31 +283,13 @@ func SettingsSSHKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsSettingsSSHKeys"] = true
|
ctx.Data["PageIsSettingsSSHKeys"] = true
|
||||||
|
|
||||||
var err error
|
keys, err := models.ListPublicKeys(ctx.User.Id)
|
||||||
ctx.Data["Keys"], err = models.ListPublicKeys(ctx.User.Id)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "ssh.ListPublicKey", err)
|
ctx.Handle(500, "ListPublicKeys", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ctx.Data["Keys"] = keys
|
||||||
|
|
||||||
// Delete SSH key.
|
|
||||||
if ctx.Query("_method") == "DELETE" {
|
|
||||||
id := com.StrTo(ctx.Query("id")).MustInt64()
|
|
||||||
if id <= 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = models.DeletePublicKey(&models.PublicKey{ID: id}); err != nil {
|
|
||||||
ctx.Handle(500, "DeletePublicKey", err)
|
|
||||||
} else {
|
|
||||||
log.Trace("SSH key deleted: %s", ctx.User.Name)
|
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add new SSH key.
|
|
||||||
if ctx.Req.Method == "POST" {
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, SETTINGS_SSH_KEYS)
|
ctx.HTML(200, SETTINGS_SSH_KEYS)
|
||||||
return
|
return
|
||||||
|
@ -325,24 +307,34 @@ func SettingsSSHKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = models.AddPublicKey(ctx.User.Id, form.Title, content); err != nil {
|
if err = models.AddPublicKey(ctx.User.Id, form.Title, content); err != nil {
|
||||||
|
ctx.Data["HasError"] = true
|
||||||
switch {
|
switch {
|
||||||
case models.IsErrKeyAlreadyExist(err):
|
case models.IsErrKeyAlreadyExist(err):
|
||||||
|
ctx.Data["Err_Content"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("settings.ssh_key_been_used"), SETTINGS_SSH_KEYS, &form)
|
ctx.RenderWithErr(ctx.Tr("settings.ssh_key_been_used"), SETTINGS_SSH_KEYS, &form)
|
||||||
case models.IsErrKeyNameAlreadyUsed(err):
|
case models.IsErrKeyNameAlreadyUsed(err):
|
||||||
|
ctx.Data["Err_Title"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("settings.ssh_key_name_used"), SETTINGS_SSH_KEYS, &form)
|
ctx.RenderWithErr(ctx.Tr("settings.ssh_key_name_used"), SETTINGS_SSH_KEYS, &form)
|
||||||
default:
|
default:
|
||||||
ctx.Handle(500, "AddPublicKey", err)
|
ctx.Handle(500, "AddPublicKey", err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
log.Trace("SSH key added: %s", ctx.User.Name)
|
|
||||||
ctx.Flash.Success(ctx.Tr("settings.add_key_success", form.Title))
|
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.HTML(200, SETTINGS_SSH_KEYS)
|
ctx.Flash.Success(ctx.Tr("settings.add_key_success", form.Title))
|
||||||
|
ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh")
|
||||||
|
}
|
||||||
|
|
||||||
|
func DeleteSSHKey(ctx *middleware.Context) {
|
||||||
|
if err := models.DeletePublicKey(ctx.QueryInt64("id")); err != nil {
|
||||||
|
ctx.Flash.Error("DeletePublicKey: " + err.Error())
|
||||||
|
} else {
|
||||||
|
ctx.Flash.Success(ctx.Tr("settings.ssh_key_deletion_success"))
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.JSON(200, map[string]interface{}{
|
||||||
|
"redirect": setting.AppSubUrl + "/user/settings/ssh",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func SettingsSocial(ctx *middleware.Context) {
|
func SettingsSocial(ctx *middleware.Context) {
|
||||||
|
@ -389,6 +381,12 @@ func SettingsApplicationsPost(ctx *middleware.Context, form auth.NewAccessTokenF
|
||||||
ctx.Data["PageIsSettingsApplications"] = true
|
ctx.Data["PageIsSettingsApplications"] = true
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
|
tokens, err := models.ListAccessTokens(ctx.User.Id)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "ListAccessTokens", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Data["Tokens"] = tokens
|
||||||
ctx.HTML(200, SETTINGS_APPLICATIONS)
|
ctx.HTML(200, SETTINGS_APPLICATIONS)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
{{template "ng/base/head" .}}
|
{{template "base/head" .}}
|
||||||
{{template "ng/base/header" .}}
|
<div class="repository commits">
|
||||||
<div id="repo-wrapper">
|
{{template "repo/header" .}}
|
||||||
{{template "repo/header_old" .}}
|
<div class="ui container">
|
||||||
<div class="container clear">
|
|
||||||
{{template "repo/commits_table" .}}
|
{{template "repo/commits_table" .}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{template "ng/base/footer" .}}
|
{{template "base/footer" .}}
|
||||||
|
|
|
@ -1,21 +1,26 @@
|
||||||
<div id="commits-list">
|
<h4 class="ui top attached header">
|
||||||
<div class="panel panel-radius">
|
{{.CommitCount}} {{.i18n.Tr "repo.commits.commits"}}
|
||||||
<div class="panel-header">
|
{{if .PageIsCommits}}
|
||||||
{{if not .IsDiffCompare}}
|
<div class="ui right">
|
||||||
<form class="search pull-right" action="{{.RepoLink}}/commits/{{.BranchName}}/search" method="get" id="commits-search-form">
|
<form action="{{.RepoLink}}/commits/{{.BranchName}}/search">
|
||||||
<input class="ipt ipt-radius" type="search" name="q" placeholder="{{.i18n.Tr "repo.commits.search"}}" value="{{.Keyword}}" />
|
<div class="ui tiny search input">
|
||||||
<button class="btn btn-black btn-small btn-radius">{{.i18n.Tr "repo.commits.find"}}</button>
|
<input name="q" placeholder="{{.i18n.Tr "repo.commits.search"}}" value="{{.Keyword}}" autofocus>
|
||||||
</form>
|
|
||||||
{{end}}
|
|
||||||
<h4>{{.CommitCount}} {{.i18n.Tr "repo.commits.commits"}}</h4>
|
|
||||||
</div>
|
</div>
|
||||||
<table class="panel-body table commit-list table-striped">
|
<button class="ui black tiny button" data-panel="#add-deploy-key-panel">{{.i18n.Tr "repo.commits.find"}}</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{{else if .IsDiffCompare}}
|
||||||
|
<a href="{{$.RepoLink}}/commit/{{.BeforeCommitId}}" class="ui green sha label">{{ShortSha .BeforeCommitId}}</a> ... <a href="{{$.RepoLink}}/commit/{{.AfterCommitId}}" class="ui green sha label">{{ShortSha .AfterCommitId}}</a>
|
||||||
|
{{end}}
|
||||||
|
</h4>
|
||||||
|
<div class="ui attached table segment">
|
||||||
|
<table class="ui very basic striped commits table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="author">{{.i18n.Tr "repo.commits.author"}}</th>
|
<th>{{.i18n.Tr "repo.commits.author"}}</th>
|
||||||
<th class="sha">SHA1</th>
|
<th>SHA1</th>
|
||||||
<th class="message">{{.i18n.Tr "repo.commits.message"}}</th>
|
<th>{{.i18n.Tr "repo.commits.message"}}</th>
|
||||||
<th class="date">{{.i18n.Tr "repo.commits.date"}}</th>
|
<th>{{.i18n.Tr "repo.commits.date"}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -26,23 +31,38 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td class="author">
|
<td class="author">
|
||||||
{{if .User}}
|
{{if .User}}
|
||||||
<img class="avatar-20" src="{{.User.AvatarLink}}" alt=""/> <a href="{{AppSubUrl}}/{{.User.Name}}">{{.Author.Name}}</a>
|
<img class="ui avatar image" src="{{.User.AvatarLink}}" alt=""/> <a href="{{AppSubUrl}}/{{.User.Name}}">{{.Author.Name}}</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
<img class="avatar-20" src="{{AvatarLink .Author.Email}}" alt=""/> {{.Author.Name}}
|
<img class="ui avatar image" src="{{AvatarLink .Author.Email}}" alt=""/> {{.Author.Name}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</td>
|
</td>
|
||||||
<td class="sha"><a rel="nofollow" class="label label-green" href="{{AppSubUrl}}/{{$username}}/{{$reponame}}/commit/{{.Id}} ">{{SubStr .Id.String 0 10}} </a></td>
|
<td class="sha"><a rel="nofollow" class="ui green sha label" href="{{AppSubUrl}}/{{$username}}/{{$reponame}}/commit/{{.Id}} ">{{SubStr .Id.String 0 10}} </a></td>
|
||||||
<td class="message"><span class="text-truncate">{{RenderCommitMessage .Summary $.RepoLink}}</span></td>
|
<td class="message"><span class="text truncate">{{RenderCommitMessage .Summary $.RepoLink}}</span></td>
|
||||||
<td class="date">{{TimeSince .Author.When $.Lang}}</td>
|
<td class="date">{{TimeSince .Author.When $.Lang}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{{if and (not .IsSearchPage) (not .IsDiffCompare)}}
|
|
||||||
<ul class="pagination">
|
{{with .Page}}
|
||||||
{{if .LastPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{.RepoLink}}/commits/{{.BranchName}}{{if .FileName}}/{{.FileName}}{{end}}?p={{.LastPageNum}}" rel="nofollow">« {{.i18n.Tr "repo.commits.newer"}}</a></li>{{end}}
|
{{if gt .TotalPages 1}}
|
||||||
{{if .NextPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{.RepoLink}}/commits/{{.BranchName}}{{if .FileName}}/{{.FileName}}{{end}}?p={{.NextPageNum}}" rel="nofollow">» {{.i18n.Tr "repo.commits.older"}}</a></li>{{end}}
|
<div class="center page buttons">
|
||||||
</ul>
|
<div class="ui borderless pagination menu">
|
||||||
|
<a class="{{if not .HasPrevious}}disabled{{end}} item" {{if .HasPrevious}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.Previous}}"{{end}}>
|
||||||
|
<i class="left arrow icon"></i> {{$.i18n.Tr "repo.issues.previous"}}
|
||||||
|
</a>
|
||||||
|
{{range .Pages}}
|
||||||
|
{{if eq .Num -1}}
|
||||||
|
<a class="disabled item">...</a>
|
||||||
|
{{else}}
|
||||||
|
<a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.Num}}"{{end}}>{{.Num}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
<a class="{{if not .HasNext}}disabled{{end}} item" {{if .HasNext}}href="{{$.RepoLink}}/commits/{{$.BranchName}}{{if $.FileName}}/{{$.FileName}}{{end}}?page={{.Next}}"{{end}}>
|
||||||
|
{{$.i18n.Tr "repo.issues.next"}} <i class="icon right arrow"></i>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
|
@ -1,57 +1,56 @@
|
||||||
{{template "ng/base/head" .}}
|
{{template "base/head" .}}
|
||||||
{{template "ng/base/header" .}}
|
<div class="repository diff">
|
||||||
<div id="repo-wrapper">
|
{{template "repo/header" .}}
|
||||||
{{template "repo/header_old" .}}
|
<div class="ui container">
|
||||||
<div class="container clear" id="diff-page">
|
|
||||||
{{if .IsDiffCompare }}
|
{{if .IsDiffCompare }}
|
||||||
<div class="panel panel-info panel-radius compare-head-box">
|
|
||||||
<div class="panel-header">
|
|
||||||
<a class="pull-right btn btn-blue btn-header btn-medium btn-radius" rel="nofollow" href="{{EscapePound .SourcePath}}">{{.i18n.Tr "repo.diff.browse_source"}}</a>
|
|
||||||
<h4><a href="{{$.RepoLink}}/commit/{{.BeforeCommitId}}" class="label label-green">{{ShortSha .BeforeCommitId}}</a> ... <a href="{{$.RepoLink}}/commit/{{.AfterCommitId}}" class="label label-green">{{ShortSha .AfterCommitId}}</a></h4>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body compare">
|
|
||||||
{{template "repo/commits_table" .}}
|
{{template "repo/commits_table" .}}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="panel panel-info panel-radius diff-head-box">
|
<h4 class="ui top attached info header">
|
||||||
<div class="panel-header">
|
{{RenderCommitMessage .Commit.Message $.RepoLink}}
|
||||||
<a class="pull-right btn btn-blue btn-header btn-medium btn-radius" rel="nofollow" href="{{EscapePound .SourcePath}}">{{.i18n.Tr "repo.diff.browse_source"}}</a>
|
<div class="ui right">
|
||||||
<h4 class="commit-message">{{RenderCommitMessage .Commit.Message $.RepoLink}}</h4>
|
<a class="ui blue tiny button" href="{{EscapePound .SourcePath}}">
|
||||||
|
{{.i18n.Tr "repo.diff.browse_source"}}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
</h4>
|
||||||
<span class="pull-right">
|
<div class="ui attached info segment">
|
||||||
<ul class="list-unstyled">
|
|
||||||
<li class="inline">{{.i18n.Tr "repo.diff.parent"}}</li>
|
|
||||||
{{range .Parents}}
|
|
||||||
<li class="inline"><a href="{{$.RepoLink}}/commit/{{.}}"><span class="label label-blue">{{ShortSha .}}</span></a></li>
|
|
||||||
{{end}}
|
|
||||||
<li class="inline">{{.i18n.Tr "repo.diff.commit"}} <span class="label label-blue">{{ShortSha .CommitId}}</span></li>
|
|
||||||
</ul>
|
|
||||||
</span>
|
|
||||||
<p class="author">
|
|
||||||
{{if .Author}}
|
{{if .Author}}
|
||||||
<img class="avatar-30" src="{{.Author.AvatarLink}}" />
|
<img class="ui avatar image" src="{{.Author.AvatarLink}}" />
|
||||||
<a href="{{AppSubUrl}}/{{.Author.Name}}"><strong>{{.Commit.Author.Name}}</strong></a>
|
<a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a>
|
||||||
{{else}}
|
{{else}}
|
||||||
<img class="avatar-30" src="{{AvatarLink .Commit.Author.Email}}" />
|
<img class="ui avatar image" src="{{AvatarLink .Commit.Author.Email}}" />
|
||||||
<strong>{{.Commit.Author.Name}}</strong>
|
<strong>{{.Commit.Author.Name}}</strong>
|
||||||
{{end}}
|
{{end}}
|
||||||
<span class="text-grey" id="authored-time">{{TimeSince .Commit.Author.When $.Lang}}</span>
|
<span class="text grey" id="authored-time">{{TimeSince .Commit.Author.When $.Lang}}</span>
|
||||||
</p>
|
<div class="ui right">
|
||||||
|
<div class="ui horizontal list">
|
||||||
|
<div class="item">
|
||||||
|
{{.i18n.Tr "repo.diff.parent"}}
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
{{range .Parents}}
|
||||||
|
<a class="ui blue sha label" href="{{$.RepoLink}}/commit/{{.}}">{{ShortSha .}}</a>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
<div class="item">{{.i18n.Tr "repo.diff.commit"}}</div>
|
||||||
|
<div class="item"><span class="ui blue sha label">{{ShortSha .CommitId}}</span></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{if .DiffNotAvailable}}
|
{{if .DiffNotAvailable}}
|
||||||
<h4>{{.i18n.Tr "repo.diff.data_not_available"}}</h4>
|
<h4>{{.i18n.Tr "repo.diff.data_not_available"}}</h4>
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="diff-detail-box diff-box">
|
<div class="diff-detail-box diff-box">
|
||||||
<a class="pull-right btn btn-gray btn-header btn-radius text-black" data-target="#diff-files">{{.i18n.Tr "repo.diff.show_diff_stats"}}</a>
|
<div>
|
||||||
<p class="showing">
|
|
||||||
<i class="fa fa-retweet"></i>
|
<i class="fa fa-retweet"></i>
|
||||||
{{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
|
{{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
|
||||||
</p>
|
<div class="ui right">
|
||||||
<ol class="detail-files collapse hide" id="diff-files">
|
<a class="ui tiny basic black toggle button" data-target="#diff-files">{{.i18n.Tr "repo.diff.show_diff_stats"}}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ol class="detail-files hide" id="diff-files">
|
||||||
{{range .Diff.Files}}
|
{{range .Diff.Files}}
|
||||||
<li>
|
<li>
|
||||||
<div class="diff-counter count pull-right">
|
<div class="diff-counter count pull-right">
|
||||||
|
@ -67,7 +66,7 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
<!-- todo finish all file status, now modify, add, delete and rename -->
|
<!-- todo finish all file status, now modify, add, delete and rename -->
|
||||||
<span class="status {{DiffTypeToStr .Type}}" data-toggle="tooltip" data-placement="right" title="{{DiffTypeToStr .Type}}"> </span>
|
<span class="status {{DiffTypeToStr .Type}} poping up" data-content="{{DiffTypeToStr .Type}}" data-variation="inverted tiny" data-position="right center"> </span>
|
||||||
<a class="file" href="#diff-{{.Index}}">{{.Name}}</a>
|
<a class="file" href="#diff-{{.Index}}">{{.Name}}</a>
|
||||||
</li>
|
</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -75,9 +74,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{range $i, $file := .Diff.Files}}
|
{{range $i, $file := .Diff.Files}}
|
||||||
<div class="panel panel-radius diff-file-box diff-box file-content" id="diff-{{.Index}}">
|
<div class="diff-file-box diff-box file-content" id="diff-{{.Index}}">
|
||||||
<div class="panel-header">
|
<h4 class="ui top attached normal header">
|
||||||
<div class="diff-counter count pull-left">
|
<div class="diff-counter count ui left">
|
||||||
{{if not $file.IsBin}}
|
{{if not $file.IsBin}}
|
||||||
<span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
|
<span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
|
||||||
<span class="bar">
|
<span class="bar">
|
||||||
|
@ -89,20 +88,23 @@
|
||||||
{{$.i18n.Tr "repo.diff.bin"}}
|
{{$.i18n.Tr "repo.diff.bin"}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{if $file.IsDeleted}}
|
|
||||||
<a class="btn btn-gray btn-header btn-radius text-black pull-right" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
|
|
||||||
{{else}}
|
|
||||||
<a class="btn btn-gray btn-header btn-radius text-black pull-right" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
|
|
||||||
{{end}}
|
|
||||||
<span class="file">{{$file.Name}}</span>
|
<span class="file">{{$file.Name}}</span>
|
||||||
|
<div class="ui right">
|
||||||
|
{{if $file.IsDeleted}}
|
||||||
|
<a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
|
||||||
|
{{else}}
|
||||||
|
<a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
</h4>
|
||||||
|
<div class="ui attached table segment">
|
||||||
{{$isImage := (call $.IsImageFile $file.Name)}}
|
{{$isImage := (call $.IsImageFile $file.Name)}}
|
||||||
<div class="panel-body file-body file-code code-view code-diff">
|
|
||||||
{{if $isImage}}
|
{{if $isImage}}
|
||||||
<div class="text-center">
|
<div class="center">
|
||||||
<img src="{{$.RawPath}}/{{EscapePound .Name}}">
|
<img src="{{$.RawPath}}/{{EscapePound .Name}}">
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
<div class="file-body file-code code-view code-diff">
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{range .Sections}}
|
{{range .Sections}}
|
||||||
|
@ -114,7 +116,6 @@
|
||||||
<td class="lines-num lines-num-new">
|
<td class="lines-num lines-num-new">
|
||||||
<span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
|
<span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="lines-code">
|
<td class="lines-code">
|
||||||
<pre>{{$line.Content}}</pre>
|
<pre>{{$line.Content}}</pre>
|
||||||
</td>
|
</td>
|
||||||
|
@ -123,6 +124,7 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -131,4 +133,4 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{template "ng/base/footer" .}}
|
{{template "base/footer" .}}
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if or $.IsRepositoryAdmin (eq .Poster.Id $.SignedUserID)}}
|
{{if or $.IsRepositoryAdmin (eq .Poster.Id $.SignedUserID)}}
|
||||||
<a class="edit-content item" href="#" data-type="comment"><i class="octicon octicon-pencil"></i></a>
|
<a class="edit-content item" href="#"><i class="octicon octicon-pencil"></i></a>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -53,12 +53,12 @@
|
||||||
<form class="ui form" action="{{.Link}}" method="post">
|
<form class="ui form" action="{{.Link}}" method="post">
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
<div class="field {{if .Err_Title}}error{{end}}">
|
<div class="field {{if .Err_Title}}error{{end}}">
|
||||||
<label>{{.i18n.Tr "repo.settings.title"}}</label>
|
<label for="title">{{.i18n.Tr "repo.settings.title"}}</label>
|
||||||
<input name="title" value="{{.title}}" autofocus required>
|
<input id="title" name="title" value="{{.title}}" autofocus required>
|
||||||
</div>
|
</div>
|
||||||
<div class="field {{if .Err_Content}}error{{end}}">
|
<div class="field {{if .Err_Content}}error{{end}}">
|
||||||
<label>{{.i18n.Tr "repo.settings.deploy_key_content"}}</label>
|
<label for="content">{{.i18n.Tr "repo.settings.deploy_key_content"}}</label>
|
||||||
<textarea name="content" required>{{.content}}</textarea>
|
<textarea id="content" name="content" required>{{.content}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
<button class="ui green button">
|
<button class="ui green button">
|
||||||
{{.i18n.Tr "repo.settings.add_deploy_key"}}
|
{{.i18n.Tr "repo.settings.add_deploy_key"}}
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
<li {{if .PageIsSettingsPassword}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/password">{{.i18n.Tr "settings.password"}}</a></li>
|
<li {{if .PageIsSettingsPassword}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/password">{{.i18n.Tr "settings.password"}}</a></li>
|
||||||
<li {{if .PageIsSettingsEmails}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/email">{{.i18n.Tr "settings.emails"}}</a></li>
|
<li {{if .PageIsSettingsEmails}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/email">{{.i18n.Tr "settings.emails"}}</a></li>
|
||||||
<li {{if .PageIsSettingsSSHKeys}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/ssh">{{.i18n.Tr "settings.ssh_keys"}}</a></li>
|
<li {{if .PageIsSettingsSSHKeys}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/ssh">{{.i18n.Tr "settings.ssh_keys"}}</a></li>
|
||||||
|
{{if .HasOAuthService}}
|
||||||
<li {{if .PageIsSettingsSocial}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/social">{{.i18n.Tr "settings.social"}}</a></li>
|
<li {{if .PageIsSettingsSocial}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/social">{{.i18n.Tr "settings.social"}}</a></li>
|
||||||
|
{{end}}
|
||||||
<li {{if .PageIsSettingsApplications}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/applications">{{.i18n.Tr "settings.applications"}}</a></li>
|
<li {{if .PageIsSettingsApplications}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/applications">{{.i18n.Tr "settings.applications"}}</a></li>
|
||||||
<li {{if .PageIsSettingsDelete}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/delete">{{.i18n.Tr "settings.delete"}}</a></li>
|
<li {{if .PageIsSettingsDelete}}class="current"{{end}}><a href="{{AppSubUrl}}/user/settings/delete">{{.i18n.Tr "settings.delete"}}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,63 +1,92 @@
|
||||||
{{template "ng/base/head" .}}
|
{{template "base/head" .}}
|
||||||
{{template "ng/base/header" .}}
|
<div class="user settings">
|
||||||
<div id="setting-wrapper" class="main-wrapper">
|
<div class="ui container">
|
||||||
<div id="user-profile-setting" class="container clear">
|
<div class="ui grid">
|
||||||
{{template "user/settings/nav" .}}
|
{{template "user/settings/navbar" .}}
|
||||||
<div class="grid-4-5 left">
|
<div class="twelve wide column content">
|
||||||
<div class="setting-content">
|
{{template "base/alert" .}}
|
||||||
{{template "ng/base/alert" .}}
|
<h4 class="ui top attached header">
|
||||||
<div id="user-ssh-setting-content">
|
{{.i18n.Tr "settings.manage_ssh_keys"}}
|
||||||
<div id="user-ssh-panel" class="panel panel-radius">
|
<div class="ui right">
|
||||||
<div class="panel-header">
|
<div class="ui blue tiny show-panel button" data-panel="#add-ssh-key-panel">{{.i18n.Tr "settings.add_key"}}</div>
|
||||||
<a class="show-form-btn" data-target-form="#user-ssh-add-form">
|
</div>
|
||||||
<button class="btn btn-medium btn-black btn-radius right">{{.i18n.Tr "settings.add_key"}}</button>
|
</h4>
|
||||||
</a>
|
<div class="ui attached segment">
|
||||||
<strong>{{.i18n.Tr "settings.manage_ssh_keys"}}</strong>
|
<div class="ui key list">
|
||||||
|
<div class="item">
|
||||||
|
{{.i18n.Tr "settings.ssh_desc"}}
|
||||||
</div>
|
</div>
|
||||||
<ul class="panel-body setting-list">
|
|
||||||
<li>{{.i18n.Tr "settings.ssh_desc"}}</li>
|
|
||||||
{{range .Keys}}
|
{{range .Keys}}
|
||||||
<li class="ssh clear">
|
<div class="item ui grid">
|
||||||
<span class="active-icon left label label-{{if .HasRecentActivity}}green{{else}}gray{{end}} label-radius"></span>
|
<div class="one wide column">
|
||||||
|
<i class="ssh-key-state-indicator fa fa-circle{{if .HasRecentActivity}} active invert poping up{{else}}-o{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.key_state_desc"}}" data-variation="inverted"{{end}}></i>
|
||||||
|
</div>
|
||||||
|
<div class="one wide column">
|
||||||
<i class="mega-octicon octicon-key left"></i>
|
<i class="mega-octicon octicon-key left"></i>
|
||||||
<div class="ssh-content left">
|
|
||||||
<p><strong>{{.Name}}</strong></p>
|
|
||||||
<p class="print">{{.Fingerprint}}</p>
|
|
||||||
<p class="activity"><i>{{$.i18n.Tr "settings.add_on"}} <span title="{{DateFmtLong .Created}}">{{DateFmtShort .Created}}</span> — <i class="octicon octicon-info"></i>{{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} <span title="{{DateFmtLong .Updated}}">{{DateFmtShort .Updated}}</span>{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}</i></p>
|
|
||||||
</div>
|
</div>
|
||||||
<form action="{{AppSubUrl}}/user/settings/ssh" method="post">
|
<div class="eleven wide column">
|
||||||
{{$.CsrfTokenHtml}}
|
<strong>{{.Name}}</strong>
|
||||||
<input name="_method" type="hidden" value="DELETE">
|
<div class="print meta">
|
||||||
<input name="id" type="hidden" value="{{.ID}}">
|
{{.Fingerprint}}
|
||||||
<button class="right ssh-btn btn btn-red btn-radius btn-small">{{$.i18n.Tr "settings.delete_key"}}</button>
|
</div>
|
||||||
</form>
|
<div class="activity meta">
|
||||||
</li>
|
<i>{{$.i18n.Tr "settings.add_on"}} <span>{{DateFmtShort .Created}}</span> — <i class="octicon octicon-info"></i> {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} <span>{{DateFmtShort .Updated}}</span>{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}</i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="two wide column">
|
||||||
|
<button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}">
|
||||||
|
{{$.i18n.Tr "settings.delete_key"}}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
<p>{{.i18n.Tr "settings.ssh_helper" "https://help.github.com/articles/generating-ssh-keys" "https://help.github.com/ssh-issues/" | Str2html}}</p>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<form class="panel panel-radius form form-align form-settings-add hide" id="user-ssh-add-form" action="{{AppSubUrl}}/user/settings/ssh" method="post">
|
<p>{{.i18n.Tr "settings.ssh_helper" "https://help.github.com/articles/generating-ssh-keys" "https://help.github.com/ssh-issues/" | Str2html}}</p>
|
||||||
|
<div {{if not .HasError}}class="hide"{{end}} id="add-ssh-key-panel">
|
||||||
|
<h4 class="ui top attached header">
|
||||||
|
{{.i18n.Tr "settings.add_new_key"}}
|
||||||
|
</h4>
|
||||||
|
<div class="ui attached segment">
|
||||||
|
<form class="ui form" action="{{.Link}}" method="post">
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
<p class="panel-header"><strong>{{.i18n.Tr "settings.add_new_key"}}</strong></p>
|
<div class="field {{if .Err_Title}}error{{end}}">
|
||||||
<div class="panel-body">
|
<label for="title">{{.i18n.Tr "settings.key_name"}}</label>
|
||||||
<p class="field">
|
<input id="title" name="title" value="{{.title}}" autofocus required>
|
||||||
<label class="req" for="ssh-title">{{.i18n.Tr "settings.key_name"}}</label>
|
|
||||||
<input class="ipt ipt-radius" id="ssh-title" name="title" type="text" required />
|
|
||||||
</p>
|
|
||||||
<p class="field clear">
|
|
||||||
<label class="left req" for="ssh-key">{{.i18n.Tr "settings.key_content"}}</label>
|
|
||||||
<textarea class="ipt ipt-radius left" name="content" id="ssh-key" required></textarea>
|
|
||||||
</p>
|
|
||||||
<p class="field">
|
|
||||||
<label></label>
|
|
||||||
<button class="btn btn-green btn-radius" id="ssh-add-btn">{{.i18n.Tr "settings.add_key"}}</button>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field {{if .Err_Content}}error{{end}}">
|
||||||
|
<label for="content">{{.i18n.Tr "settings.key_content"}}</label>
|
||||||
|
<textarea id="content" name="content" required>{{.content}}</textarea>
|
||||||
|
</div>
|
||||||
|
<button class="ui green button">
|
||||||
|
{{.i18n.Tr "settings.add_key"}}
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{template "ng/base/footer" .}}
|
</div>
|
||||||
|
|
||||||
|
<div class="ui small basic delete modal">
|
||||||
|
<div class="ui icon header">
|
||||||
|
<i class="trash icon"></i>
|
||||||
|
{{.i18n.Tr "settings.ssh_key_deletion"}}
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<p>{{.i18n.Tr "settings.ssh_key_deletion_desc"}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="actions">
|
||||||
|
<div class="ui red basic inverted cancel button">
|
||||||
|
<i class="remove icon"></i>
|
||||||
|
{{.i18n.Tr "modal.no"}}
|
||||||
|
</div>
|
||||||
|
<div class="ui green basic inverted ok button">
|
||||||
|
<i class="checkmark icon"></i>
|
||||||
|
{{.i18n.Tr "modal.yes"}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{template "base/footer" .}}
|
Loading…
Reference in New Issue