T697 default to user's first blog instead of draft

pull/189/head
Rob Loranger 5 years ago
parent 3759f16ed3
commit 02dd190945
No known key found for this signature in database
GPG Key ID: D6F1633A4F0903B8
  1. 8
      templates/pad.tmpl

@ -25,10 +25,10 @@
{{else}}<li><a id="publish-to"><span id="target-name">Draft</span> <img class="ic-18dp" src="/img/ic_down_arrow_dark@2x.png" /></a> {{else}}<li><a id="publish-to"><span id="target-name">Draft</span> <img class="ic-18dp" src="/img/ic_down_arrow_dark@2x.png" /></a>
<ul> <ul>
<li class="menu-heading">Publish to...</li> <li class="menu-heading">Publish to...</li>
<li class="target selected" id="anonymous"><a href="#anonymous"><i class="material-icons md-18">description</i> <em>Draft</em></a></li> {{if .Blogs}}{{range $idx, $el := .Blogs}}
{{if .Blogs}}{{range .Blogs}} <li class="target{{if eq $idx 0}} selected{{end}}" id="blog-{{$el.Alias}}"><a href="#{{$el.Alias}}"><i class="material-icons md-18">public</i> {{if $el.Title}}{{$el.Title}}{{else}}{{$el.Alias}}{{end}}</a></li>
<li class="target" id="blog-{{.Alias}}"><a href="#{{.Alias}}"><i class="material-icons md-18">public</i> {{if .Title}}{{.Title}}{{else}}{{.Alias}}{{end}}</a></li>
{{end}}{{end}} {{end}}{{end}}
<li class="target" id="blog-anonymous"><a href="#anonymous"><i class="material-icons md-18">description</i> <em>Draft</em></a></li>
<li id="user-separator" class="separator"><hr /></li> <li id="user-separator" class="separator"><hr /></li>
{{ if .SingleUser }} {{ if .SingleUser }}
<li><a href="/"><i class="material-icons md-18">launch</i> View Blog</a></li> <li><a href="/"><i class="material-icons md-18">launch</i> View Blog</a></li>
@ -278,7 +278,7 @@
document.getElementById('target-name').innerText = newText.join(' '); document.getElementById('target-name').innerText = newText.join(' ');
}); });
} }
var postTarget = H.get('postTarget', 'anonymous'); var postTarget = H.get('postTarget', '{{if .Blogs}}{{$blog := index .Blogs 0}}{{$blog.Alias}}{{else}}anonymous{{end}}');
if (location.hash != '') { if (location.hash != '') {
postTarget = location.hash.substring(1); postTarget = location.hash.substring(1);
// TODO: pushState to /pad (or whatever the URL is) so we live on a clean URL // TODO: pushState to /pad (or whatever the URL is) so we live on a clean URL

Loading…
Cancel
Save