Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
edwh committed May 23, 2024
2 parents 35f4716 + 670e0a4 commit 78d78bf
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/API/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function getEventsByUsersNetworks(Request $request, $date_from = null, $d
public function addVolunteer(Request $request, $idevents)
{
$request->validate([
'volunteer_email_address' => 'email',
'volunteer_email_address' => ['nullable', 'email'],
]);

$party = Party::findOrFail($idevents);
Expand Down
30 changes: 23 additions & 7 deletions resources/js/components/StatsShare.vue
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,14 @@ export default {
let text = ''
// Use the line height of this as our standard for moving down the image.
let lineHeight = ctx.measureText(
this.$lang.get('partials.share_modal_weve_saved') + str + this.$lang.get('partials.share_modal_of_co2')
).emHeightAscent + ctx.measureText(str).emHeightDescent + MARG * 2
//
// Older browsers don't support emHeight*
let measure1 = ctx.measureText(this.$lang.get('partials.share_modal_weve_saved') + str + this.$lang.get('partials.share_modal_of_co2'))
let measure2 = ctx.measureText(str)
let asc = measure1.emHeightAscent ? 'emHeightAscent' : 'actualBoundingBoxAscent'
let desc = measure1.emHeightDescent ? 'emHeightDescent' : 'actualBoundingBoxDescent'
let lineHeight = measure1[asc] + measure2[desc] + MARG * 2
console.log('Line height', lineHeight)
let wholeline
Expand Down Expand Up @@ -465,9 +470,12 @@ export default {
ctx.font = "bold " + this.smallerFontSize + "px Asap, sans-serif"
lineHeight = ctx.measureText(
this.$lang.get('partials.share_modal_weve_saved') + str + this.$lang.get('partials.share_modal_of_co2')
).emHeightAscent + ctx.measureText(str).emHeightDescent + MARG * 2
// Older browsers don't support emHeight*
measure1 = ctx.measureText(this.$lang.get('partials.share_modal_weve_saved') + str + this.$lang.get('partials.share_modal_of_co2'))
measure2 = ctx.measureText(str)
asc = measure1.emHeightAscent ? 'emHeightAscent' : 'actualBoundingBoxAscent'
desc = measure1.emHeightDescent ? 'emHeightDescent' : 'actualBoundingBoxDescent'
lineHeight = measure1[asc] + measure2[desc] + MARG * 2
if (RANGES[ix][2] != 'Hectare') {
if (this.portrait) {
Expand Down Expand Up @@ -533,6 +541,7 @@ export default {
// Write the text.
ctx.fillStyle = colour || 'black'
ctx.strokeStyle = colour || 'black'
console.log('Fill', str, x, y)
ctx.fillText(str, x, y)
// Return where we're up to.
Expand All @@ -556,7 +565,14 @@ export default {
},
fillWhiteBlackBox(str, x, y) {
const ctx = this.ctx
ctx.roundRect(x, y - ctx.measureText(str).emHeightAscent - MARG, ctx.measureText(str).width + MARG * 2, ctx.measureText(str).emHeightAscent + ctx.measureText(str).emHeightDescent + MARG * 2, RADIUS)
if (ctx.roundRect) {
ctx.roundRect(x, y - ctx.measureText(str).emHeightAscent - MARG, ctx.measureText(str).width + MARG * 2, ctx.measureText(str).emHeightAscent + ctx.measureText(str).emHeightDescent + MARG * 2, RADIUS)
} else {
// Older browsers.
ctx.rect(x, y - ctx.measureText(str).emHeightAscent - MARG, ctx.measureText(str).width + MARG * 2, ctx.measureText(str).emHeightAscent + ctx.measureText(str).emHeightDescent + MARG * 2)
}
ctx.fill()
// Looks like we need a beginPath() to prevent future calls to roundRect working on the same rectangle and
Expand Down
1 change: 1 addition & 0 deletions tests/Feature/Events/AddRemoveVolunteerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public function testAddRemove($role, $addrole, $shouldBeHost)
// Add by name only
$response = $this->put('/api/events/' . $event->idevents . '/volunteers', [
'full_name' => 'Jo Bloggins',
'volunteer_email_address' => NULL,
]);

$response->assertSuccessful();
Expand Down

0 comments on commit 78d78bf

Please sign in to comment.