-
Notifications
You must be signed in to change notification settings - Fork 61
/
view-campaign.html
156 lines (143 loc) · 5.58 KB
/
view-campaign.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!--
Copyright 2021 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
{% extends "base.html" %}
{% block title %}{{ campaign.name }}{% endblock %}
{% block content %}
<div class="mdc-layout-grid">
<div class="mdc-layout-grid__inner">
<!-- Campaign overview (top left quadrant) -->
<div class="emblem-campaign-overview mdc-layout-grid__cell mdc-layout-grid__cell--span-6">
<div class="emblem-campaign-image" style="max-width: 250px; height: 150px; border-radius: 5px; background-image: url({{ campaign.image_url }}); background-size: cover;"></div>
<h2>{{ campaign.name }}</h2>
<p>{{ campaign.description }}</p>
<p>This campaign is {{ "%.1f"|format(campaign.percentComplete) }}% complete.</p>
</div>
<!-- Campaign info (top right quadrant) -->
<div class="emblem-campaign-details mdc-layout-grid__cell mdc-layout-grid__cell--span-6">
<ul class="mdc-list">
<li class="mdc-list-item">
<span class="mdc-list-item__text">Status</span>
<span class="mdc-list-item__meta">{{ 'Active' if campaign.active else 'Closed' }}</span>
</li>
<li role="separator" class="mdc-list-divider"></li>
<li class="mdc-list-item">
<span class="mdc-list-item__text">Raised</span>
<span class="mdc-list-item__meta">
${{ "%.2f"|format(campaign.raised) }} (of ${{ "%.2f"|format(campaign.goal) }} goal)
</span>
</li>
<li role="separator" class="mdc-list-divider"></li>
<li class="mdc-list-item">
<span class="mdc-list-item__text">Created</span>
<span class="mdc-list-item__meta">{{ campaign.formattedDateCreated }}</span>
</li>
{% if campaign.timeCreated != campaign.updated %}
<li role="separator" class="mdc-list-divider"></li>
<li class="mdc-list-item">
<span class="mdc-list-item__text">Last Updated</span>
<span class="mdc-list-item__meta">{{ campaign.formattedDateUpdated }}</span>
</li>
{% endif %}
<li role="separator" class="mdc-list-divider"></li>
<li class="mdc-list-item">
<span class="mdc-list-item__text">Owners</span>
<span class="mdc-list-item__meta">
{% for manager in campaign.managers %}
{{ manager }}</br>
{% endfor %}
</span>
</li>
</ul>
<!-- Donate button -->
{% if campaign.active %}
<a href="/donate?campaign_id={{ campaign.id }}" class="mdc-button mdc-button--raised">
<span class="mdc-button__ripple"></span>
<span class="mdc-button__label">Donate</span>
</a>
{% endif %}
</div>
</div>
<!-- Donation history (bottom half of page) -->
<div class="emblem-donation-history mdc-layout-grid__cell mdc-layout-grid__cell--span-12">
<h3>Donation History</h3>
<div class="mdc-data-table">
<table class="mdc-data-table__table" aria-label="Donation history">
<thead>
<tr class="mdc-data-table__header-row">
<th
class="mdc-data-table__header-cell"
role="columnheader"
scope="col"
data-column-id="name"
>
<div class="mdc-data-table__header-cell-wrapper">
<div class="mdc-data-table__header-cell-label">
Name
</div>
</div>
</th>
<th
class="mdc-data-table__header-cell"
role="columnheader"
scope="col"
data-column-id="amount"
>
<div class="mdc-data-table__header-cell-wrapper">
<div class="mdc-data-table__header-cell-label">
Amount
</div>
</div>
</th>
<th
class="mdc-data-table__header-cell"
role="columnheader"
scope="col"
data-column-id="date"
>
<div class="mdc-data-table__header-cell-wrapper">
<div class="mdc-data-table__header-cell-label">
Date
</div>
</div>
</th>
</tr>
</thead>
<tbody class="mdc-data-table__content">
{% set donation_count = campaign.donations | length %}
{% if donation_count == 0 %}
<tr class="mdc-data-table__row">
<td class="mdc-data-table__cell">
No donations yet
</td>
</tr>
{% else %}
{% for donation in campaign.donations %}
<tr class="mdc-data-table__row">
<td class="mdc-data-table__cell">
{{ donation.donorName }}
</td>
<td class="mdc-data-table__cell">
${{ "%.2f"|format(donation.amount) }}
</td>
<td class="mdc-data-table__cell">
{{ donation.formattedDateCreated }}
</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}