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) needsAuth, ok := r.Context().Value(ctxNeedsAuth).(bool)
if ok && needsAuth { if ok && needsAuth {
w.WriteHeader(http.StatusForbidden) w.WriteHeader(http.StatusForbidden)
renderTemplate(w, []string{"denied.html"}, nil) renderTemplate(w, []string{"denied.html", "header.html", "footer.html"}, nil)
return return
} }
handler(w, r) handler(w, r)

View file

@ -29,22 +29,22 @@ func (f *NewDecisionForm) Validate() (bool, *Decision) {
data.Title = strings.TrimSpace(f.Title) data.Title = strings.TrimSpace(f.Title)
if len(data.Title) < 3 { 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) data.Content = strings.TrimSpace(f.Content)
if len(strings.Fields(data.Content)) < 3 { 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) { 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 { } else {
data.VoteType = VoteType(uint8(voteType)) data.VoteType = VoteType(uint8(voteType))
} }
if dueDuration, ok := validDueDurations[f.Due]; !ok { 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 { } else {
year, month, day := time.Now().UTC().Add(dueDuration).Date() year, month, day := time.Now().UTC().Add(dueDuration).Date()
data.Due = time.Date(year, month, day, 23, 59, 59, 0, time.UTC) 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) data.Title = strings.TrimSpace(f.Title)
if len(data.Title) < 3 { 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) data.Content = strings.TrimSpace(f.Content)
if len(strings.Fields(data.Content)) < 3 { 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) { 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 { } else {
data.VoteType = VoteType(uint8(voteType)) data.VoteType = VoteType(uint8(voteType))
} }
if dueDuration, ok := validDueDurations[f.Due]; !ok { 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 { } else {
year, month, day := time.Now().UTC().Add(dueDuration).Date() year, month, day := time.Now().UTC().Add(dueDuration).Date()
data.Due = time.Date(year, month, day, 23, 59, 59, 0, time.UTC) 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 var voter *Voter
if voterId, err := strconv.ParseInt(f.Voter, 10, 64); err != nil { 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 { } 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 { } else {
data.VoterId = voter.Id data.VoterId = voter.Id
} }
if vote, err := strconv.ParseInt(f.Vote, 10, 8); err != nil { 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 { } 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 { } else {
data.Vote = voteChoice data.Vote = voteChoice
} }
justification := strings.TrimSpace(f.Justification) justification := strings.TrimSpace(f.Justification)
if len(justification) < 3 { 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 return len(f.Errors) == 0, voter, data, justification

View file

@ -24,46 +24,23 @@
"button", "button",
"container", "container",
"divider", "divider",
"flag",
"header", "header",
"icon", "icon",
"image",
"input", "input",
"label", "label",
"list", "list",
"loader",
"rail",
"reveal",
"segment", "segment",
"step",
"breadcrumb",
"form", "form",
"grid", "grid",
"menu", "menu",
"message", "message",
"table", "table",
"ad",
"card",
"comment",
"feed",
"item", "item",
"statistic",
"accordion",
"checkbox", "checkbox",
"dimmer",
"dropdown", "dropdown",
"embed", "embed",
"modal",
"nag",
"popup",
"progress",
"rating",
"search",
"shape", "shape",
"sidebar",
"sticky", "sticky",
"tab",
"transition",
"api", "api",
"form", "form",
"state", "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" . }} {{ template "header" . }}
<form action="/newmotion/" method="post"> <div class="column">
<table> <div class="ui basic segment">
<tr> <div class="ui floated right secondary menu">
<td>ID:</td> <a href="/motions/" class="item" title="Show all votes">Back to motions</a>
<td>(generated on submit)</td> </div>
</tr> </div>
<tr> </div>
<td>Proponent:</td> <div class="column">
<td>{{ .Voter.Name }}</td> <div class="ui raised segment">
</tr> <form action="/newmotion/" method="post">
<tr> <div class="ui form{{ if .Form.Errors }} error{{ end }}">
<td>Proposed date/time:</td> <div class="three fields">
<td>(auto filled to current date/time)</td> <div class="field">
</tr> <label>ID:</label>
<tr> (generated on submit)
<td>Title:</td> </div>
<td><input name="Title" value="{{ .Form.Title }}"/> <div class="field">
{{ with .Form.Errors.Title }} <label>Proponent:</label>
<span class="error">{{ . }}</span> {{ .Voter.Name }}
{{ end }} </div>
</td> <div class="field">
</tr> <label>Proposed date/time:</label>
<tr> (auto filled to current date/time)
<td>Text:</td> </div>
<td><textarea name="Content">{{ .Form.Content }}</textarea> </div>
{{ with .Form.Errors.Content }} <div class="required field{{ if .Form.Errors.Title }} error{{ end }}">
<span class="error">{{ . }}</span> <label for="Title">Title:</label>
{{ end }} <input name="Title" type="text" value="{{ .Form.Title }}">
</td> </div>
</tr> <div class="required field{{ if .Form.Errors.Content }} error{{ end }}">
<tr> <label for="Content">Text:</label>
<td>Vote type:</td> <textarea name="Content">{{ .Form.Content }}</textarea>
<td> </div>
<div class="two fields">
<div class="required field{{ if .Form.Errors.VoteType }} error{{ end }}">
<label for="VoteType">Vote type:</label>
<select name="VoteType"> <select name="VoteType">
<option value="0" <option value="0"
{{ if eq "0" .Form.VoteType }}selected{{ end }}> {{ if eq "0" .Form.VoteType }}selected{{ end }}>
Motion Motion
</option> </option>
<option value="1" <option value="1"
{{ if eq "1" .Form.VoteType }}selected{{ end }}>Veto {{ if eq "1" .Form.VoteType }}selected{{ end }}>
Veto
</option> </option>
</select> </select>
{{ with .Form.Errors.VoteType }} </div>
<span class="error">{{ . }}</span> <div class="required field{{ if .Form.Errors.Due }} error{{ end }}">
{{ end }} <label for="Due">Due: (autofilled from chosen
</td> option)</label>
</tr>
<tr>
<td rowspan="2">Due:</td>
<td>(autofilled from option below)</td>
</tr>
<tr>
<td>
<select name="Due"> <select name="Due">
<option value="+3 days">In 3 Days</option> <option value="+3 days">In 3 Days</option>
<option value="+7 days">In 1 Week</option> <option value="+7 days">In 1 Week</option>
<option value="+14 days">In 2 Weeks</option> <option value="+14 days">In 2 Weeks</option>
<option value="+28 days">In 4 Weeks</option> <option value="+28 days">In 4 Weeks</option>
</select> </select>
{{ with .Form.Errors.Due }} </div>
<span class="error">{{ . }}</span> </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 }} {{ end }}
</td> <button class="ui button" type="submit">Propose</button>
</tr> </div>
<tr> </form>
<td>&nbsp;</td> </div>
<td><input type="submit" value="Propose"/></td> </div>
</tr>
</table>
</form>
<a href="/motions/">Back to motions</a>
{{ template "footer" . }} {{ template "footer" . }}

View file

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

View file

@ -1,22 +1,27 @@
{{ template "header" . }} {{ template "header" . }}
<a href="/motions/">Show all votes</a> <div class="column">
<table class="list"> <div class="ui basic segment">
<thead> <div class="ui floated right secondary menu">
<tr> <a href="/motions/" class="item" title="Show all votes">Back to motions</a>
<th>Status</th> </div>
<th>Motion</th> </div>
</tr> </div>
</thead> {{ with .Decision }}
<tbody> <div class="column">
<tr> <div class="ui raised segment">
{{ with .Decision }} {{ template "motion_fragment" . }}
{{ template "motion_fragment" .}} </div>
{{ end}} </div>
</tr> {{ end }}
</tbody>
</table>
<form action="/vote/{{ .Decision.Tag }}/{{ .VoteChoice }}" method="post"> <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> </form>
{{ template "footer" . }} {{ template "footer" . }}

View file

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

View file

@ -2,7 +2,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html"> <html xmlns="http://www.w3.org/1999/html">
<head> <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"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="/static/semantic.css"/> <link rel="stylesheet" type="text/css" href="/static/semantic.css"/>
<script type="text/javascript" src="/static/js/jquery.js"></script> <script type="text/javascript" src="/static/js/jquery.js"></script>

View file

@ -1,21 +1,19 @@
{{ template "header" . }} {{ template "header" . }}
<a href="/motions/">Show all votes</a>
{{ $voter := .Voter }} {{ $voter := .Voter }}
<table class="list"> <div class="column">
<thead> <div class="ui basic segment">
<th>Status</th> <div class="ui floated right secondary menu">
<th>Motion</th> <a href="/motions/" class="item" title="Show all votes">All votes</a>
{{ if $voter}} {{ if $voter }}<a href="/motions/?unvoted=1" class="item" title="Show my outstanding votes">My outstanding votes</a>{{ end }}
<th>Actions</th> </div>
{{ end }} </div>
</thead> </div>
<tbody> {{ with .Decision }}
<tr> <div class="column">
{{ with .Decision }} <div class="ui raised segment">
{{ template "motion_fragment" .}} {{ template "motion_fragment" . }}
{{ if $voter }}{{ template "motion_actions" . }}{{ end }} {{ if $voter }}{{ template "motion_actions" . }}{{ end }}
{{ end}} </div>
</tr> </div>
</tbody> {{ end}}
</table>
{{ template "footer" . }} {{ template "footer" . }}

View file

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

View file

@ -1,52 +1,52 @@
{{ template "header" . }} {{ template "header" . }}
{{ $voter := .Voter }} {{ $voter := .Voter }}
<div class="column"> <div class="column">
<div class="ui basic segment">
<div class="ui floated right secondary menu"> <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/" 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> {{ 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>
</div> </div>
{{ if .Decisions }} {{ if .Decisions }}
{{ range .Decisions }} {{ range .Decisions }}
{{ template "motion_fragment" . }} <div class="column">
{{ end }} <div class="ui raised segment">
<table class="list">
<thead>
<tr>
<th>Status</th>
<th>Motion</th>
{{ if $voter }}
<th>Actions</th>
{{ end }}
</tr>
</thead>
<tbody>
{{range .Decisions }}
<tr>
{{ template "motion_fragment" . }} {{ template "motion_fragment" . }}
{{ if $voter }}{{ template "motion_actions" . }}{{ end }} {{ if $voter }}{{ template "motion_actions" . }}{{ end }}
</tr> </div>
{{end}} </div>
<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 }} {{ end }}
</tr> <div class="column">
</tbody> <div class="ui basic segment">
</table> {{ if $voter }}<a class="ui primary button" href="/newmotion/">New motion</a>{{ end }}
{{else}} {{ if .PrevPage -}}
{{ if .Params.Flags.Unvoted }} <a href="?page={{ .PrevPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}"
<p>There are no motions requiring a vote from you.</p> 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 }} {{ 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 }}
{{end}}
{{ template "footer" . }} {{ template "footer" . }}

View file

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

View file

@ -1,22 +1,21 @@
{{ template "header" . }} {{ template "header" . }}
<a href="/motions/">Show all votes</a> <div class="column">
<table class="list"> <div class="ui basic segment">
<thead> <div class="ui floated right secondary menu">
<tr> <a href="/motions/" class="item" title="Show all votes">Back to motions</a>
<th>Status</th> </div>
<th>Motion</th> </div>
</tr> </div>
</thead> {{ with .Decision }}
<tbody> <div class="column">
<tr> <div class="ui raised segment">
{{ with .Decision }} {{ template "motion_fragment" . }}
{{ template "motion_fragment" .}} </div>
{{ end}} </div>
</tr> {{ end }}
</tbody>
</table>
<form action="/motions/{{ .Decision.Tag }}/withdraw" method="post"> <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> </form>
{{ template "footer" . }} {{ template "footer" . }}