Skip to content

Commit 15431a2

Browse files
committed
PCP: show goal/raised in AdminUI, fix PCPInfo page on mobile, remove delete link
1 parent a342982 commit 15431a2

File tree

5 files changed

+94
-58
lines changed

5 files changed

+94
-58
lines changed

CRM/PCP/BAO/PCP.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -334,14 +334,6 @@ public static function &pcpLinks($pcpId = NULL) {
334334
'title' => ts('Disable'),
335335
'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::DISABLE),
336336
],
337-
CRM_Core_Action::DELETE => [
338-
'name' => ts('Delete'),
339-
'url' => 'civicrm/pcp',
340-
'qs' => 'action=delete&reset=1&id=%%pcpId%%&component=%%pageComponent%%',
341-
'extra' => 'onclick = "return confirm(\'' . $deleteExtra . '\');"',
342-
'title' => ts('Delete'),
343-
'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::DELETE),
344-
],
345337
];
346338

347339
// pcp.user.actions emits a malformed set of $links. But it is locked-in via unit-test, so we'll grandfather

css/civicrm.css

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,13 +1367,30 @@ input.crm-form-entityref {
13671367
line-height: 1em;
13681368
}
13691369

1370+
/* Mobile-friendly layout for two columns */
1371+
@media (min-width: 768px) {
1372+
#crm-container .pcp-page-pcpinfo-intro {
1373+
float: left;
1374+
max-width: calc(100% - 370px);
1375+
}
1376+
#crm-container .pcp-widgets {
1377+
float: right;
1378+
max-width: 360px;
1379+
}
1380+
}
1381+
13701382
#crm-container .pcp-intro-text {
13711383
padding-bottom: 1em;
13721384
}
13731385

13741386
#crm-container .pcp-image {
1375-
float: left;
1376-
margin: 0 1em 1em 0;
1387+
text-align: center;
1388+
margin-bottom: 1em;
1389+
}
1390+
@media (min-width: 768px) {
1391+
#crm-container .pcp-image {
1392+
margin: 0 1em 1em 0;
1393+
}
13771394
}
13781395

13791396
#crm-container .pcp-image img {
@@ -1382,7 +1399,6 @@ input.crm-form-entityref {
13821399

13831400
#crm-container .pcp-widgets {
13841401
border: 1px solid #cccccc;
1385-
float: right;
13861402
margin: 0 0 1em 1em;
13871403
padding: 0.5em;
13881404
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
<div af-fieldset="" af-title="Personal Campaign Pages">
1+
<div af-fieldset="">
22
<div class="af-container af-layout-inline">
33
<af-field name="status_id" defn="{input_attrs: {multiple: true}, required: false, label: 'Status'}" />
4-
<af-field name="IFNULL_PCP_ContributionPage_page_id_01_title_PCP_Event_page_id_01_title" defn="{label: 'Contribution Page/Event', input_attrs: {}}" />
4+
<af-field name="PCP_Event_page_id_01_title" defn="{label: 'Contribution Page/Event', input_attrs: {}}" />
55
<af-field name="page_type" defn="{input_attrs: {multiple: true}, label: 'Page Type'}" />
6+
<af-field name="is_active" defn="{afform_default: true}" />
67
</div>
78
<crm-search-display-table search-name="Personal_Campaign_Pages" display-name="Personal_Campaign_Pages"></crm-search-display-table>
89
</div>

ext/civicrm_admin_ui/managed/SavedSearch_Personal_Campaign_Pages.mgd.php

Lines changed: 70 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
use CRM_CivicrmAdminUi_ExtensionUtil as E;
34

45
return [
@@ -18,18 +19,17 @@
1819
'select' => [
1920
'title',
2021
'PCP_Contact_contact_id_01.sort_name',
21-
'IFNULL(PCP_ContributionPage_page_id_01.title, PCP_Event_page_id_01.title) AS IFNULL_PCP_ContributionPage_page_id_01_title_PCP_Event_page_id_01_title',
22-
'PCP_Event_page_id_01.title',
23-
'PCP_ContributionPage_page_id_01.start_date',
24-
'PCP_ContributionPage_page_id_01.end_date',
25-
'PCP_Event_page_id_01.start_date',
26-
'PCP_Event_page_id_01.end_date',
22+
'IFNULL(PCP_ContributionPage_page_id_01.title, PCP_Event_page_id_01.title) AS PCP_Event_page_id_01_title',
23+
'goal_amount',
2724
'status_id:label',
2825
'is_active',
26+
'SUM(PCP_Contact_contact_id_01_Contact_ContributionSoft_contact_id_01.amount) AS SUM_PCP_Contact_contact_id_01_Contact_ContributionSoft_contact_id_01_amount',
2927
],
3028
'orderBy' => [],
3129
'where' => [],
32-
'groupBy' => [],
30+
'groupBy' => [
31+
'id',
32+
],
3333
'join' => [
3434
[
3535
'ContributionPage AS PCP_ContributionPage_page_id_01',
@@ -42,7 +42,7 @@
4242
[
4343
'page_type',
4444
'=',
45-
'\'contribute\'',
45+
"'contribute'",
4646
],
4747
],
4848
[
@@ -65,7 +65,16 @@
6565
[
6666
'page_type',
6767
'=',
68-
'\'event\'',
68+
"'event'",
69+
],
70+
],
71+
[
72+
'ContributionSoft AS PCP_Contact_contact_id_01_Contact_ContributionSoft_contact_id_01',
73+
'LEFT',
74+
[
75+
'PCP_Contact_contact_id_01.id',
76+
'=',
77+
'PCP_Contact_contact_id_01_Contact_ContributionSoft_contact_id_01.contact_id',
6978
],
7079
],
7180
],
@@ -99,6 +108,7 @@
99108
[
100109
'type' => 'field',
101110
'key' => 'title',
111+
'dataType' => 'String',
102112
'label' => E::ts('Page Title'),
103113
'sortable' => TRUE,
104114
'link' => [
@@ -112,6 +122,7 @@
112122
[
113123
'type' => 'field',
114124
'key' => 'PCP_Contact_contact_id_01.sort_name',
125+
'dataType' => 'String',
115126
'label' => E::ts('Supporter'),
116127
'sortable' => TRUE,
117128
'link' => [
@@ -120,34 +131,38 @@
120131
'action' => 'view',
121132
'join' => 'PCP_Contact_contact_id_01',
122133
'target' => '',
134+
'task' => '',
123135
],
124-
'title' => E::ts('View Personal Campaign Page Contact'),
125136
],
126137
[
127138
'type' => 'field',
128-
'key' => 'IFNULL_PCP_ContributionPage_page_id_01_title_PCP_Event_page_id_01_title',
139+
'key' => 'PCP_Event_page_id_01_title',
140+
'dataType' => 'String',
129141
'label' => E::ts('Contribution Page/Event'),
130142
'sortable' => TRUE,
131-
'rewrite' => '',
132143
],
133144
[
134145
'type' => 'field',
135-
'key' => 'PCP_ContributionPage_page_id_01.start_date',
136-
'label' => E::ts('Start Date'),
146+
'key' => 'status_id:label',
147+
'dataType' => 'Integer',
148+
'label' => E::ts('Status'),
137149
'sortable' => TRUE,
138150
],
139151
[
140152
'type' => 'field',
141-
'key' => 'PCP_ContributionPage_page_id_01.end_date',
142-
'label' => E::ts('End Date'),
153+
'key' => 'goal_amount',
154+
'dataType' => 'Money',
155+
'label' => E::ts('Goal'),
143156
'sortable' => TRUE,
144-
'empty_value' => '(ongoing)',
157+
'alignment' => 'text-right',
145158
],
146159
[
147160
'type' => 'field',
148-
'key' => 'status_id:label',
149-
'label' => E::ts('Status'),
161+
'key' => 'SUM_PCP_Contact_contact_id_01_Contact_ContributionSoft_contact_id_01_amount',
162+
'dataType' => 'Money',
163+
'label' => E::ts('Raised'),
150164
'sortable' => TRUE,
165+
'alignment' => 'text-right',
151166
],
152167
[
153168
'text' => '',
@@ -166,60 +181,67 @@
166181
'path' => '',
167182
'action' => 'update',
168183
'condition' => [],
184+
'conditions' => [],
169185
],
170186
[
171187
'path' => 'civicrm/admin/pcp?action=revert&id=[id]',
172188
'icon' => 'fa-external-link',
173189
'text' => E::ts('Reject'),
174190
'style' => 'default',
175-
'condition' => [
176-
'status_id:name',
177-
'IN',
178-
[
179-
'Waiting Review',
180-
'Approved',
181-
],
182-
],
183191
'task' => '',
184192
'entity' => '',
185193
'action' => '',
186194
'join' => '',
187195
'target' => '_blank',
196+
'conditions' => [
197+
[
198+
'status_id:name',
199+
'IN',
200+
[
201+
'Waiting Review',
202+
'Approved',
203+
],
204+
],
205+
],
188206
],
189207
[
190208
'path' => 'civicrm/admin/pcp?action=renew&id=[id]',
191209
'icon' => 'fa-external-link',
192210
'text' => E::ts('Approve'),
193211
'style' => 'default',
194-
'condition' => [
195-
'status_id:name',
196-
'IN',
197-
[
198-
'Waiting Review',
199-
'Not Approved',
200-
],
201-
],
202212
'task' => '',
203213
'entity' => '',
204214
'action' => '',
205215
'join' => '',
206216
'target' => '_blank',
217+
'conditions' => [
218+
[
219+
'status_id:name',
220+
'IN',
221+
[
222+
'Waiting Review',
223+
'Not Approved',
224+
],
225+
],
226+
],
207227
],
208228
[
209229
'path' => '',
210230
'icon' => 'fa-toggle-on',
211231
'text' => E::ts('Enable'),
212232
'style' => 'default',
213-
'condition' => [
214-
'is_active',
215-
'=',
216-
FALSE,
217-
],
218233
'task' => 'enable',
219234
'entity' => 'PCP',
220235
'action' => '',
221236
'join' => '',
222237
'target' => 'crm-popup',
238+
'conditions' => [
239+
[
240+
'is_active',
241+
'=',
242+
FALSE,
243+
],
244+
],
223245
],
224246
[
225247
'task' => 'disable',
@@ -231,10 +253,12 @@
231253
'style' => 'default',
232254
'path' => '',
233255
'action' => '',
234-
'condition' => [
235-
'is_active',
236-
'=',
237-
TRUE,
256+
'conditions' => [
257+
[
258+
'is_active',
259+
'=',
260+
TRUE,
261+
],
238262
],
239263
],
240264
[
@@ -248,6 +272,7 @@
248272
'path' => '',
249273
'action' => '',
250274
'condition' => [],
275+
'conditions' => [],
251276
],
252277
],
253278
'type' => 'menu',
@@ -267,6 +292,7 @@
267292
FALSE,
268293
],
269294
],
295+
'actions_display_mode' => 'menu',
270296
],
271297
],
272298
'match' => [

templates/CRM/PCP/Page/PCPInfo.tpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
{/if}
4646
<div class="campaign">
4747
{crmRegion name="pcp-page-pcpinfo"}
48-
<div class="pcp-page-pcpinfo-intro float-left">
48+
<div class="pcp-page-pcpinfo-intro">
4949
{if $image}
5050
<div class="pcp-image">{$image}</div>
5151
{/if}
@@ -87,6 +87,7 @@
8787
<div class="description">[<a href="#" onclick="roll_start_stop(); return false;" id="roll" title="{ts escape='htmlattribute'}Stop scrolling{/ts}">{ts}Stop{/ts}</a>]</div>
8888
</div>
8989
{/if}
90+
<div style="clear: both;"></div>
9091
</div>
9192
<div style="clear: both;"></div>
9293
{if $linkText}

0 commit comments

Comments
 (0)