Add auto-detect home directory

tokarchuk/v1.17
Unknown 11 years ago
parent 9047cadcd3
commit a55941ff83
  1. 2
      conf/app.ini
  2. 9
      modules/base/conf.go
  3. 12
      routers/repo/issue.go
  4. 2
      templates/install.tmpl
  5. 18
      templates/issue/view.tmpl

@ -7,7 +7,7 @@ RUN_USER = git
RUN_MODE = dev
[repository]
ROOT = /Users/%(RUN_USER)s/git/gogs-repositories
ROOT =
LANG_IGNS = Google Go|C|C++|Python|Ruby|C Sharp
LICENSES = Apache v2 License|GPL v2|MIT License|Affero GPL|Artistic License 2.0|BSD (3-Clause) License

@ -291,9 +291,14 @@ func NewConfigContext() {
PictureService = Cfg.MustValue("picture", "SERVICE")
// Determine and create root git reposiroty path.
RepoRootPath = Cfg.MustValue("repository", "ROOT")
homeDir, err := com.HomeDir()
if err != nil {
fmt.Printf("Fail to get home directory): %v\n", err)
os.Exit(2)
}
RepoRootPath = Cfg.MustValue("repository", "ROOT", filepath.Join(homeDir, "git/gogs-repositories"))
if err = os.MkdirAll(RepoRootPath, os.ModePerm); err != nil {
fmt.Printf("models.init(fail to create RepoRootPath(%s)): %v\n", RepoRootPath, err)
fmt.Printf("Fail to create RepoRootPath(%s): %v\n", RepoRootPath, err)
os.Exit(2)
}
}

@ -231,6 +231,12 @@ func Comment(ctx *middleware.Context, params martini.Params) {
return
}
content := ctx.Query("content")
if len(content) == 0 {
ctx.Redirect(fmt.Sprintf("/%s/%s/issues/%d", ctx.User.Name, ctx.Repo.Repository.Name, index))
return
}
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, int64(index))
if err != nil {
if err == models.ErrIssueNotExist {
@ -241,12 +247,6 @@ func Comment(ctx *middleware.Context, params martini.Params) {
return
}
content := ctx.Query("content")
if len(content) == 0 {
ctx.Handle(404, "issue.Comment", err)
return
}
switch params["action"] {
case "new":
if err = models.CreateComment(ctx.User.Id, issue.Id, 0, 0, content); err != nil {

@ -133,7 +133,7 @@
<hr/>
<div class="form-group text-center">
<!-- <button class="btn btn-primary btn-lg">Test Configuration</button> -->
<button class="btn btn-primary btn-lg">Test Configuration</button>
<button class="btn btn-danger btn-lg">Install Gogs</button>
<button class="btn btn-default btn-sm" type="button" data-toggle="modal" data-target="#advance-options-modal">
Advanced Options

@ -11,7 +11,7 @@
<h1 class="title pull-left">{{.Issue.Name}}</h1>
<input id="issue-edit-title" class="form-control input-lg pull-left hidden" type="text" value="{issue.title}" data-ajax-rel="issue-save"/>
<p class="info pull-left">
<a class="btn btn-default pull-right issue-edit" href="#" id="issue-edit-btn">Edit</a>
<!-- <a class="btn btn-default pull-right issue-edit" href="#" id="issue-edit-btn">Edit</a> -->
<a class="btn btn-danger pull-right issue-edit-cancel hidden" href="#">Cancel</a>
<a class="btn btn-primary pull-right issue-edit-save hidden" href="#" data-ajax="{issue.save.link}" data-ajax-name="issue-save">Save</a>
<span class="status label label-{{if .Issue.IsClosed}}danger{{else}}success{{end}}">{{if .Issue.IsClosed}}Closed{{else}}Open{{end}}</span>
@ -34,8 +34,8 @@
<div class="issue-content panel panel-default">
<div class="panel-heading">
<a href="/user/{{.Poster.Name}}" class="user">{{.Poster.Name}}</a> commented <span class="time">{{TimeSince .Created}}</span>
<a class="issue-comment-del pull-right issue-action" href="#" title="Edit Comment"><i class="fa fa-times-circle"></i></a>
<a class="issue-comment-edit pull-right issue-action" href="#" title="Remove Comment" data-url="{remove-link}"><i class="fa fa-edit"></i></a>
<!-- <a class="issue-comment-del pull-right issue-action" href="#" title="Edit Comment"><i class="fa fa-times-circle"></i></a>
<a class="issue-comment-edit pull-right issue-action" href="#" title="Remove Comment" data-url="{remove-link}"><i class="fa fa-edit"></i></a> -->
<span class="role label label-default pull-right">Owner</span>
</div>
<div class="panel-body markdown">
@ -44,7 +44,7 @@
</div>
</div>
{{end}}
<div class="issue-child issue-closed">
<!-- <div class="issue-child issue-closed">
<a class="user pull-left" href="{user.link}"><img class="avatar" src="{user.avatar}" alt=""/></a>
<div class="issue-content">
<a class="user pull-left" href="{user.link}">{user.name}</a>
@ -59,7 +59,7 @@
<span class="btn btn-success">Reopened</span> this
<span class="time">{close.time}</span>
</div>
</div>
</div> -->
<hr class="issue-line"/>
<div class="issue-child issue-reply">
<a class="user pull-left" href="/user/{{.SignedUser.Name}}"><img class="avatar" src="{{.SignedUser.AvatarLink}}" alt=""/></a>
@ -86,9 +86,11 @@
</div>
<div class="text-right">
<div class="form-group">
<input type="hidden" value="id" name="repo-id"/>
<button class="btn-default btn issue-open" id="issue-open-btn" data-origin="Re-Open" data-text="Re-Open & Comment">Open</button>&nbsp;&nbsp;
<button class="btn-default btn issue-close" id="issue-close-btn" data-origin="Close" data-text="Close & Comment">Close</button>&nbsp;&nbsp;
{{if .Issue.IsClosed}}
<input type="hidden" value="reopen" name="change_status"/>
<button class="btn-default btn issue-open" id="issue-open-btn" data-origin="Re-Open" data-text="Re-Open & Comment">Reopen</button>{{else}}
<input type="hidden" value="close" name="change_status"/>
<button class="btn-default btn issue-close" id="issue-close-btn" data-origin="Close" data-text="Close & Comment">Close</button>{{end}}&nbsp;&nbsp;
<button class="btn-success btn" id="issue-reply-btn">Comment</button>
</div>
</div>

Loading…
Cancel
Save