aboutsummaryrefslogtreecommitdiff
path: root/static/manage.html
blob: 06288cd5eb02443270ebcc2da27f57c9eb81620f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{{ define "title" }}{{ .Title }}{{ end }}
{{ define "header" }}
<script src="/static/js/posts.js"></script>
{{ end }}
{{ define "top" }}{{ end }}
{{ define "content" }}
<div style="text-align: center; margin: 0 auto; width: 400px;">
  <h1>Manage /{{ .Board.Name }}/</h1>
  <!-- <div><a href="/{{ .Key }}/deleteboard?name={{ .Board.Name }}">[Delete Board]</a></div>     -->
  <ul style="display: inline-block; padding: 0;">
    {{ if .IsLocal }}
    <li style="display: inline-block;"><a href="javascript:show('following')">[ Subscribed ]</a></li>
    <li style="display: inline-block;"><a href="javascript:show('followers')">[ Subscribers ]</a></li>
    {{ end }}
    <li style="display: inline-block;"><a href="javascript:show('reported')">[ Reported ]</a></li>            
  </ul>
</div>    
<a href="/{{ .Board.Name }}">[Return]</a>
{{ $actor := .Actor.Id }}
{{ $board := .Board }}
{{ $key := .Key }}
{{ if .IsLocal }}
<div id="following">
  <h4>Subscribed</h4>
  <form id="follow-form" action="/{{ .Key }}/{{ .Board.Name }}/follow" method="post" enctype="application/x-www-form-urlencoded">  
    <label>Subscribe:</label><br>
    <input id="follow" name="follow" style="margin-bottom: 12px;" placeholder="https://localhost:3000/g"></input>
    <input type="submit" value="Subscribe"><br>
    <input type="hidden" name="actor" value="{{ .Actor.Id }}">            
  </form>
  <ul style="display: inline-block; padding: 0; margin: 0;">

    {{ range .Following }}
    <li><a href="/{{ $key }}/{{ $board.Name }}/follow?follow={{ . }}&actor={{ $actor }}">[Unsubscribe]</a><a href="{{ . }}">{{ . }}</a></li>
    {{ end }}
  </ul>
</div>

<div id="followers" style="display: none;">
  <h4>Subscribers</h4>
  <ul style="display: inline-block; padding: 0; margin: 0;">
    {{ range .Followers }}
    <li><a href="{{ . }}">{{ . }}</a></li>
    {{ end }}        
  </ul>      
</div>
{{ end }}

<div id="reported" style="display: none;">
  <h4>Reported</h4>
  <ul style="display: inline-block; padding: 0; margin: 0;">

    {{ $domain := .Domain }}
    {{ range .Reported }}
    <li><a id="rpost" post="{{ .ID }}" href=""></a> - <b>{{ .Count }}</b> <a href="/delete?id={{ .ID }}&board={{ $board.Name }}">[Remove Post]</a> <a href="/deleteattach?id={{ .ID }}">[Remove Attachment]</a> <a href="/report?id={{ .ID }}&close=1&board={{ $board.Name }}">[Close]</a></li>
    {{ end }}
  </ul>            
</div>
{{ end }}
{{ define "bottom" }}{{ end }}

{{ define "script" }}
<script>
  function show(element)
  {
      {{ if .IsLocal }}
      var following = document.getElementById("following");
      var followers = document.getElementById("followers");
      following.style.display = "none";
      followers.style.display = "none";
      {{ end }}
      
      var reported = document.getElementById("reported");      
      reported.style.display = "none";

      document.getElementById(element).style.display = "block";
  }

  var reported = document.querySelectorAll('#rpost');
  var reportedArray = [].slice.call(reported);

  reportedArray.forEach(function(r, i){
      var id = r.getAttribute("post")
      r.innerText = "/" + {{ .Board.Name }} + "/" + shortURL("{{ .Actor.Id }}", id)
      r.href = {{ .Domain }} + "/" + {{ .Board.Name }} + "/" + shortURL("{{ .Actor.Id }}", id)
  })  
</script>
{{ end }}