diff --git a/boardvoting.go b/boardvoting.go index 7228849..e58bee1 100644 --- a/boardvoting.go +++ b/boardvoting.go @@ -219,7 +219,9 @@ func motionListHandler(w http.ResponseWriter, r *http.Request) { templateContext.PrevPage = params.Page - 1 } - renderTemplate(w, r, []string{"motions.html", "motion_fragments.html", "header.html", "footer.html"}, templateContext) + renderTemplate(w, r, []string{ + "motions.html", "motion_fragments.html", "page_fragments.html", "header.html", "footer.html", + }, templateContext) } func motionHandler(w http.ResponseWriter, r *http.Request) { @@ -252,7 +254,7 @@ func motionHandler(w http.ResponseWriter, r *http.Request) { } templateContext.Decision = decision templateContext.PageTitle = fmt.Sprintf("Motion %s: %s", decision.Tag, decision.Title) - renderTemplate(w, r, []string{"motion.html", "motion_fragments.html", "header.html", "footer.html"}, templateContext) + renderTemplate(w, r, []string{"motion.html", "motion_fragments.html", "page_fragments.html", "header.html", "footer.html"}, templateContext) } func singleDecisionHandler(w http.ResponseWriter, r *http.Request, tag string, handler func(http.ResponseWriter, *http.Request)) { @@ -326,7 +328,7 @@ func (a *withDrawMotionAction) Handle(w http.ResponseWriter, r *http.Request) { http.Error(w, http.StatusText(http.StatusPreconditionFailed), http.StatusPreconditionFailed) return } - templates := []string{"withdraw_motion_form.html", "header.html", "footer.html", "motion_fragments.html"} + templates := []string{"withdraw_motion_form.html", "header.html", "footer.html", "motion_fragments.html", "page_fragments.html"} var templateContext struct { PageTitle string Decision *DecisionForDisplay @@ -366,7 +368,7 @@ func (h *newMotionHandler) Handle(w http.ResponseWriter, r *http.Request) { http.Error(w, http.StatusText(http.StatusPreconditionFailed), http.StatusPreconditionFailed) } - templates := []string{"create_motion_form.html", "header.html", "footer.html"} + templates := []string{"create_motion_form.html", "page_fragments.html", "header.html", "footer.html"} var templateContext struct { Form NewDecisionForm PageTitle string @@ -428,7 +430,7 @@ func (a editMotionAction) Handle(w http.ResponseWriter, r *http.Request) { http.Error(w, http.StatusText(http.StatusPreconditionFailed), http.StatusPreconditionFailed) return } - templates := []string{"edit_motion_form.html", "header.html", "footer.html"} + templates := []string{"edit_motion_form.html", "page_fragments.html", "header.html", "footer.html"} var templateContext struct { Form EditDecisionForm PageTitle string @@ -560,7 +562,7 @@ func (h *directVoteHandler) Handle(w http.ResponseWriter, r *http.Request) { http.Redirect(w, r, "/motions/", http.StatusMovedPermanently) default: - templates := []string{"direct_vote_form.html", "header.html", "footer.html", "motion_fragments.html"} + templates := []string{"direct_vote_form.html", "header.html", "footer.html", "motion_fragments.html", "page_fragments.html"} var templateContext struct { Decision *DecisionForDisplay VoteChoice VoteChoice @@ -601,7 +603,7 @@ func (h *proxyVoteHandler) Handle(w http.ResponseWriter, r *http.Request) { http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return } - templates := []string{"proxy_vote_form.html", "header.html", "footer.html", "motion_fragments.html"} + templates := []string{"proxy_vote_form.html", "header.html", "footer.html", "motion_fragments.html", "page_fragments.html"} var templateContext struct { Form ProxyVoteForm Decision *DecisionForDisplay diff --git a/boardvoting/templates/create_motion_form.html b/boardvoting/templates/create_motion_form.html index ef72ec6..2d8db12 100644 --- a/boardvoting/templates/create_motion_form.html +++ b/boardvoting/templates/create_motion_form.html @@ -1,74 +1,66 @@ {{ template "header.html" . }} -
-
- -
-
-
-
-
+{{ template "return_header" . }} +
+ {{ csrfField }} -
-
-
- - (generated on submit) -
-
- - {{ .Voter.Name }} -
-
- - (auto filled to current date/time) -
+
+
+
+ + (generated on submit)
-
- - +
+ + {{ .Voter.Name }}
-
- - +
+ + (auto filled to current date/time)
-
-
- - -
-
- - -
+
+
+ + +
+
+ + +
+
+
+ +
- {{ with .Form.Errors }} +
+ + +
+
+ {{ with .Form.Errors }}
{{ with .Title }}

{{ . }}

{{ end }} {{ with .Content }}

{{ . }}

{{ end }} {{ with .VoteType }}

{{ . }}

{{ end }} {{ with .Due }}

{{ . }}

{{ end }}
- {{ end }} - -
- -
+ {{ end }} + +
+
{{ template "footer.html" . }} \ No newline at end of file diff --git a/boardvoting/templates/denied.html b/boardvoting/templates/denied.html index 53bb364..fc89505 100644 --- a/boardvoting/templates/denied.html +++ b/boardvoting/templates/denied.html @@ -1,17 +1,23 @@ {{ template "header.html" . }} -
-
-
You are not authorized to act here!
-

If you think this is in error, please contact the administrator.

-

If you don't know who that is, it is definitely not an error ;)

- {{ if .Emails }} -

The following addresses were present in your certificate:

-

    - {{ range .Emails }} -
  • {{ . }}
  • +
    +
    + +
    +
    You are not authorized to act here!
    +

    If you think this is in error, please contact the administrator.

    +

    If you don't know who that is, it is definitely not an error ;)

    + {{ if .Emails }} +

    The following addresses were present in your certificate:

    +

    + {{ range .Emails }} +
    + +
    {{ . }}
    +
    + {{ end }} +
    {{ end }} -
- {{ end }} +
{{ template "footer.html" . }} \ No newline at end of file diff --git a/boardvoting/templates/direct_vote_form.html b/boardvoting/templates/direct_vote_form.html index 66e21a9..fff77eb 100644 --- a/boardvoting/templates/direct_vote_form.html +++ b/boardvoting/templates/direct_vote_form.html @@ -1,31 +1,23 @@ {{ template "header.html" . }} -
-
- -
-
+{{ template "return_header" . }} {{ with .Decision }} -
- {{ template "motion_fragment" . }} + {{ template "motion_fragment" . }}
-
{{ end }}
-{{ csrfField }} + {{ csrfField }}
- {{ if eq 1 .VoteChoice }} - - {{ else if eq -1 .VoteChoice }} - - {{ else }} - - {{ end }} + {{ if eq 1 .VoteChoice }} + + {{ else if eq -1 .VoteChoice }} + + {{ else }} + + {{ end }}
{{ template "footer.html" . }} \ No newline at end of file diff --git a/boardvoting/templates/edit_motion_form.html b/boardvoting/templates/edit_motion_form.html index 845442d..1798b27 100644 --- a/boardvoting/templates/edit_motion_form.html +++ b/boardvoting/templates/edit_motion_form.html @@ -1,72 +1,66 @@ {{ template "header.html" . }} - -
-
-
-
-
- -
- - {{ .Voter.Name }} -
-
- - {{ .Form.Decision.Proposed|date "2006-01-02 15:04:05 UTC" }} -
+{{ template "return_header" . }} +
+ + {{ csrfField }} +
+
+ -
- - +
+ + {{ .Voter.Name }}
-
- - +
+ + {{ .Form.Decision.Proposed|date "2006-01-02 15:04:05 UTC" }}
-
-
- - -
-
- - -
+
+
+ + +
+
+ + +
+
+
+ +
- {{ with .Form.Errors }} +
+ + +
+
+ {{ with .Form.Errors }}
{{ with .Title }}

{{ . }}

{{ end }} {{ with .Content }}

{{ . }}

{{ end }} {{ with .VoteType }}

{{ . }}

{{ end }} {{ with .Due }}

{{ . }}

{{ end }}
- {{ end }} - -
- -
+ {{ end }} + +
+
{{ template "footer.html" . }} \ No newline at end of file diff --git a/boardvoting/templates/footer.html b/boardvoting/templates/footer.html index fa873e5..da6699c 100644 --- a/boardvoting/templates/footer.html +++ b/boardvoting/templates/footer.html @@ -1,12 +1,12 @@ {{ define "footer.html" }} -
- +
+ {{ end }} \ No newline at end of file diff --git a/boardvoting/templates/header.html b/boardvoting/templates/header.html index d4f9621..acf8d18 100644 --- a/boardvoting/templates/header.html +++ b/boardvoting/templates/header.html @@ -7,20 +7,35 @@ + - + +
+
+
+ CAcert +
+
+

+ {{ template "pagetitle" . }} + {{ if .Voter }} +
Authenticated as {{ .Voter.Name }} <{{ .Voter.Reminder }}> +
{{ end }} +

+
+
+
-

{{ template "pagetitle" . }}{{ if .Voter }}
Authenticated as {{ .Voter.Name }} <{{ .Voter.Reminder }}>
{{ end }}

{{ with .Flashes }} -
- -
- {{ range . }} -
{{ . }}
- {{ end }} +
+
+ +
+ {{ range . }} +
{{ . }}
+ {{ end }} +
{{ end }} -
-
{{ end }} diff --git a/boardvoting/templates/motion.html b/boardvoting/templates/motion.html index e78a955..a4c3a30 100644 --- a/boardvoting/templates/motion.html +++ b/boardvoting/templates/motion.html @@ -1,19 +1,20 @@ {{ template "header.html" . }} {{ $voter := .Voter }} -
-
- +
+
{{ with .Decision }} -
{{ template "motion_fragment" . }} {{ if $voter }}{{ template "motion_actions" . }}{{ end }}
-
{{ end}} {{ template "footer.html" . }} \ No newline at end of file diff --git a/boardvoting/templates/motion_fragments.html b/boardvoting/templates/motion_fragments.html index 96a1938..876e586 100644 --- a/boardvoting/templates/motion_fragments.html +++ b/boardvoting/templates/motion_fragments.html @@ -1,64 +1,68 @@ {{ define "motion_fragment" }} -{{ .Status|toString|title }} -{{ .Modified|date "2006-01-02 15:04:05 UTC" }} -

{{ .Tag }}: {{ .Title }}

-

{{ wrap 76 .Content | nl2br }}

- - - - - - - - - - - - - - - - - + + +
Due{{.Due|date "2006-01-02 15:04:05 UTC"}}
Proposed{{.Proposer}} ({{.Proposed|date "2006-01-02 15:04:05 UTC"}})
Vote type:{{ .VoteType|toString|title }}
Votes: -
-
Aye -
{{.Ayes}}
+ {{ .Status|toString|title }} + {{ .Modified|date "2006-01-02 15:04:05 UTC" }} +

{{ .Tag }}: {{ .Title }}

+

{{ wrap 76 .Content | nl2br }}

+ + + + + + + + + + + + + + + + + - - -
Due{{.Due|date "2006-01-02 15:04:05 UTC"}}
Proposed{{.Proposer}} ({{.Proposed|date "2006-01-02 15:04:05 UTC"}})
Vote type:{{ .VoteType|toString|title }}
Votes: +
+
Aye +
{{.Ayes}}
+
+
Naye +
{{.Nayes}}
+
+
Abstain +
{{.Abstains}}
+
-
Naye -
{{.Nayes}}
-
-
Abstain -
{{.Abstains}}
-
- - {{ if .Votes }} -
- {{ range .Votes }} -
{{ .Name }}: {{ .Vote.Vote }}
+ {{ if .Votes }} +
+ {{ range .Votes }} +
{{ .Name }}: {{ .Vote.Vote }}
+ {{ end }} +
+ Hide Votes + {{ else if or ((ne 0 .Ayes) (ne 0 .Nayes) (ne 0 .Abstains)) }} + Show Votes {{ end }} -
- Hide Votes - {{ else if or ((ne 0 .Ayes) (ne 0 .Nayes) (ne 0 .Abstains)) }} - Show Votes - {{ 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" }} -{{ if eq .Status 0 }} - Aye - Naye - Abstain - Proxy Vote - Modify - Withdraw -{{ end }} + {{ if eq .Status 0 }} + Aye + Naye + + Abstain + Proxy + Vote + Modify + + Withdraw + {{ end }} {{ end }} diff --git a/boardvoting/templates/motions.html b/boardvoting/templates/motions.html index 625dc57..159cda5 100644 --- a/boardvoting/templates/motions.html +++ b/boardvoting/templates/motions.html @@ -1,52 +1,45 @@ {{ template "header.html" . }} {{ $voter := .Voter }} -
-
- - {{ if $voter }}New motion{{ end }} - {{ if .PrevPage -}} - newer - {{- end }} - {{ if .NextPage -}} - older - {{- end }} +{{ $page := . }} +
+
{{ if .Decisions }} + {{ range .Decisions }} -
- {{ template "motion_fragment" . }} - {{ if $voter }}{{ template "motion_actions" . }}{{ end }} + {{ template "motion_fragment" . }} + {{ if $voter }}{{ template "motion_actions" . }}{{ end }}
-
{{ end }} -
-
-{{ if $voter }}New motion{{ end }} -{{ if .PrevPage -}} - - newer -{{- end }} -{{ if .NextPage -}} - - older -{{- end }} + -
{{ else }} - {{ if .Params.Flags.Unvoted }} -

There are no motions requiring a vote from you.

- {{ else }} -

There are no motions in the system yet.

- {{ end }} +
+
+ +
+
No motions available
+ {{ if .Params.Flags.Unvoted }} +

There are no motions requiring a vote from you.

+ {{ else }} +

There are no motions in the system yet.

+ {{ end }} +
+
+
{{ end }} {{ template "footer.html" . }} \ No newline at end of file diff --git a/boardvoting/templates/page_fragments.html b/boardvoting/templates/page_fragments.html new file mode 100644 index 0000000..6a6dedf --- /dev/null +++ b/boardvoting/templates/page_fragments.html @@ -0,0 +1,20 @@ +{{ define "pagination_fragment" }} + {{ if .PrevPage -}} + + newer + + {{- end }} + {{ if .NextPage -}} + + older + + {{- end }} +{{ end }} + +{{ define "return_header" }} +
+ +
+{{ end }} \ No newline at end of file diff --git a/boardvoting/templates/proxy_vote_form.html b/boardvoting/templates/proxy_vote_form.html index 97ae86b..a6ab5ee 100644 --- a/boardvoting/templates/proxy_vote_form.html +++ b/boardvoting/templates/proxy_vote_form.html @@ -1,56 +1,47 @@ {{ template "header.html" . }} +{{ template "return_header" . }} {{ $form := .Form }} -
- -
-
-
+
{{ with .Decision }} {{ template "motion_fragment" . }} - {{ end }} -
+ {{ end }} + {{ csrfField }} -
-
-
- - {{ range .Voters }} + {{ if eq (.Id | print) $form.Voter }} + selected{{ end }}>{{ .Name }} {{ end }} - -
-
- - -
+
-
- - +
+ +
+
+
+ + +
{{ with .Form.Errors }}
- {{ with .Voter }}

{{ . }}

{{ end }} - {{ with .Vote }}

{{ . }}

{{ end }} - {{ with .Justification }}

{{ . }}

{{ end }} + {{ with .Voter }}

{{ . }}

{{ end }} + {{ with .Vote }}

{{ . }}

{{ end }} + {{ with .Justification }}

{{ . }}

{{ end }}
{{ end }} - -
-
-
+ +
+
{{ template "footer.html" . }} \ No newline at end of file diff --git a/boardvoting/templates/withdraw_motion_form.html b/boardvoting/templates/withdraw_motion_form.html index 7b444e7..b549cea 100644 --- a/boardvoting/templates/withdraw_motion_form.html +++ b/boardvoting/templates/withdraw_motion_form.html @@ -1,22 +1,17 @@ {{ template "header.html" . }} -
-
- -
-
+{{ template "return_header" . }} {{ with .Decision }} -
- {{ template "motion_fragment" . }} + {{ template "motion_fragment" . }}
-
{{ end }} -
-{{ csrfField }} -
- -
-
-{{ template "footer.html" . }} +
+
+ {{ csrfField }} +
+ +
+
+
+{{ template "footer.html" . }} \ No newline at end of file