summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorJan Dittberner <jandd@cacert.org>2017-04-17 16:24:37 +0200
committerJan Dittberner <jan@dittberner.info>2017-04-22 00:12:24 +0200
commit6fe515ea52493ea79a07efe9e1fc652dea272e32 (patch)
treeabb381406580fe6c9d7f29f6bf9cf7f3b2177653 /templates
parentf4360b98c8b3012bf27c75d9c04e7f9b737c9694 (diff)
downloadcacert-boardvoting-6fe515ea52493ea79a07efe9e1fc652dea272e32.tar.gz
cacert-boardvoting-6fe515ea52493ea79a07efe9e1fc652dea272e32.tar.xz
cacert-boardvoting-6fe515ea52493ea79a07efe9e1fc652dea272e32.zip
Implement proper model, actions and template structure
Diffstat (limited to 'templates')
-rw-r--r--templates/footer.html4
-rw-r--r--templates/header.html15
-rw-r--r--templates/motion.html21
-rw-r--r--templates/motion_fragments.html43
-rw-r--r--templates/motions.html70
5 files changed, 103 insertions, 50 deletions
diff --git a/templates/footer.html b/templates/footer.html
new file mode 100644
index 0000000..a7086ad
--- /dev/null
+++ b/templates/footer.html
@@ -0,0 +1,4 @@
+{{ define "footer" }}
+</body>
+</html>
+{{ end }} \ No newline at end of file
diff --git a/templates/header.html b/templates/header.html
new file mode 100644
index 0000000..5f777bb
--- /dev/null
+++ b/templates/header.html
@@ -0,0 +1,15 @@
+{{ define "pagetitle" }}
+CAcert Board Decisions{{ if .PageTitle }} - {{ .PageTitle }}{{ end}}
+{{ end }}
+
+{{ define "header" -}}
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/html">
+<head>
+ <title>{{ template "pagetitle" . }}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <link rel="stylesheet" type="text/css" href="/static/styles.css"/>
+</head>
+<body>
+<h1>{{ template "pagetitle" . }}</h1>
+{{ end }} \ No newline at end of file
diff --git a/templates/motion.html b/templates/motion.html
new file mode 100644
index 0000000..66e4ce0
--- /dev/null
+++ b/templates/motion.html
@@ -0,0 +1,21 @@
+{{ template "header" . }}
+<a href="/motions/">Show all votes</a>
+{{ $voter := .Voter }}
+<table class="list">
+ <thead>
+ <th>Status</th>
+ <th>Motion</th>
+ {{ if $voter}}
+ <th>Actions</th>
+ {{ end }}
+ </thead>
+ <tbody>
+ <tr>
+ {{ with .Decision }}
+ {{ template "motion_fragment" .}}
+ {{ if $voter }}{{ template "motion_actions" . }}{{ end }}
+ {{ end}}
+ </tr>
+ </tbody>
+</table>
+{{ template "footer" . }} \ No newline at end of file
diff --git a/templates/motion_fragments.html b/templates/motion_fragments.html
new file mode 100644
index 0000000..38c7a01
--- /dev/null
+++ b/templates/motion_fragments.html
@@ -0,0 +1,43 @@
+{{ define "motion_fragment" }}
+ <td class="{{.Status}}">
+ {{ if eq .Status 0 }}Pending {{ .Due}}
+ {{ else if eq .Status 1}}Approved {{ .Modified}}
+ {{ else if eq .Status -1}}Declined {{ .Modified}}
+ {{ else if eq .Status -2}}Withdrawn {{ .Modified}}
+ {{ else }}Unknown
+ {{ end }}
+ </td>
+ <td>
+ <i><a href="/motions/{{ .Tag}}">{{ .Tag}}</a></i><br/>
+ <b>{{ .Title}}</b><br/>
+ <pre>{{ wrap 76 .Content }}</pre>
+ <br/>
+ <i>Due: {{.Due}}</i><br/>
+ <i>Proposed: {{.Proposer}} ({{.Proposed}})</i><br/>
+ <i>Vote type: {{.VoteType}}</i><br/>
+ <i>Aye|Naye|Abstain: {{.Ayes}}|{{.Nayes}}|{{.Abstains}}</i><br/>
+ {{ if .Votes }}
+ <i>Votes:</i><br/>
+ {{ range .Votes}}
+ <i>{{ .Name }}: {{ .Vote.Vote }}</i><br/>
+ {{ end }}
+ <i><a href="/motions/{{.Tag}}">Hide Votes</a></i>
+ {{ else}}
+ <i><a href="/motions/{{.Tag}}?showvotes=1">Show Votes</a></i>
+ {{ end }}
+ </td>
+{{ end }}
+{{ define "motion_actions" }}
+ <td>
+ {{ if eq .Status 0 }}
+ <ul>
+ <li><a href="/vote/{{ .Tag }}/aye">Aye</a></li>
+ <li><a href="/vote/{{ .Tag }}/abstain">Abstain</a></li>
+ <li><a href="/vote/{{ .Tag }}/naye">Naye</a></li>
+ <li><a href="/proxy/{{ .Tag }}">Proxy Vote</a></li>
+ <li><a href="/motions/{{ .Tag }}/edit">Modify</a></li>
+ <li><a href="/motions/{{ .Tag }}/withdraw">Withdraw</a></li>
+ </ul>
+ {{ end }}
+ </td>
+{{ end }}
diff --git a/templates/motions.html b/templates/motions.html
index f717d78..ef84757 100644
--- a/templates/motions.html
+++ b/templates/motions.html
@@ -1,12 +1,9 @@
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/html">
-<head>
- <title>CAcert Board Decisions</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <link rel="stylesheet" type="text/css" href="/static/styles.css"/>
-</head>
-<body>
+{{ template "header" . }}
+{{ if .Params.Flags.Unvoted }}
+<a href="/motions/">Show all votes</a>
+{{ else }}
<a href="/motions/?unvoted=1">Show my outstanding votes</a><br/>
+{{ end }}
{{ $voter := .Voter }}
{{ if .Decisions }}
<table class="list">
@@ -20,57 +17,30 @@
<tbody>
{{range .Decisions }}
<tr>
- <td class="{{.Status}}">
- {{ if eq .Status 0 }}Pending {{ .Due}}
- {{ else if eq .Status 1}}Approved {{ .Modified}}
- {{ else if eq .Status -1}}Declined {{ .Modified}}
- {{ else if eq .Status -2}}Withdrawn {{ .Modified}}
- {{ else }}Unknown
- {{ end }}
- </td>
- <td>
- <i><a href="/motions/{{ .Tag}}">{{ .Tag}}</a></i><br />
- <b>{{ .Title}}</b><br />
- <pre>{{ wrap 76 .Content }}</pre>
- <br />
- <i>Due: {{.Due}}</i><br/>
- <i>Proposed: {{.Proposer}} ({{.Proposed}})</i><br/>
- <i>Vote type: {{.VoteType}}</i><br/>
- <i>Aye|Naye|Abstain: {{.Ayes}}|{{.Nayes}}|{{.Abstains}}</i><br />
- {{ if .Votes }}
- <i>Votes:</i><br/>
- {{ range .Votes}}
- <i>{{ .Name }}: {{ .Vote}}</i><br />
- {{ end }}
- {{ else}}
- <i><a href="/motions/{{.Tag}}?showvotes=1">Show Votes</a></i>
- {{ end }}
- </td>
- {{ if $voter }}
- <td>
- {{ if eq .Status 0 }}
- <ul>
- <li><a href="/vote/{{ .Tag }}/aye">Aye</a></li>
- <li><a href="/vote/{{ .Tag }}/abstain">Abstain</a></li>
- <li><a href="/vote/{{ .Tag }}/naye">Naye</a></li>
- <li><a href="/proxy/{{ .Tag }}">Proxy Vote</a></li>
- <li><a href="/motions/{{ .Tag }}/edit">Modify</a></li>
- <li><a href="/motions/{{ .Tag }}/withdraw">Withdraw</a></li>
- </ul>
- {{ end }}
- </td>{{ end }}
+ {{ template "motion_fragment" . }}
+ {{ if $voter }}{{ template "motion_actions" . }}{{ end }}
</tr>
{{end}}
<tr>
- <td colspan="{{ if $voter }}3{{ else }}2{{ end }}" class="navigation">
+ <td colspan="2" class="navigation">
{{ if .PrevPage }}<a href="?page={{ .PrevPage }}" title="previous page">&lt;</a>{{ end }}
{{ if .NextPage }}<a href="?page={{ .NextPage }}" title="next page">&gt;</a>{{ end }}
</td>
+ {{ if $voter }}
+ <td class="actions">
+ <ul>
+ <li><a href="/newmotion/">New Motion</a></li>
+ </ul>
+ </td>
+ {{ end }}
</tr>
</tbody>
</table>
{{else}}
+{{ if .Params.Flags.Unvoted }}
+<p>There are no motions requiring a vote from you.</p>
+{{ else }}
<p>There are no motions in the system yet.</p>
+{{ end }}
{{end}}
-</body>
-</html>
+{{ template "footer" . }} \ No newline at end of file