Skip to content

Commit

Permalink
Clearer application UI
Browse files Browse the repository at this point in the history
  • Loading branch information
ilestis committed Sep 14, 2024
1 parent 3f040d9 commit da8bcf6
Show file tree
Hide file tree
Showing 29 changed files with 215 additions and 126 deletions.
19 changes: 18 additions & 1 deletion app/Http/Controllers/Campaign/SubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@ public function index(Campaign $campaign)
->with('campaign', $campaign);
}

public function show(Campaign $campaign, CampaignSubmission $campaignSubmission)
{
$this->authorize('submissions', $campaign);

if (!$campaign->canHaveMoreMembers()) {
return view('cruds.forms.limit')
->with('campaign', $campaign)
->with('key', 'members')
->with('name', 'campaign_roles');
}

return view('campaigns.submissions.show')
->with('application', $campaignSubmission)
->with('campaign', $campaign)
;
}

public function edit(Campaign $campaign, CampaignSubmission $campaignSubmission)
{
$this->authorize('submissions', $campaign);
Expand Down Expand Up @@ -74,7 +91,7 @@ public function update(PatchCampaignApplication $request, Campaign $campaign, Ca
$note = $this->service
->campaign($campaign)
->submission($campaignSubmission)
->process($request->only('role_id', 'rejection', 'action', 'message'));
->process($request->only('role_id', 'rejection', 'action', 'reason'));

return redirect()->route('campaign_submissions.index', $campaign)
->with('success', __('campaigns/submissions.update.' . $note));
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Requests/Campaigns/PatchCampaignApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public function rules()
{
$rules = [
'role_id' => 'required_if:action,approve:rejection|exists:campaign_roles,id',
'rejection' => 'nullable|string|max:191',
'message' => 'nullable|string|max:191',
'reason' => 'nullable|string|max:191',
'action' => 'required',
];
return $rules;
Expand Down
4 changes: 2 additions & 2 deletions app/Services/Campaign/SubmissionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function process(array $data): string
$return = 'rejected';

// Notify the user
$rejection = $this->purify(Arr::get($data, 'rejection'));
$rejection = $this->purify(Arr::get($data, 'reason'));
if ($rejection == '') {
$key = 'campaign.application.rejected_no_message';
} else {
Expand All @@ -78,7 +78,7 @@ public function process(array $data): string
])
);
} else {
$this->approve((int) Arr::get($data, 'role_id'), $this->purify(Arr::get($data, 'message')));
$this->approve((int) Arr::get($data, 'role_id'), $this->purify(Arr::get($data, 'reason')));
}

$this->submission->delete();
Expand Down
33 changes: 17 additions & 16 deletions lang/en/campaigns/submissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
return [
'actions' => [
'accept' => 'Accept',
'applications' => 'Applications: :status',
'change' => 'Change',
'reject' => 'Reject',
'reject' => 'Deny',
],
'apply' => [
'apply' => 'Apply',
Expand All @@ -18,31 +16,24 @@
],
'title' => 'Join :name',
],
'errors' => [
'not_open' => 'The campaign isn\'t open to new members. Edit the campaign\'s settings if you want to allow users applying to it.',
],
'fields' => [
'application' => 'Application',
'approval' => 'Approval reason',
'rejection' => 'Rejection reason',
'reason' => 'Approval / Rejection reason',
],
'helpers' => [
'filter-helper' => 'This campaign is open to applications!',
'modal' => 'A campaign which is open to applications and public can have users apply to join the campaign.',
'no_applications_title' => 'No applications found',
'no_applications' => 'There are currently no pending applications to join the campaign. Users can apply to join the campaign by visiting it\'s dashboard and clicking on the :button button.',
'not_open' => 'The campaign isn\'t currently accepting applications.',
'open_not_public' => 'The campaign is open to applications, but not public, meaning no one can apply to join it. This can be changed by editing the campaign\'s settings.',
'reason' => 'If provided, the applicant will be notified with this reason.',
'role' => 'If approving, the role the applicant gets added to.',
],
'placeholders' => [
'note' => 'Write down your application to join the campaign',
],
'statuses' => [
'closed' => 'Closed',
'open' => 'Open',
'reason' => 'Your reason',
],
'toggle' => [
'closed' => 'Closed to applications',
'label' => 'Status',
'closed' => 'Closed to applications',
'open' => 'Open to applications',
'success' => 'Campaign application status updated.',
'title' => 'Application status',
Expand All @@ -53,4 +44,14 @@
'reject' => 'Write an optional message to the user as to why you are rejecting their application.',
'rejected' => 'Application rejected',
],
'open' => [
'title' => 'Open campaign',
'open' => 'Campaign is open',
'closed' => 'Campaign is closed',
],
'public' => [
'title' => 'Public campaign',
'public' => 'Campaign is public',
'private' => 'Campaign is private',
],
];
1 change: 1 addition & 0 deletions public/build/assets/abilities-1bbcfe51.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion public/build/assets/abilities-f7438e43.js

This file was deleted.

Loading

0 comments on commit da8bcf6

Please sign in to comment.