List sources not in a channel on channel edit page
This commit is contained in:
parent
42ee09b386
commit
154a4fc904
@ -22,6 +22,11 @@ func GetSourcesInChannel(db DB) (map[string][]string, error) {
|
||||
rows, err := db.Query(`
|
||||
select name, source
|
||||
from channels
|
||||
union
|
||||
select '' as name, sources.name as source
|
||||
from sources
|
||||
left outer join channels on channels.source = sources.name
|
||||
where channels.name is null
|
||||
order by name, source
|
||||
`)
|
||||
if err != nil {
|
||||
|
@ -29,6 +29,7 @@
|
||||
</datalist>
|
||||
|
||||
{{ range $channel, $sources := .ChannelSources }}
|
||||
{{ if $channel }}
|
||||
<p><b><a href="/channel/{{ $channel }}">{{ $channel }}</a></b></p>
|
||||
<table>
|
||||
{{- range $sources }}
|
||||
@ -42,8 +43,17 @@
|
||||
<td><a href="/source/{{ . }}">{{ . }}</a></td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
|
||||
</table>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if index .ChannelSources "" }}
|
||||
<p><b>not in a channel</b></p>
|
||||
<ul>
|
||||
{{ range index .ChannelSources "" }}
|
||||
<li><a href="/source/{{ . }}">{{ . }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</nav>
|
||||
{{- end }}
|
||||
|
Loading…
Reference in New Issue
Block a user