Skip to content

Commit 68b12a2

Browse files
committed
Additional push command
1 parent 035cb39 commit 68b12a2

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

internal/models/models.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type Repo struct {
2020
Timeout string `yaml:"timeout"`
2121
Pull string `yaml:"pull"`
2222
Push string `yaml:"push"`
23+
AddPush string `yaml:"addpush"`
2324
}
2425

2526
// GuiData - web gui data
@@ -28,5 +29,4 @@ type GuiData struct {
2829
Icon string
2930
Repos []Repo
3031
Themes []string
31-
Path string
3232
}

internal/web/add-upd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ func updateHandler(w http.ResponseWriter, r *http.Request) {
5050
repo.Pull = r.FormValue("pull")
5151
repo.Push = r.FormValue("push")
5252
repo.Timeout = r.FormValue("timeout")
53+
repo.AddPush = r.FormValue("addpush")
5354

5455
var newRepos []models.Repo
5556
for i := range AllRepos {

internal/web/edit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func editHandler(w http.ResponseWriter, r *http.Request) {
2121

2222
for _, oneRepo := range AllRepos {
2323
if oneRepo.ID == id {
24-
guiData.Path = oneRepo.Path
24+
guiData.Repos = append(guiData.Repos, oneRepo)
2525

2626
file1, err := os.ReadFile(oneRepo.Path + "/.git/config")
2727
check.IfError(err)

internal/web/templates/edit.html

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,41 @@
77
<p>Edit .git/config</p>
88
<form action="/save_file/" method="post">
99
<input name="file" value="config" type="hidden">
10+
{{ range .Repos }}
1011
<input name="path" value="{{ .Path }}" type="hidden">
11-
<textarea name="text" rows="15" class="form-control">{{index .Themes 0}}</textarea>
12+
{{ end }}
13+
<textarea name="text" rows="15" class="form-control">{{ index .Themes 0 }}</textarea>
1214
<button type="submit" class="btn btn-primary">Save</button>
1315
</form>
1416
</div>
1517
<div class="col">
1618
<p>Edit .gitignore</p>
1719
<form action="/save_file/" method="post">
1820
<input name="file" value="ignore" type="hidden">
21+
{{ range .Repos }}
1922
<input name="path" value="{{ .Path }}" type="hidden">
20-
<textarea name="text" rows="15" class="form-control">{{index .Themes 1}}</textarea>
23+
{{ end }}
24+
<textarea name="text" rows="15" class="form-control">{{ index .Themes 1 }}</textarea>
2125
<button type="submit" class="btn btn-primary">Save</button>
2226
</form>
2327
</div>
2428
</div>
29+
<br>
30+
<div class="row">
31+
<p>Additional push command</p>
32+
{{ range .Repos }}
33+
<form action="/update_repo/" method="post" class="input-group">
34+
<input name="id" value="{{ .ID }}" type="hidden">
35+
<input name="name" value="{{ .Name }}" type="hidden">
36+
<input name="path" value="{{ .Path }}" type="hidden">
37+
<input name="timeout" value="{{ .Timeout }}" type="hidden">
38+
<input name="pull" value="{{ .Pull }}" type="hidden">
39+
<input name="push" value="{{ .Push }}" type="hidden">
40+
<input name="addpush" type="text" class="form-control" value="{{ .AddPush }}">
41+
<button type="submit" class="btn btn-primary">Save</button>
42+
</form>
43+
{{ end }}
44+
</div>
2545
</div>
2646

2747

internal/web/templates/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
</a>
4343
</td>
4444
<form action="/update_repo/" method="post">
45-
<input name="id" type="hidden" class="form-control" value="{{ .ID }}">
45+
<input name="id" type="hidden" value="{{ .ID }}">
46+
<input name="addpush" type="hidden" value="{{ .AddPush }}">
4647
<td><input name="name" type="text" class="form-control" value="{{ .Name }}"></td>
4748
<td><input name="path" type="text" class="form-control" value="{{ .Path }}"></td>
4849
{{ if eq .Pull "yes" }}

0 commit comments

Comments
 (0)