Skip to content

Commit

Permalink
Merge branch 'develop' into export-table-livewire
Browse files Browse the repository at this point in the history
  • Loading branch information
spitfire305 committed Jan 24, 2025
2 parents 3b238e8 + 2218c45 commit eea0f4b
Show file tree
Hide file tree
Showing 88 changed files with 509 additions and 610 deletions.
15 changes: 14 additions & 1 deletion app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Exceptions;

use App\Facades\Domain;
use App\Models\Campaign;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
Expand Down Expand Up @@ -57,6 +58,19 @@ public function render($request, Throwable $exception)
} elseif ($exception instanceof AuthorizationException && auth()->guest()) {
// User needs to be logged in, remember the page they visited
session()->put('login_redirect', $request->getRequestUri());
} elseif (!$request->is('api/*') && $exception instanceof ModelNotFoundException) {
// If the guest user tries accessing a private campaign, let's tell them about it
$campaign = request()->route('campaign');
if (empty($campaign) || !($campaign instanceof Campaign)) {
session()->put('login_redirect', $request->getRequestUri());
/** @var Campaign $campaign */
$campaign = Campaign::select('id')->slug($campaign)->first();
if ($campaign && !$campaign->isPublic()) {
return response()->view('errors.private-campaign', [
'campaign' => $campaign
], 200);
}
}
} elseif ($exception instanceof SymHttpException && $exception->getStatusCode() == 503) {
if (request()->ajax()) {
return response()->json([
Expand All @@ -76,7 +90,6 @@ public function render($request, Throwable $exception)
// API error handling
return $this->handleApiErrors($exception);
}

return parent::render($request, $exception);
}

Expand Down
6 changes: 4 additions & 2 deletions app/Http/Controllers/Entity/ShowController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ public function index(Campaign $campaign, Entity $entity)
return redirect()->route('entities.show', [$campaign, $entity, $entity->slug]);
}*/

// Avoid sillyness
$entity->child->setRelation('entity', $entity);
// Perf trick
if (!$entity->entityType->isSpecial()) {
$entity->child->setRelation('entity', $entity);
}


return view('cruds.show')
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Families/MemberController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function index(Campaign $campaign, Family $family)
->with([
'location', 'location.entity',
'characterFamilies',
'entity', 'entity.tags', 'entity.tags.entity', 'entity.image'
'entity', 'entity.tags', 'entity.tags.entity', 'entity.image', 'entity.entityType',
])
->has('entity')
->paginate();
Expand Down
19 changes: 12 additions & 7 deletions app/Models/CampaignDashboardWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,19 @@ public function entities(int $page = 1)
public function randomEntity()
{
$entityType = $this->conf('entity');
$entityTypeID = null;
if (!empty($entityType)) {
$entityTypeID = (int) config('entities.ids.' . $entityType);
}

$base = new Entity();

if ($this->entityType && !$this->entityType->isSpecial()) {
if ($this->entityType) {
if ($this->entityType->isSpecial()) {
return $base
->filter($this->filterOptions())
->inTags($this->tags->pluck('id')->toArray())
->whereNotIn('entities.id', \App\Facades\Dashboard::excluding())
->inTypes($this->entityType->id)
->with(['image', 'entityType', 'header', 'tags'])
->inRandomOrder()
->first();
}
$model = $this->entityType->getClass();

/** @var FilterService $filterService */
Expand Down Expand Up @@ -347,7 +352,7 @@ public function randomEntity()
->whereNotIn('type_id', [config('entities.ids.attribute_template'), config('entities.ids.conversation'), config('entities.ids.tag')])
->whereNotIn('entities.id', \App\Facades\Dashboard::excluding())
->inTypes($this->entityType?->id)
->with(['image', 'entityType', 'header'])
->with(['image', 'entityType', 'header', 'tags'])
->inRandomOrder()
->first();
}
Expand Down
2 changes: 1 addition & 1 deletion app/Services/Entity/RecoverySetupService.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected function i18n(): array
'premium_title' => __('callouts.premium.title'),
'premium' => __('campaigns/recovery.premium'),
'upgrade' => __('cookieconsent.link'),
'confirm' => __('crud.click_modal.confirm'),
'confirm' => __('crud.actions.confirm'),
'deleted_at' => __('campaigns/recovery.fields.deleted_at', ['date' => 'placeholder', 'user' => 'placeholder']),
'recovery_success' => __('campaigns/recovery.name_link', ['name' => '<a href="placeholder">placeholder</a>']),

Expand Down
2 changes: 1 addition & 1 deletion app/Services/Gallery/SetupService.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ protected function i18n(): array
'delete' => __('crud.remove'),
'save' => __('crud.save'),
'saved' => __('gallery.file.saved'),
'confirm' => __('crud.click_modal.confirm'),
'confirm' => __('crud.actions.confirm'),
'visibility' => __('crud.fields.visibility'),
'size' => __('campaigns/gallery.fields.size'),
'file_type' => __('campaigns/gallery.fields.file_type'),
Expand Down
8 changes: 6 additions & 2 deletions lang/en/campaigns.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
'past_featured' => 'Previously featured campaign',
'post_collapsed' => 'New posts on entities are collapsed by default.',
'premium' => 'Premium unlocked by :name',
'private_mention_visibility' => 'Show private entity names when they\'re mentioned.',
'private_mention_visibility' => 'Private mentions',
'public' => 'Campaign visibility',
'public_campaign_filters' => 'Public Filters',
'related_visibility' => 'Related Elements Visibility',
Expand Down Expand Up @@ -87,7 +87,7 @@
'premium' => 'Some features require premium features te be unlocked. Find out more about :settings.',
'public_campaign_filters' => 'Help others find the campaign among other public campaigns by providing the following information.',
'public_no_visibility' => 'Heads up! The campaign is public, but the campaign\'s public role can\'t access anything. :fix.',
'private_mention_visibility' => 'If enabled, the names of private entities that are mentioned will be visible to all users.',
'private_mention_visibility' => 'Control if mentions to private entities are kept secret or show their names.',
'related_visibility' => 'Default Visibility value when creating a new element with this field (posts, connections, abilities, etc)',
'system' => 'If your campaign is publicly visible, the system is shown in the :link page.',
'systems' => 'To avoid cluttering users with options, some features of Kanka are only available with specific RPG systems (ie the D&D 5e monster stat block). Adding supported systems here will enable those features.',
Expand Down Expand Up @@ -201,6 +201,10 @@
'removed' => 'Role :role removed from :user.',
],
],
'mentions' => [
'visible' => 'Show entity name',
'private' => 'Hide entity name',
],
'modules' => [
'permission-disabled' => 'This module is disabled.',
],
Expand Down
39 changes: 4 additions & 35 deletions lang/en/crud.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
'apply' => 'Apply',
'back' => 'Back',
'change' => 'Change',
'confirm' => 'Confirm',
'copy' => 'Copy',
'close' => 'Close',
'copy_mention' => 'Copy [ ] mention',
'copy_to_campaign' => 'Copy to campaign',
'disable' => 'Disable',
Expand Down Expand Up @@ -87,11 +89,6 @@
'bulk_title' => 'Apply a template to multiple entities',
],
'cancel' => 'Cancel',
'click_modal' => [
'close' => 'Close',
'confirm' => 'Confirm',
'title' => 'Confirm your action',
],
'copy_to_campaign' => [
'bulk_title' => 'Copy entities to another campaign',
'panel' => 'Copy',
Expand All @@ -103,9 +100,7 @@
],
'delete_modal' => [
'callout' => 'Psst!',
'close' => 'Close',
'confirm' => 'Confirm removal',
'delete' => 'Remove',
'description_v2' => 'You are removing ":tag".',
'permanent' => 'This action is permanent and cannot be undone.',
'recoverable' => 'Entities can be recovered for up to :day days with a :boosted-campaign.',
Expand Down Expand Up @@ -166,41 +161,29 @@
'visibility' => 'Visibility',
],
'files' => [
'actions' => [
'drop' => 'Click to Add or Drop a file',
'manage' => 'Manage Entity Files',
],
'errors' => [
'max' => 'You have reached the maximum number (:max) of files for this entity.',
'max_size' => 'The campaign has reached the maximum file storage capacity.',
'no_files' => 'No files.',
],
'files' => 'Uploaded Files',
'hints' => [
'limit' => 'Each entity can have a maximum of :max files uploaded to it.',
'limitations' => 'Supported formats: :formats. Max file size: :size.',
],
'title' => 'Entity Files for :name',
],
'filter' => 'Filter',
'filters' => [
'all' => 'Filter to all descendants',
'clear' => 'Clear Filters',
'copy_helper' => 'Use the copied filters in your clipboard as values for filters on dashboard widgets and bookmarks.',
'copy_helper_no_filters' => 'Define some filters first to be able to copy them to your clipboard.',
'copy_to_clipboard' => 'Copy filters to clipboard',
'direct' => 'Filter to direct descendants',
'filtered' => 'Showing :count of :total :entity.',
'hide' => 'Hide Filters',
'lists' => [
'desktop' => [
'all' => 'Show all descendants (:count)',
'filtered' => 'Show direct descendants (:count)',
],
'mobile' => [
'all' => 'Show all (:count)',
'filtered' => 'Show direct (:count)',
],
],
'mobile' => [
'clear' => 'Clear',
Expand Down Expand Up @@ -243,15 +226,11 @@
'hints' => [
'attribute_template' => 'The selected attribute template will be applied when saving the entity.',
'calendar_date' => 'A calendar date allows easy filtering in lists, and also maintains a reminder in the selected calendar.',
'gallery_header' => 'If the entity has no header, display an image from the campaign gallery instead.',
'gallery_image' => 'If the entity has no image, display an image from the campaign gallery instead.',
'header_image' => 'This image is placed above the entity. For best results, use a wide image.',
'image_dimension' => 'Recommended dimensions: :dimension pixels.',
'image_limitations' => 'Supported formats: :formats. Max file size: :size.',
'image_recommendation' => 'Recommended dimensions: :width by :height px.',
'is_star' => 'Pinned elements will appear on the entity\'s overview page.',
'tooltip' => 'Replace the automatically generated tooltip with the following contents. Any HTML code will be stripped, but you can still mention other entities using advanced mentions.',
'visibility' => 'Setting the visibility to admin means only members in the Admin campaign role can view this. Setting it to self means only you can view this.',
],
'history' => [
'created_clean' => 'Created by :name :date',
Expand All @@ -266,14 +245,12 @@
],
'is_private' => 'This entity is private and only visible to members of the campaign\'s Admin role.',
'keyboard-shortcut' => 'Keyboard shortcut :code',
'legacy' => 'Legacy',
'navigation' => [
'cancel' => 'cancel',
'or_cancel' => 'or :cancel',
'skip_to_content' => 'Skip navigation',
],
'permissions' => [
'action' => 'Action',
'actions' => [
'bulk' => [
'add' => 'Allow',
Expand All @@ -288,20 +265,16 @@
],
'delete' => 'Delete',
'edit' => 'Edit',
'read' => 'Read',
'view' => 'View',
'toggle' => 'Toggle',
],
'allowed' => 'Allowed',
'fields' => [
'member' => 'Member',
'role' => 'Role',
],
'helper' => 'Use this interface to fine-tune which users and roles that can interact with this entity. :allow',
'helpers' => [
'setup' => 'Use this interface to fine-tune how roles and users can interact with this entity. :allow will allow the user or role to do this action. :deny will deny them that action. :inherit will use the user\'s role or main role\'s permission. A user set to :allow is able to do the action, even if their role is set to :deny.',
'setup' => 'Control how roles and members can interact with this entity. :allow will allow a member or role to do this action. :deny will deny them that action. :inherit will use the role or member\'s role\'s permission. A member set to :allow is able to do the action, even if one of their roles is set to :deny.',
],
'inherited' => 'This role already has this permission set for this entity type.',
'inherited_by' => 'This user is part of the \':role\' role which grants this permissions on this entity type.',
'success' => 'Permissions saved.',
'title' => 'Permissions',
'too_many_members' => 'This campaign has too many members (>:number) to display in this interface. Please use the Permission button on the entity view to control permissions in detail.',
Expand Down Expand Up @@ -347,7 +320,6 @@
'save_and_view' => 'Save and View',
'search' => 'Search',
'select' => 'Select',
'superboosted_campaigns' => 'Superboosted Campaigns',
'tabs' => [
'abilities' => 'Abilities',
'assets' => 'Assets',
Expand All @@ -369,9 +341,6 @@
'editing' => 'Editing :name',
'new' => 'New :module',
],
'tooltips' => [
'new_post' => 'Add a new post to this entity.',
],
'update' => 'Update',
'users' => [
'unknown' => 'Unknown',
Expand Down
13 changes: 12 additions & 1 deletion lang/en/errors.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@
'title' => 'Maintenance',
],
'footer' => 'If you need further assistance, please contact us at :email or on the :discord',
'log-in' => 'Login in to your account might reveal what you are looking for.',
'log-in' => 'Logging in to your account might reveal what you are looking for.',
'post_layout' => 'Invalid post layout.',
'back-to-campaigns' => 'Go back to one of your campaigns',
'private-campaign' => [
'title' => 'Private campaign',
'auth' => [
'helper' => 'You don\'t have access to this campaign.',
],
'guest' => [
'helper' => 'The campaign you are trying to access is private and you are not logged in.',
'login' => 'Logging in might let you access the contents.',
],
],
];
15 changes: 15 additions & 0 deletions lang/en/permissions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

return [
'helpers' => [
'view' => 'Permission to view this element',
'edit' => 'Permission to edit this element',
'delete' => 'Permission to delete this element',
],
'members' => [
'inherited' => ':member can already do this by being part of the :role role.',
],
'roles' => [
'inherited' => 'The :role role can already do this on the whole :module module.',
]
];
3 changes: 3 additions & 0 deletions lang/en/posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
'placeholders' => [
'name' => 'Name of the post',
],
'helpers' => [
'new' => 'Add a new post to this entity.',
],
'position' => [
'dont_change' => 'Don\'t change',
'first' => 'First',
Expand Down
1 change: 1 addition & 0 deletions public/build/assets/app-526e0182.css

Large diffs are not rendered by default.

10 changes: 0 additions & 10 deletions public/build/assets/app-815a0683.js

This file was deleted.

10 changes: 10 additions & 0 deletions public/build/assets/app-b3e4fbbe.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion public/build/assets/app-d0a22e99.css

This file was deleted.

1 change: 0 additions & 1 deletion public/build/assets/auth-2545f29b.css

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/auth-9f54961e.css

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion public/build/assets/dialog-d7ca7e30.js

This file was deleted.

Loading

0 comments on commit eea0f4b

Please sign in to comment.