Use Semantic UI for all HTML templates

This commit is contained in:
Jan Dittberner 2017-04-30 02:37:29 +02:00
parent 1c989fdfa3
commit c48bd9e356
17 changed files with 434 additions and 23015 deletions

View file

@ -79,7 +79,7 @@ func authenticateRequest(w http.ResponseWriter, r *http.Request, handler func(ht
needsAuth, ok := r.Context().Value(ctxNeedsAuth).(bool)
if ok && needsAuth {
w.WriteHeader(http.StatusForbidden)
renderTemplate(w, []string{"denied.html"}, nil)
renderTemplate(w, []string{"denied.html", "header.html", "footer.html"}, nil)
return
}
handler(w, r)

View file

@ -29,22 +29,22 @@ func (f *NewDecisionForm) Validate() (bool, *Decision) {
data.Title = strings.TrimSpace(f.Title)
if len(data.Title) < 3 {
f.Errors["Title"] = "Please enter at least 3 characters."
f.Errors["Title"] = "Please enter at least 3 characters for Title."
}
data.Content = strings.TrimSpace(f.Content)
if len(strings.Fields(data.Content)) < 3 {
f.Errors["Content"] = "Please enter at least 3 words."
f.Errors["Content"] = "Please enter at least 3 words as Text."
}
if voteType, err := strconv.ParseUint(f.VoteType, 10, 8); err != nil || (voteType != 0 && voteType != 1) {
f.Errors["VoteType"] = fmt.Sprint("Please choose a valid vote type", err)
f.Errors["VoteType"] = fmt.Sprint("Please choose a valid vote type.", err)
} else {
data.VoteType = VoteType(uint8(voteType))
}
if dueDuration, ok := validDueDurations[f.Due]; !ok {
f.Errors["Due"] = "Please choose a valid due date"
f.Errors["Due"] = "Please choose a valid due date."
} else {
year, month, day := time.Now().UTC().Add(dueDuration).Date()
data.Due = time.Date(year, month, day, 23, 59, 59, 0, time.UTC)
@ -69,22 +69,22 @@ func (f *EditDecisionForm) Validate() (bool, *Decision) {
data.Title = strings.TrimSpace(f.Title)
if len(data.Title) < 3 {
f.Errors["Title"] = "Please enter at least 3 characters."
f.Errors["Title"] = "Please enter at least 3 characters for Title."
}
data.Content = strings.TrimSpace(f.Content)
if len(strings.Fields(data.Content)) < 3 {
f.Errors["Content"] = "Please enter at least 3 words."
f.Errors["Content"] = "Please enter at least 3 words as Text."
}
if voteType, err := strconv.ParseUint(f.VoteType, 10, 8); err != nil || (voteType != 0 && voteType != 1) {
f.Errors["VoteType"] = fmt.Sprint("Please choose a valid vote type", err)
f.Errors["VoteType"] = fmt.Sprint("Please choose a valid vote type.", err)
} else {
data.VoteType = VoteType(uint8(voteType))
}
if dueDuration, ok := validDueDurations[f.Due]; !ok {
f.Errors["Due"] = "Please choose a valid due date"
f.Errors["Due"] = "Please choose a valid due date."
} else {
year, month, day := time.Now().UTC().Add(dueDuration).Date()
data.Due = time.Date(year, month, day, 23, 59, 59, 0, time.UTC)
@ -107,24 +107,24 @@ func (f *ProxyVoteForm) Validate() (bool, *Voter, *Vote, string) {
var voter *Voter
if voterId, err := strconv.ParseInt(f.Voter, 10, 64); err != nil {
f.Errors["Voter"] = fmt.Sprint("Please choose a valid voter", err)
f.Errors["Voter"] = fmt.Sprint("Please choose a valid voter.", err)
} else if voter, err = GetVoterById(voterId); err != nil {
f.Errors["Voter"] = fmt.Sprint("Please choose a valid voter", err)
f.Errors["Voter"] = fmt.Sprint("Please choose a valid voter.", err)
} else {
data.VoterId = voter.Id
}
if vote, err := strconv.ParseInt(f.Vote, 10, 8); err != nil {
f.Errors["Vote"] = fmt.Sprint("Please choose a valid vote", err)
f.Errors["Vote"] = fmt.Sprint("Please choose a valid vote.", err)
} else if voteChoice, ok := VoteChoices[vote]; !ok {
f.Errors["Vote"] = fmt.Sprint("Please choose a valid vote")
f.Errors["Vote"] = fmt.Sprint("Please choose a valid vote.")
} else {
data.Vote = voteChoice
}
justification := strings.TrimSpace(f.Justification)
if len(justification) < 3 {
f.Errors["Justification"] = "Please enter at least 3 characters."
f.Errors["Justification"] = "Please enter at least 3 characters for justification."
}
return len(f.Errors) == 0, voter, data, justification

View file

@ -24,46 +24,23 @@
"button",
"container",
"divider",
"flag",
"header",
"icon",
"image",
"input",
"label",
"list",
"loader",
"rail",
"reveal",
"segment",
"step",
"breadcrumb",
"form",
"grid",
"menu",
"message",
"table",
"ad",
"card",
"comment",
"feed",
"item",
"statistic",
"accordion",
"checkbox",
"dimmer",
"dropdown",
"embed",
"modal",
"nag",
"popup",
"progress",
"rating",
"search",
"shape",
"sidebar",
"sticky",
"tab",
"transition",
"api",
"form",
"state",

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,73 +1,73 @@
{{ template "header" . }}
<form action="/newmotion/" method="post">
<table>
<tr>
<td>ID:</td>
<td>(generated on submit)</td>
</tr>
<tr>
<td>Proponent:</td>
<td>{{ .Voter.Name }}</td>
</tr>
<tr>
<td>Proposed date/time:</td>
<td>(auto filled to current date/time)</td>
</tr>
<tr>
<td>Title:</td>
<td><input name="Title" value="{{ .Form.Title }}"/>
{{ with .Form.Errors.Title }}
<span class="error">{{ . }}</span>
<div class="column">
<div class="ui basic segment">
<div class="ui floated right secondary menu">
<a href="/motions/" class="item" title="Show all votes">Back to motions</a>
</div>
</div>
</div>
<div class="column">
<div class="ui raised segment">
<form action="/newmotion/" method="post">
<div class="ui form{{ if .Form.Errors }} error{{ end }}">
<div class="three fields">
<div class="field">
<label>ID:</label>
(generated on submit)
</div>
<div class="field">
<label>Proponent:</label>
{{ .Voter.Name }}
</div>
<div class="field">
<label>Proposed date/time:</label>
(auto filled to current date/time)
</div>
</div>
<div class="required field{{ if .Form.Errors.Title }} error{{ end }}">
<label for="Title">Title:</label>
<input name="Title" type="text" value="{{ .Form.Title }}">
</div>
<div class="required field{{ if .Form.Errors.Content }} error{{ end }}">
<label for="Content">Text:</label>
<textarea name="Content">{{ .Form.Content }}</textarea>
</div>
<div class="two fields">
<div class="required field{{ if .Form.Errors.VoteType }} error{{ end }}">
<label for="VoteType">Vote type:</label>
<select name="VoteType">
<option value="0"
{{ if eq "0" .Form.VoteType }}selected{{ end }}>
Motion
</option>
<option value="1"
{{ if eq "1" .Form.VoteType }}selected{{ end }}>
Veto
</option>
</select>
</div>
<div class="required field{{ if .Form.Errors.Due }} error{{ end }}">
<label for="Due">Due: (autofilled from chosen
option)</label>
<select name="Due">
<option value="+3 days">In 3 Days</option>
<option value="+7 days">In 1 Week</option>
<option value="+14 days">In 2 Weeks</option>
<option value="+28 days">In 4 Weeks</option>
</select>
</div>
</div>
{{ with .Form.Errors }}
<div class="ui error message">
{{ with .Title }}<p>{{ . }}</p>{{ end }}
{{ with .Content }}<p>{{ . }}</p>{{ end }}
{{ with .VoteType }}<p>{{ . }}</p>{{ end }}
{{ with .Due }}<p>{{ . }}</p>{{ end }}
</div>
{{ end }}
</td>
</tr>
<tr>
<td>Text:</td>
<td><textarea name="Content">{{ .Form.Content }}</textarea>
{{ with .Form.Errors.Content }}
<span class="error">{{ . }}</span>
{{ end }}
</td>
</tr>
<tr>
<td>Vote type:</td>
<td>
<select name="VoteType">
<option value="0"
{{ if eq "0" .Form.VoteType }}selected{{ end }}>
Motion
</option>
<option value="1"
{{ if eq "1" .Form.VoteType }}selected{{ end }}>Veto
</option>
</select>
{{ with .Form.Errors.VoteType }}
<span class="error">{{ . }}</span>
{{ end }}
</td>
</tr>
<tr>
<td rowspan="2">Due:</td>
<td>(autofilled from option below)</td>
</tr>
<tr>
<td>
<select name="Due">
<option value="+3 days">In 3 Days</option>
<option value="+7 days">In 1 Week</option>
<option value="+14 days">In 2 Weeks</option>
<option value="+28 days">In 4 Weeks</option>
</select>
{{ with .Form.Errors.Due }}
<span class="error">{{ . }}</span>
{{ end }}
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="Propose"/></td>
</tr>
</table>
</form>
<a href="/motions/">Back to motions</a>
<button class="ui button" type="submit">Propose</button>
</div>
</form>
</div>
</div>
{{ template "footer" . }}

View file

@ -1,13 +1,9 @@
<html>
<head>
<title>CAcert Board Decisions</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf8"/>
<link rel="stylesheet" type="text/css" href="/static/styles.css"/>
</head>
<body>
<h1>CAcert Board Decisions</h1>
<b>You are not authorized to act here!</b><br/>
<i>If you think this is in error, please contact the administrator</i>
<i>If you don't know who that is, it is definitely not an error ;)</i>
</body>
</html>
{{ template "header" . }}
<div class="column">
<div class="ui negative message">
<div class="header">You are not authorized to act here!</div>
<p>If you think this is in error, please contact the administrator.</p>
<p>If you don't know who that is, it is definitely not an error ;)</p>
</div>
</div>
{{ template "footer" . }}

View file

@ -1,22 +1,27 @@
{{ template "header" . }}
<a href="/motions/">Show all votes</a>
<table class="list">
<thead>
<tr>
<th>Status</th>
<th>Motion</th>
</tr>
</thead>
<tbody>
<tr>
{{ with .Decision }}
{{ template "motion_fragment" .}}
{{ end}}
</tr>
</tbody>
</table>
<div class="column">
<div class="ui basic segment">
<div class="ui floated right secondary menu">
<a href="/motions/" class="item" title="Show all votes">Back to motions</a>
</div>
</div>
</div>
{{ with .Decision }}
<div class="column">
<div class="ui raised segment">
{{ template "motion_fragment" . }}
</div>
</div>
{{ end }}
<form action="/vote/{{ .Decision.Tag }}/{{ .VoteChoice }}" method="post">
<input type="submit" value="Vote {{ .VoteChoice }}"/>
<div class="ui form">
{{ if eq 1 .VoteChoice }}
<button class="ui right labeled green icon button" type="submit"><i class="check circle icon"></i> Vote {{ .VoteChoice }}</button>
{{ else if eq -1 .VoteChoice }}
<button class="ui right labeled red icon button" type="submit"><i class="minus circle icon"></i> Vote {{ .VoteChoice }}</button>
{{ else }}
<button class="ui right labeled grey icon button" type="submit"><i class="circle icon"></i> Vote {{ .VoteChoice }}</button>
{{ end }}
</div>
</form>
{{ template "footer" . }}

View file

@ -1,73 +1,72 @@
{{ template "header" . }}
<form action="/motions/{{ .Form.Decision.Tag }}/edit" method="post">
<table>
<tr>
<td>ID:</td>
<td>{{ .Form.Decision.Tag }}</td>
</tr>
<tr>
<td>Proponent:</td>
<td>{{ .Voter.Name }}</td>
</tr>
<tr>
<td>Proposed date/time:</td>
<td>{{ .Form.Decision.Proposed }}</td>
</tr>
<tr>
<td>Title:</td>
<td><input name="Title" value="{{ .Form.Title }}"/>
{{ with .Form.Errors.Title }}
<span class="error">{{ . }}</span>
<div class="column">
<div class="ui floated right secondary menu">
<a href="/motions/" class="item" title="Show all votes">Back to
motions</a>
</div>
</div>
<div class="column">
<div class="ui raised segment">
<form action="/motions/{{ .Form.Decision.Tag }}/edit" method="post">
<div class="ui form{{ if .Form.Errors }} error{{ end }}">
<div class="three fields">
<div class="field">
<label>ID:</label>
<a href="/motions/{{ .Form.Decision.Tag }}">{{ .Form.Decision.Tag }}</a>
</div>
<div class="field">
<label>Proponent:</label>
{{ .Voter.Name }}
</div>
<div class="field">
<label>Proposed date/time:</label>
{{ .Form.Decision.Proposed|date "2006-01-02 15:04:05 UTC" }}
</div>
</div>
<div class="required field{{ if .Form.Errors.Title }} error{{ end }}">
<label for="Title">Title:</label>
<input name="Title" type="text" value="{{ .Form.Title }}">
</div>
<div class="required field{{ if .Form.Errors.Content }} error{{ end }}">
<label for="Content">Text:</label>
<textarea name="Content">{{ .Form.Content }}</textarea>
</div>
<div class="two fields">
<div class="required field{{ if .Form.Errors.VoteType }} error{{ end }}">
<label for="VoteType">Vote type:</label>
<select name="VoteType">
<option value="0"
{{ if eq "0" .Form.VoteType }}selected{{ end }}>
Motion
</option>
<option value="1"
{{ if eq "1" .Form.VoteType }}selected{{ end }}>
Veto
</option>
</select>
</div>
<div class="required field{{ if .Form.Errors.Due }} error{{ end }}">
<label for="Due">Due: (autofilled from chosen
option)</label>
<select name="Due">
<option value="+3 days">In 3 Days</option>
<option value="+7 days">In 1 Week</option>
<option value="+14 days">In 2 Weeks</option>
<option value="+28 days">In 4 Weeks</option>
</select>
</div>
</div>
{{ with .Form.Errors }}
<div class="ui error message">
{{ with .Title }}<p>{{ . }}</p>{{ end }}
{{ with .Content }}<p>{{ . }}</p>{{ end }}
{{ with .VoteType }}<p>{{ . }}</p>{{ end }}
{{ with .Due }}<p>{{ . }}</p>{{ end }}
</div>
{{ end }}
</td>
</tr>
<tr>
<td>Text:</td>
<td><textarea name="Content">{{ .Form.Content }}</textarea>
{{ with .Form.Errors.Content }}
<span class="error">{{ . }}</span>
{{ end }}
</td>
</tr>
<tr>
<td>Vote type:</td>
<td>
<select name="VoteType">
<option value="0"
{{ if eq "0" .Form.VoteType }}selected{{ end }}>
Motion
</option>
<option value="1"
{{ if eq "1" .Form.VoteType }}selected{{ end }}>Veto
</option>
</select>
{{ with .Form.Errors.VoteType }}
<span class="error">{{ . }}</span>
{{ end }}
</td>
</tr>
<tr>
<td rowspan="2">Due:</td>
<td>(autofilled from option below)</td>
</tr>
<tr>
<td>
<select name="Due">
<option value="+3 days">In 3 Days</option>
<option value="+7 days">In 1 Week</option>
<option value="+14 days">In 2 Weeks</option>
<option value="+28 days">In 4 Weeks</option>
</select>
{{ with .Form.Errors.Due }}
<span class="error">{{ . }}</span>
{{ end }}
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="Propose"/></td>
</tr>
</table>
</form>
<a href="/motions/">Back to motions</a>
<button class="ui button" type="submit">Propose</button>
</div>
</form>
</div>
</div>
{{ template "footer" . }}

View file

@ -2,7 +2,7 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
<title>{{ block "pagetitle" . }}CAcert Board Decisions{{ if .PageTitle }} - {{ .PageTitle }}{{ end }}{{ end }}</title>
<title>{{ block "pagetitle" . }}CAcert Board Decisions{{ end }}{{ if .PageTitle }} - {{ .PageTitle }}{{ end }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="/static/semantic.css"/>
<script type="text/javascript" src="/static/js/jquery.js"></script>
@ -12,14 +12,14 @@
<div class="ui container">
<h1 class="ui header">{{ template "pagetitle" . }}</h1>
{{ with .Flashes }}
<div class="ui info message">
<i class="close icon"></i>
<div class="ui list">
{{ range . }}
<div class="ui item">{{ . }}</div>
{{ end }}
<div class="ui info message">
<i class="close icon"></i>
<div class="ui list">
{{ range . }}
<div class="ui item">{{ . }}</div>
{{ end }}
</div>
</div>
</div>
{{ end }}
</div>
<div class="ui one column grid container">

View file

@ -1,21 +1,19 @@
{{ 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" .}}
<div class="column">
<div class="ui basic segment">
<div class="ui floated right secondary menu">
<a href="/motions/" class="item" title="Show all votes">All votes</a>
{{ if $voter }}<a href="/motions/?unvoted=1" class="item" title="Show my outstanding votes">My outstanding votes</a>{{ end }}
</div>
</div>
</div>
{{ with .Decision }}
<div class="column">
<div class="ui raised segment">
{{ template "motion_fragment" . }}
{{ if $voter }}{{ template "motion_actions" . }}{{ end }}
{{ end}}
</tr>
</tbody>
</table>
</div>
</div>
{{ end}}
{{ template "footer" . }}

View file

@ -1,92 +1,64 @@
{{ define "motion_fragment" }}
<div class="column">
<div class="ui raised segment">
<span class="ui {{ template "status_class" .Status }} ribbon label">{{ .Status|toString|title }}</span>
<span class="header">{{ .Modified|date "2006-01-02 15:04:05 UTC" }}</span>
<h2 class="header"><a href="/motions/{{ .Tag }}">{{ .Tag }}: {{ .Title }}</a></h2>
<pre>{{ wrap 76 .Content }}</pre>
<table class="ui small definition table">
<tbody>
<tr>
<td>Due</td>
<td>{{.Due|date "2006-01-02 15:04:05 UTC"}}</td>
</tr>
<tr>
<td>Proposed</td>
<td>{{.Proposer}} ({{.Proposed|date "2006-01-02 15:04:05 UTC"}})</td>
</tr>
<tr>
<td>Vote type:</td>
<td>{{ .VoteType|toString|title }}</td>
</tr>
<tr>
<td>Votes:</td>
<td>
<div class="ui labels">
<div class="ui basic label green"><i class="check circle icon"></i>Aye<div class="detail">{{.Ayes}}</div></div>
<div class="ui basic label red"><i class="minus circle icon"></i>Naye<div class="detail">{{.Nayes}}</div></div>
<div class="ui basic label grey"><i class="circle icon"></i>Abstain<div class="detail">{{.Abstains}}</div></div>
</div>
{{ if .Votes }}
<div class="list">
{{ range .Votes }}
<div class="item">{{ .Name }}: {{ .Vote.Vote }}</div>
{{ end }}
</div>
<a href="/motions/{{ .Tag }}">Hide Votes</a>
{{ else }}
<a href="/motions/{{ .Tag }}?showvotes=1">Show Votes</a>
{{ end }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!--
<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>
-->
<span class="ui {{ template "status_class" .Status }} ribbon label">{{ .Status|toString|title }}</span>
<span class="header">{{ .Modified|date "2006-01-02 15:04:05 UTC" }}</span>
<h3 class="header"><a href="/motions/{{ .Tag }}">{{ .Tag }}: {{ .Title }}</a></h3>
<pre>{{ wrap 76 .Content }}</pre>
<table class="ui small definition table">
<tbody>
<tr>
<td>Due</td>
<td>{{.Due|date "2006-01-02 15:04:05 UTC"}}</td>
</tr>
<tr>
<td>Proposed</td>
<td>{{.Proposer}} ({{.Proposed|date "2006-01-02 15:04:05 UTC"}})</td>
</tr>
<tr>
<td>Vote type:</td>
<td>{{ .VoteType|toString|title }}</td>
</tr>
<tr>
<td>Votes:</td>
<td>
<div class="ui labels">
<div class="ui basic label green"><i
class="check circle icon"></i>Aye
<div class="detail">{{.Ayes}}</div>
</div>
<div class="ui basic label red"><i
class="minus circle icon"></i>Naye
<div class="detail">{{.Nayes}}</div>
</div>
<div class="ui basic label grey"><i class="circle icon"></i>Abstain
<div class="detail">{{.Abstains}}</div>
</div>
</div>
{{ if .Votes }}
<div class="list">
{{ range .Votes }}
<div class="item">{{ .Name }}: {{ .Vote.Vote }}</div>
{{ end }}
</div>
<a href="/motions/{{ .Tag }}">Hide Votes</a>
{{ else if or ((ne 0 .Ayes) (ne 0 .Nayes) (ne 0 .Abstains)) }}
<a href="/motions/{{ .Tag }}?showvotes=1">Show Votes</a>
{{ end }}
</td>
</tr>
</tbody>
</table>
{{ end }}
{{ define "status_class" }}{{ if eq . 0 }}blue{{ else if eq . 1 }}green{{ else if eq . -1 }}red{{ else if eq . -2 }}grey{{ end }}{{ end }}
{{ define "status_class" }}{{ if eq . 0 }}blue{{ else if eq . 1 }}green{{ else if eq . -1 }}red{{ else if eq . -2 }}grey
{{ end }}{{ 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>
{{ if eq .Status 0 }}
<a class="ui compact right labeled green icon button" href="/vote/{{ .Tag }}/aye"><i class="check circle icon"></i> Aye</a>
<a class="ui compact right labeled red icon button" href="/vote/{{ .Tag }}/naye"><i class="minus circle icon"></i> Naye</a>
<a class="ui compact right labeled grey icon button" href="/vote/{{ .Tag }}/abstain"><i class="circle icon"></i> Abstain</a>
<a class="ui compact left labeled icon button" href="/proxy/{{ .Tag }}"><i class="users icon"></i> Proxy Vote</a>
<a class="ui compact left labeled icon button" href="/motions/{{ .Tag }}/edit"><i class="edit icon"></i> Modify</a>
<a class="ui compact left labeled icon button" href="/motions/{{ .Tag }}/withdraw"><i class="trash icon"></i> Withdraw</a>
{{ end }}
{{ end }}

View file

@ -1,52 +1,52 @@
{{ template "header" . }}
{{ $voter := .Voter }}
<div class="column">
<div class="ui floated right secondary menu">
<a href="/motions/" class="{{ if not .Params.Flags.Unvoted }}active {{ end }}item" title="Show all votes">All votes</a>
<a href="/motions/?unvoted=1" class="{{ if .Params.Flags.Unvoted }}active {{ end}}item" title="Show my outstanding votes">My outstanding votes</a>
<div class="ui basic segment">
<div class="ui floated right secondary menu">
<a href="/motions/" class="{{ if not .Params.Flags.Unvoted }}active {{ end }}item" title="Show all votes">All votes</a>
{{ if $voter }}<a href="/motions/?unvoted=1" class="{{ if .Params.Flags.Unvoted }}active {{ end}}item" title="Show my outstanding votes">My outstanding votes</a>{{ end }}
</div>
{{ if $voter }}<a class="ui primary button" href="/newmotion/">New motion</a>{{ end }}
{{ if .PrevPage -}}
<a href="?page={{ .PrevPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}"
class="ui left labeled icon button" title="newer motions"><i class="left arrow icon"></i> newer</a>
{{- end }}
{{ if .NextPage -}}
<a href="?page={{ .NextPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}"
class="ui right labeled icon button" title="older motions"><i class="right arrow icon"></i> older</a>
{{- end }}
</div>
</div>
{{ if .Decisions }}
{{ range .Decisions }}
{{ template "motion_fragment" . }}
{{ end }}
<table class="list">
<thead>
<tr>
<th>Status</th>
<th>Motion</th>
{{ if $voter }}
<th>Actions</th>
{{ end }}
</tr>
</thead>
<tbody>
{{range .Decisions }}
<tr>
<div class="column">
<div class="ui raised segment">
{{ template "motion_fragment" . }}
{{ if $voter }}{{ template "motion_actions" . }}{{ end }}
</tr>
{{end}}
<tr>
<td colspan="2" class="navigation">
{{ if .PrevPage }}<a href="?page={{ .PrevPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}" title="previous page">&lt;</a>{{ end }}
{{ if .NextPage }}<a href="?page={{ .NextPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}" 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>
</div>
</div>
{{ end }}
<div class="column">
<div class="ui basic segment">
{{ if $voter }}<a class="ui primary button" href="/newmotion/">New motion</a>{{ end }}
{{ if .PrevPage -}}
<a href="?page={{ .PrevPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}"
class="ui left labeled icon button" title="newer motions">
<i class="left arrow icon"></i> newer</a>
{{- end }}
{{ if .NextPage -}}
<a href="?page={{ .NextPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}"
class="ui right labeled icon button" title="older motions">
<i class="right arrow icon"></i> older</a>
{{- end }}
</div>
</div>
{{ else }}
<p>There are no motions in the system yet.</p>
{{ 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 }}
{{end}}
{{ template "footer" . }}

View file

@ -1,61 +1,54 @@
{{ template "header" . }}
{{ $form := .Form }}
<table class="list">
<thead>
<tr>
<th>Status</th>
<th>Motion</th>
</tr>
</thead>
<tbody>
<tr>
<div class="column">
<div class="ui basic segment">
<div class="ui floated right secondary menu">
<a href="/motions/" class="item" title="Show all votes">Back to
motions</a>
</div>
</div>
</div>
<div class="column">
<div class="ui raised segment">
{{ with .Decision }}
{{ template "motion_fragment" .}}
{{ template "motion_fragment" . }}
{{ end }}
</tr>
</tbody>
</table>
<form action="/proxy/{{ .Decision.Tag }}" method="post">
<table>
<tr>
<th>Voter</th>
<th>Vote</th>
</tr>
<tr>
<td>
<select name="Voter">
{{ range .Voters }}
<option value="{{ .Id }}"
{{ if eq (.Id | print) $form.Voter }}
selected{{ end }}>{{ .Name }}</option>
{{ end }}
</select>
</td>
<td>
<select name="Vote">
<option value="1"{{ if eq $form.Vote "1" }}
selected{{ end }}>Aye
</option>
<option value="0"{{ if eq $form.Vote "0" }}
selected{{ end }}>Abstain
</option>
<option value="-1"{{ if eq $form.Vote "-1" }}
selected{{ end }}>Naye
</option>
</select>
</td>
</tr>
<tr>
<th colspan="2">Justification:</th>
</tr>
<tr>
<td colspan="2"><textarea
name="Justification">{{ $form.Justification }}</textarea>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Proxy Vote"></td>
</tr>
</table>
</form>
<form action="/proxy/{{ .Decision.Tag }}" method="post">
<div class="ui form{{ if .Form.Errors }} error{{ end }}">
<div class="two fields">
<div class="required field{{ if .Form.Errors.Voter }} error{{ end }}">
<label for="Voter">Voter</label>
<select name="Voter">
{{ range .Voters }}
<option value="{{ .Id }}"
{{ if eq (.Id | print) $form.Voter }}
selected{{ end }}>{{ .Name }}</option>
{{ end }}
</select>
</div>
<div class="required field{{ if .Form.Errors.Vote }} error{{ end }}">
<label for="Vote">Vote</label>
<select name="Vote">
<option value="1"{{ if eq .Form.Vote "1" }} selected{{ end }}>Aye</option>
<option value="0"{{ if eq .Form.Vote "0" }} selected{{ end }}>Abstain</option>
<option value="-1"{{ if eq .Form.Vote "-1" }} selected{{ end }}>Naye</option>
</select>
</div>
</div>
<div class="required field{{ if .Form.Errors.Justification }} error{{ end }}">
<label for="Justification">Justification</label>
<textarea name="Justification" rows="2">{{ .Form.Justification }}</textarea>
</div>
{{ with .Form.Errors }}
<div class="ui error message">
{{ with .Voter }}<p>{{ . }}</p>{{ end }}
{{ with .Vote }}<p>{{ . }}</p>{{ end }}
{{ with .Justification }}<p>{{ . }}</p>{{ end }}
</div>
{{ end }}
<button class="ui primary left labeled icon button" type="submit"><i class="users icon"></i> Proxy Vote</button>
</div>
</form>
</div>
</div>
{{ template "footer" . }}

View file

@ -1,22 +1,21 @@
{{ template "header" . }}
<a href="/motions/">Show all votes</a>
<table class="list">
<thead>
<tr>
<th>Status</th>
<th>Motion</th>
</tr>
</thead>
<tbody>
<tr>
{{ with .Decision }}
{{ template "motion_fragment" .}}
{{ end}}
</tr>
</tbody>
</table>
<div class="column">
<div class="ui basic segment">
<div class="ui floated right secondary menu">
<a href="/motions/" class="item" title="Show all votes">Back to motions</a>
</div>
</div>
</div>
{{ with .Decision }}
<div class="column">
<div class="ui raised segment">
{{ template "motion_fragment" . }}
</div>
</div>
{{ end }}
<form action="/motions/{{ .Decision.Tag }}/withdraw" method="post">
<input type="submit" value="Withdraw" />
<div class="ui form">
<button class="ui primary left labeled icon button" type="submit"><i class="trash icon"></i> Withdraw</button>
</div>
</form>
{{ template "footer" . }}