Edit lists

This commit is contained in:
Las Zenow 2018-04-09 10:39:20 +00:00
parent 46762ea17b
commit 3797df8783
4 changed files with 132 additions and 6 deletions

View file

@ -2,14 +2,20 @@
<div class="row">
<h4 class="span10">{{.List.Title}} <a href="/list/{{.List.ListID}}?fmt=rss"><img src="/img/feed.png"/></a></h4>
<p class="span2 pull-right">By {{.List.User.Username}}</p>
<p class="span2 pull-right">
{{if eq .S.User .List.User.Username}}
<a href="/list/{{.List.ListID}}/edit" class="btn btn-primary"><i class="icon-pencil"></i> Edit</a>
{{else}}
By {{.List.User.Username}}
{{end}}
</p>
</div>
<br />
{{range .List.Description}}
<p>{{.}}</p>
{{end}}
<br />
{{template "book_list.html" .List.Books}}

55
templates/list_edit.html Normal file
View file

@ -0,0 +1,55 @@
{{template "header.html" .S}}
{{with .List}}
<form class="form-horizontal" method="POST" action="/list/{{.ListID}}">
<fieldset>
<div class="control-group">
<label class="control-label" for="title">Title</label>
<div class="controls">
<input class="input-xlarge" type="text" id="title" value="{{.Title}}" name="title">
</div>
</div>
</fieldset>
<fieldset>
<div class="control-group">
<label class="control-label" for="description">Description</label>
<div class="controls">
<textarea class="input-xlarge" id="description" rows="5" name="description">{{range .Description}}{{.}}
{{end}}</textarea>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Save</button>
<a href="/list/{{.ListID}}" class="btn">Cancel</a>
</div>
</fieldset>
</form>
{{end}}
{{$listID := .List.ListID}}
{{range .List.Books}}
<div class="row">
<div class="span1">
<p class="pull-right"><a href="/book/{{.ID}}">{{if .Cover}}<img class="img-rounded" src="/cover/{{.ID}}/small/{{.Title}}.jpg" alt="{{.Title}}" />{{end}}</a></p>
</div>
<div class="span10 well">
<div class="row">
<div class="span7">
<p>
<span class="muted">[{{if .Lang}}{{.Lang}}{{end}}]</span>
<a href="/book/{{.ID}}"><strong>{{.Title}}</strong></a>
<span class="muted">{{if .Publisher}}{{.Publisher}}{{end}}</span><br />
{{range .Authors}}{{.}}, {{end}}
</p>
</div>
<div class="span3">
<div class="pull-right">
<a href="/list/{{$listID}}/remove/{{.ID}}" class="btn btn-danger"><i class="icon-remove"></i> remove</a>
</div>
</div>
</div>
</div>
</div>
{{end}}
{{template "footer.html"}}