mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-05 06:43:21 +00:00
fix comment replies #1
This commit is contained in:
parent
f096d1d5ff
commit
19b09c866b
|
@ -1,25 +1,25 @@
|
||||||
<div class="comment{{if or (lt .P.Counts.Score -5) .P.Comment.Deleted }} hidden{{end}}" id="c{{.P.Comment.ID}}" onclick="commentClick(event)">
|
<div class="comment{{if or (lt .P.Counts.Score -5) .P.Comment.Deleted }} hidden{{end}}" id="c{{.P.Comment.ID}}" onclick="commentClick(event)">
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
{{ if .State.Session }}
|
{{ if .State.Session }}
|
||||||
<div class="score">
|
<div class="score">
|
||||||
<form class="link-btn{{ if eq .P.MyVote.String "1"}} like{{ else if eq .P.MyVote.String "-1"}} dislike{{end}}" method="POST">
|
<form class="link-btn{{ if eq .P.MyVote.String "1"}} like{{ else if eq .P.MyVote.String "-1"}} dislike{{end}}" method="POST">
|
||||||
<input type="submit" name="vote" value="▲">
|
<input type="submit" name="vote" value="▲">
|
||||||
<div></div>
|
<div></div>
|
||||||
{{ if .P.MyVote.IsValid}}
|
{{ if .P.MyVote.IsValid}}
|
||||||
<input type="hidden" name="undo" value="{{.P.MyVote.String}}">
|
<input type="hidden" name="undo" value="{{.P.MyVote.String}}">
|
||||||
{{ end}}
|
{{ end}}
|
||||||
<input type="hidden" name="op" value="vote_comment">
|
<input type="hidden" name="op" value="vote_comment">
|
||||||
<input type="hidden" name="commentid" value="{{.P.Comment.ID }}">
|
<input type="hidden" name="commentid" value="{{.P.Comment.ID }}">
|
||||||
<input type="submit" name="vote" value="▼">
|
<input type="submit" name="vote" value="▼">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<a class="minimize" href="" for="c{{.P.Comment.ID}}">
|
<a class="minimize" href="" for="c{{.P.Comment.ID}}">
|
||||||
{{if or (lt .P.Counts.Score -5) .P.Comment.Deleted }}
|
{{if or (lt .P.Counts.Score -5) .P.Comment.Deleted }}
|
||||||
[+]
|
[+]
|
||||||
{{ else }}
|
{{ else }}
|
||||||
[-]
|
[-]
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</a>
|
</a>
|
||||||
<a {{if .Submitter }}class="submitter"{{end}} href="/{{.State.Host}}/u/{{fullname .P.Creator}}">{{fullname .P.Creator}}</a>
|
<a {{if .Submitter }}class="submitter"{{end}} href="/{{.State.Host}}/u/{{fullname .P.Creator}}">{{fullname .P.Creator}}</a>
|
||||||
{{.P.Counts.Score}} points <span title="{{.P.Comment.Published.Time}}">{{ humanize .P.Comment.Published.Time }}</span>
|
{{.P.Counts.Score}} points <span title="{{.P.Comment.Published.Time}}">{{ humanize .P.Comment.Published.Time }}</span>
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
* (last edited <span title="{{.P.Comment.Updated.Time}}">{{ humanize .P.Comment.Updated.Time }}</span>)
|
* (last edited <span title="{{.P.Comment.Updated.Time}}">{{ humanize .P.Comment.Updated.Time }}</span>)
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
{{ if eq .Op "edit" }}
|
{{ if eq .Op "edit" }}
|
||||||
<form class="savecomment" method="POST">
|
<form class="savecomment" method="POST">
|
||||||
<div>
|
<div>
|
||||||
<textarea required name="content">{{ .P.Comment.Content }}</textarea>
|
<textarea required name="content">{{ .P.Comment.Content }}</textarea>
|
||||||
|
@ -36,18 +36,22 @@
|
||||||
<input type="hidden" name="op" value="edit_comment">
|
<input type="hidden" name="op" value="edit_comment">
|
||||||
<input type="submit" value="save">
|
<input type="submit" value="save">
|
||||||
</form>
|
</form>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<div class="content{{ if and .Selected}} highlight{{end}}">{{if .P.Comment.Deleted}}[removed]{{else}}{{ markdown .State.Host .P.Comment.Content }}{{end}}</div>
|
<div class="content{{ if and .Selected}} highlight{{end}}">{{if .P.Comment.Deleted}}[removed]{{else}}{{ markdown .State.Host .P.Comment.Content }}{{end}}</div>
|
||||||
{{ if eq .Op "source" }}<div><textarea>{{.P.Comment.Content}}</textarea></div>{{end}}
|
{{ if eq .Op "source" }}
|
||||||
{{ end }}
|
<div><textarea>{{.P.Comment.Content}}</textarea></div>
|
||||||
|
{{end}}
|
||||||
|
{{ end }}
|
||||||
<ul class="buttons">
|
<ul class="buttons">
|
||||||
<li><a href="/{{.State.Host}}/comment/{{.P.Comment.ID}}">permalink</a></li>
|
<li><a href="/{{.State.Host}}/comment/{{.P.Comment.ID}}">permalink</a></li>
|
||||||
{{ if ne .Op "source"}}
|
{{ if ne .Op "source"}}
|
||||||
<li><a class="source" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?source">source</a></li>
|
<li><a class="source" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?source">source</a></li>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<li><a class="source" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?">hide source</a></li>
|
<li><a class="source" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?">hide source</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if and .State.Session (eq .P.Comment.CreatorID .State.Session.UserID) (ne .Op "edit")}}
|
|
||||||
|
{{ if .State.Session }}
|
||||||
|
{{ if and (eq .P.Comment.CreatorID .State.Session.UserID) (ne .Op "edit")}}
|
||||||
<li><a class="edit" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?edit">edit</a></li>
|
<li><a class="edit" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?edit">edit</a></li>
|
||||||
<li>
|
<li>
|
||||||
<form class="delete" method="POST">
|
<form class="delete" method="POST">
|
||||||
|
@ -56,13 +60,14 @@
|
||||||
<input type="submit" value="delete">
|
<input type="submit" value="delete">
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
{{ if ne .Op "reply"}}
|
{{ end }}
|
||||||
|
{{ if ne .Op "reply"}}
|
||||||
<li><a class="reply" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?reply">reply</a></li>
|
<li><a class="reply" for="c{{.P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?reply">reply</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
<div class="children">
|
<div class="children">
|
||||||
{{ if eq .State.Op "reply" }}
|
{{ if and (eq .State.Op "reply") (eq .State.CommentID .P.Comment.ID)}}
|
||||||
<form class="savecomment" method="POST">
|
<form class="savecomment" method="POST">
|
||||||
<div>
|
<div>
|
||||||
<textarea required name="content"></textarea>
|
<textarea required name="content"></textarea>
|
||||||
|
@ -71,13 +76,13 @@
|
||||||
<input type="hidden" name="op" value="create_comment">
|
<input type="hidden" name="op" value="create_comment">
|
||||||
<input type="submit" value="save">
|
<input type="submit" value="save">
|
||||||
</form>
|
</form>
|
||||||
{{ end}}
|
{{ end}}
|
||||||
{{ range $ci, $child := .C }}{{ template "comment.html" $child }}{{end}}
|
{{ range $ci, $child := .C }}{{ template "comment.html" $child }}{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{ if ne .P.Counts.ChildCount .ChildCount}}
|
{{ if ne .P.Counts.ChildCount .ChildCount}}
|
||||||
<div class="morecomments">
|
<div class="morecomments">
|
||||||
<a class="loadmore" for="c{{ .P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?">load more comments</a>
|
<a class="loadmore" for="c{{ .P.Comment.ID}}" href="/{{.State.Host}}/comment/{{.P.Comment.ID}}?">load more comments</a>
|
||||||
<span class="gray">({{ sub .P.Counts.ChildCount .ChildCount}} replies)</span>
|
<span class="gray">({{ sub .P.Counts.ChildCount .ChildCount}} replies)</span>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|
99
templates/settings.html
Normal file
99
templates/settings.html
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<head>
|
||||||
|
<title>{{ host .Host }}: preferences</title>
|
||||||
|
<link rel="shortcut icon" href="/{{.Host}}/icon.jpg">
|
||||||
|
<link rel="stylesheet" href="/_/static/style.css?1">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
</head>
|
||||||
|
<body {{ if .Dark}}class="dark"{{end}}>
|
||||||
|
<nav>
|
||||||
|
<div class="communities">
|
||||||
|
<a href="/{{.Host}}">home</a>
|
||||||
|
<span> - </span>
|
||||||
|
<a href="/{{.Host}}?listingType=All">all</a>
|
||||||
|
|
|
||||||
|
{{ $host := .Host }}
|
||||||
|
{{ range $i, $c := .TopCommunities}}
|
||||||
|
<a href="/{{$host}}/c/{{$c.Community.Name}}">{{$c.Community.Name}}</a>
|
||||||
|
<span> - </span>
|
||||||
|
{{ end }}
|
||||||
|
<a href="/{{$host}}/search?searchtype=Communities" class="more">more »</a>
|
||||||
|
</div>
|
||||||
|
<div class="right">
|
||||||
|
{{ if .Session }}
|
||||||
|
<a href="/{{.Host}}/u/{{ .Session.UserName}}">{{ .Session.UserName }}</a>
|
||||||
|
|
|
||||||
|
<a href="/{{.Host}}/inbox" class="mailbox{{ if .UnreadCount }} orangered{{end}}">✉</a>
|
||||||
|
|
|
||||||
|
<a href="/{{.Host}}/settings">settings</a>
|
||||||
|
|
|
||||||
|
<form method="POST"><input type="submit" name="op" value="logout"></form>
|
||||||
|
{{else}}
|
||||||
|
Want to join? <a href="/{{.Host}}/login">Log in</a> or <a href="/{{.Host}}/login">sign up</a> in seconds
|
||||||
|
|
|
||||||
|
<a href="/{{.Host}}/settings">settings</a>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
<div class="spacer">
|
||||||
|
<a href="/{{ .Host}}/">
|
||||||
|
<img class="icon" src="{{ if .Site }}{{ .Site.SiteView.Site.Icon.String }}{{else}}/{{ .Host}}/icon.jpg{{end}}">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<span class="title"><a class="title" href="/{{.Host}}">{{host .Host}}</a> - settings</span>
|
||||||
|
<ul>
|
||||||
|
<li class="selected"><a href="">options</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
{{ if .Alert }}
|
||||||
|
<div class="alert">
|
||||||
|
{{ .Alert }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ if .Error }}
|
||||||
|
<div class="error">{{.Error}}</div>
|
||||||
|
{{ end }}
|
||||||
|
<form class="preferences" method="POST">
|
||||||
|
<div>
|
||||||
|
<label>
|
||||||
|
default listing
|
||||||
|
</label>
|
||||||
|
<select name="DefaultListingType">
|
||||||
|
<option value="All"{{ if eq .Listing "All" }} selected{{end}}>All</option>
|
||||||
|
<option value="Local"{{ if eq .Listing "Local" }} selected{{end}}>Local</option>
|
||||||
|
<option value="Subscribed"{{ if eq .Listing "Subscribed" }} selected{{end}}>Subscribed</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>
|
||||||
|
default sort
|
||||||
|
</label>
|
||||||
|
<select name="DefaultSortType">
|
||||||
|
<option value="Hot"{{ if eq .Sort "Hot"}} selected{{end}}>Hot</option>
|
||||||
|
<option value="Active"{{ if eq .Sort "Active"}} selected{{end}}>Active</option>
|
||||||
|
<option value="New"{{ if eq .Sort "New"}} selected{{end}}>New</option>
|
||||||
|
<option value="Old"{{ if eq .Sort "Old"}} selected{{end}}>Old</option>
|
||||||
|
<option value="MostComments"{{ if eq .Sort "MostComments"}} selected{{end}}>Most Comments</option>
|
||||||
|
<option value="NewComments"{{ if eq .Sort "NewComments"}} selected{{end}}>New Comments</option>
|
||||||
|
<option value="TopHour"{{ if eq .Sort "TopHour"}} selected{{end}}>Top Hour</option>
|
||||||
|
<option value="TopSixHour"{{ if eq .Sort "TopSixHour"}} selected{{end}}>Top Six Hours</option>
|
||||||
|
<option value="TopTwelveHour"{{ if eq .Sort "TopTwelveHour"}} selected{{end}}>Top Twelve Hours</option>
|
||||||
|
<option value="TopDay"{{ if eq .Sort "TopDay"}} selected{{end}}>Top Day</option>
|
||||||
|
<option value="TopWeek"{{ if eq .Sort "TopWeek"}} selected{{end}}>Top Week</option>
|
||||||
|
<option value="TopMonth"{{ if eq .Sort "TopMonth"}} selected{{end}}>Top Month</option>
|
||||||
|
<option value="TopYear"{{ if eq .Sort "TopYear"}} selected{{end}}>Top Year</option>
|
||||||
|
<option value="TopAll"{{ if eq .Sort "TopAll"}} selected{{end}}>Top All Time</option></select>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>
|
||||||
|
dark mode
|
||||||
|
</label>
|
||||||
|
<input type="checkbox" name="darkmode" {{ if .Dark }}checked{{end}}>
|
||||||
|
<div>
|
||||||
|
<label></label>
|
||||||
|
<input type="submit" value="save">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in a new issue