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 }}
</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 }} {{ end }}
</td> <button class="ui button" type="submit">Propose</button>
</tr> </div>
<tr> </form>
<td>Text:</td> </div>
<td><textarea name="Content">{{ .Form.Content }}</textarea> </div>
{{ 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>
{{ 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>
<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 }} {{ end }}
</td> <button class="ui button" type="submit">Propose</button>
</tr> </div>
<tr> </form>
<td>Text:</td> </div>
<td><textarea name="Content">{{ .Form.Content }}</textarea> </div>
{{ 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>
{{ 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>
@ -12,14 +12,14 @@
<div class="ui container"> <div class="ui container">
<h1 class="ui header">{{ template "pagetitle" . }}</h1> <h1 class="ui header">{{ template "pagetitle" . }}</h1>
{{ with .Flashes }} {{ with .Flashes }}
<div class="ui info message"> <div class="ui info message">
<i class="close icon"></i> <i class="close icon"></i>
<div class="ui list"> <div class="ui list">
{{ range . }} {{ range . }}
<div class="ui item">{{ . }}</div> <div class="ui item">{{ . }}</div>
{{ end }} {{ end }}
</div>
</div> </div>
</div>
{{ end }} {{ end }}
</div> </div>
<div class="ui one column grid container"> <div class="ui one column grid container">

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,92 +1,64 @@
{{ 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> <tbody>
<table class="ui small definition table"> <tr>
<tbody> <td>Due</td>
<tr> <td>{{.Due|date "2006-01-02 15:04:05 UTC"}}</td>
<td>Due</td> </tr>
<td>{{.Due|date "2006-01-02 15:04:05 UTC"}}</td> <tr>
</tr> <td>Proposed</td>
<tr> <td>{{.Proposer}} ({{.Proposed|date "2006-01-02 15:04:05 UTC"}})</td>
<td>Proposed</td> </tr>
<td>{{.Proposer}} ({{.Proposed|date "2006-01-02 15:04:05 UTC"}})</td> <tr>
</tr> <td>Vote type:</td>
<tr> <td>{{ .VoteType|toString|title }}</td>
<td>Vote type:</td> </tr>
<td>{{ .VoteType|toString|title }}</td> <tr>
</tr> <td>Votes:</td>
<tr> <td>
<td>Votes:</td> <div class="ui labels">
<td> <div class="ui basic label green"><i
<div class="ui labels"> class="check circle icon"></i>Aye
<div class="ui basic label green"><i class="check circle icon"></i>Aye<div class="detail">{{.Ayes}}</div></div> <div class="detail">{{.Ayes}}</div>
<div class="ui basic label red"><i class="minus circle icon"></i>Naye<div class="detail">{{.Nayes}}</div></div> </div>
<div class="ui basic label grey"><i class="circle icon"></i>Abstain<div class="detail">{{.Abstains}}</div></div> <div class="ui basic label red"><i
</div> class="minus circle icon"></i>Naye
{{ if .Votes }} <div class="detail">{{.Nayes}}</div>
<div class="list"> </div>
{{ range .Votes }} <div class="ui basic label grey"><i class="circle icon"></i>Abstain
<div class="item">{{ .Name }}: {{ .Vote.Vote }}</div> <div class="detail">{{.Abstains}}</div>
{{ end }} </div>
</div> </div>
<a href="/motions/{{ .Tag }}">Hide Votes</a> {{ if .Votes }}
{{ else }} <div class="list">
<a href="/motions/{{ .Tag }}?showvotes=1">Show Votes</a> {{ range .Votes }}
{{ end }} <div class="item">{{ .Name }}: {{ .Vote.Vote }}</div>
</td> {{ end }}
</tr> </div>
</tbody> <a href="/motions/{{ .Tag }}">Hide Votes</a>
</table> {{ else if or ((ne 0 .Ayes) (ne 0 .Nayes) (ne 0 .Abstains)) }}
</div> <a href="/motions/{{ .Tag }}?showvotes=1">Show Votes</a>
</div> {{ end }}
<!-- </td>
<td class="{{.Status}}"> </tr>
{{ if eq .Status 0 }}Pending {{ .Due}} </tbody>
{{ else if eq .Status 1}}Approved {{ .Modified}} </table>
{{ 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 floated right secondary menu"> <div class="ui basic segment">
<a href="/motions/" class="{{ if not .Params.Flags.Unvoted }}active {{ end }}item" title="Show all votes">All votes</a> <div class="ui floated right secondary menu">
<a href="/motions/?unvoted=1" class="{{ if .Params.Flags.Unvoted }}active {{ end}}item" title="Show my outstanding votes">My outstanding votes</a>
<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>
</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> {{ end }}
<td colspan="2" class="navigation"> <div class="column">
{{ if .PrevPage }}<a href="?page={{ .PrevPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}" title="previous page">&lt;</a>{{ end }} <div class="ui basic segment">
{{ if .NextPage }}<a href="?page={{ .NextPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}" title="next page">&gt;</a>{{ end }} {{ if $voter }}<a class="ui primary button" href="/newmotion/">New motion</a>{{ end }}
</td> {{ if .PrevPage -}}
{{ if $voter }} <a href="?page={{ .PrevPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}"
<td class="actions"> class="ui left labeled icon button" title="newer motions">
<ul> <i class="left arrow icon"></i> newer</a>
<li><a href="/newmotion/">New Motion</a></li> {{- end }}
</ul> {{ if .NextPage -}}
</td> <a href="?page={{ .NextPage }}{{ if .Params.Flags.Unvoted }}&unvoted=1{{ end }}"
{{ end }} class="ui right labeled icon button" title="older motions">
</tr> <i class="right arrow icon"></i> older</a>
</tbody> {{- end }}
</table> </div>
{{else}} </div>
{{ if .Params.Flags.Unvoted }}
<p>There are no motions requiring a vote from you.</p>
{{ 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,61 +1,54 @@
{{ 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> <select name="Voter">
<th>Voter</th> {{ range .Voters }}
<th>Vote</th> <option value="{{ .Id }}"
</tr> {{ if eq (.Id | print) $form.Voter }}
<tr> selected{{ end }}>{{ .Name }}</option>
<td> {{ end }}
<select name="Voter"> </select>
{{ range .Voters }} </div>
<option value="{{ .Id }}" <div class="required field{{ if .Form.Errors.Vote }} error{{ end }}">
{{ if eq (.Id | print) $form.Voter }} <label for="Vote">Vote</label>
selected{{ end }}>{{ .Name }}</option> <select name="Vote">
{{ end }} <option value="1"{{ if eq .Form.Vote "1" }} selected{{ end }}>Aye</option>
</select> <option value="0"{{ if eq .Form.Vote "0" }} selected{{ end }}>Abstain</option>
</td> <option value="-1"{{ if eq .Form.Vote "-1" }} selected{{ end }}>Naye</option>
<td> </select>
<select name="Vote"> </div>
<option value="1"{{ if eq $form.Vote "1" }} </div>
selected{{ end }}>Aye <div class="required field{{ if .Form.Errors.Justification }} error{{ end }}">
</option> <label for="Justification">Justification</label>
<option value="0"{{ if eq $form.Vote "0" }} <textarea name="Justification" rows="2">{{ .Form.Justification }}</textarea>
selected{{ end }}>Abstain </div>
</option> {{ with .Form.Errors }}
<option value="-1"{{ if eq $form.Vote "-1" }} <div class="ui error message">
selected{{ end }}>Naye {{ with .Voter }}<p>{{ . }}</p>{{ end }}
</option> {{ with .Vote }}<p>{{ . }}</p>{{ end }}
</select> {{ with .Justification }}<p>{{ . }}</p>{{ end }}
</td> </div>
</tr> {{ end }}
<tr> <button class="ui primary left labeled icon button" type="submit"><i class="users icon"></i> Proxy Vote</button>
<th colspan="2">Justification:</th> </div>
</tr> </form>
<tr> </div>
<td colspan="2"><textarea </div>
name="Justification">{{ $form.Justification }}</textarea>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Proxy Vote"></td>
</tr>
</table>
</form>
{{ 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" . }}