fixed labels on publish, removed used of any
This commit is contained in:
parent
abed4eed41
commit
0431580dd6
27
comics.go
27
comics.go
|
@ -151,7 +151,7 @@ func allComics() ([]Comic, error) {
|
|||
return readRows(rows)
|
||||
}
|
||||
|
||||
func executeTemplate(w http.ResponseWriter, name string, data any) error {
|
||||
func executeTemplate(w http.ResponseWriter, name string, data interface{}) error {
|
||||
t, err := template.ParseFiles(filepath.Join(options.TemplatesPath, fmt.Sprintf("%s.html", name)))
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -198,16 +198,6 @@ func comicView(w http.ResponseWriter, r * http.Request) {
|
|||
}
|
||||
context.Current = i
|
||||
|
||||
c, err = getComic(i-1)
|
||||
if err != nil {
|
||||
errlog.Println(err)
|
||||
return404(w,r)
|
||||
err = nil
|
||||
return
|
||||
}
|
||||
|
||||
context.Comic = c
|
||||
context.Title = fmt.Sprintf("Black Ram Comics: %s", c.Title)
|
||||
|
||||
comics, err := allComics()
|
||||
if err != nil {
|
||||
|
@ -216,6 +206,21 @@ func comicView(w http.ResponseWriter, r * http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
if len(comics) > 0 {
|
||||
c, err = getComic(i-1)
|
||||
if err != nil {
|
||||
errlog.Println(err)
|
||||
return404(w,r)
|
||||
err = nil
|
||||
return
|
||||
}
|
||||
|
||||
context.Comic = c
|
||||
context.Title = fmt.Sprintf("Black Ram Comics: %s", c.Title)
|
||||
} else {
|
||||
context.Comic = nil
|
||||
}
|
||||
|
||||
context.First = 1
|
||||
context.Last = len(comics)
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
<label for="title"><Title></label>
|
||||
<input type="text" class="title" name="title" onkeypress="return event.keyCode != 13;">
|
||||
<input type="file" name="image" style="display:none;" id="browse" accept=".jpg, .jpeg, .png">
|
||||
<label type="submit" class="browse fake-button" for="browse" class="fake-button">Browse</label>
|
||||
<label type="submit" class="browse fake-button" for="browse" class="fake-button"><Browse></label>
|
||||
<input type="submit" style="display:none;" id="publish">
|
||||
<label type="submit" class="publish fake-button" for="publish">Publish</label>
|
||||
<label type="submit" class="publish fake-button" for="publish"><Publish></label>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue