Skip to content

Commit

Permalink
Copy Blade files on installation (#1118)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessarcher authored Aug 15, 2022
1 parent c2a6018 commit 2dc1e91
Show file tree
Hide file tree
Showing 56 changed files with 322 additions and 370 deletions.
8 changes: 8 additions & 0 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public function handle()
$this->installInertiaStack();
}

// Emails...
(new Filesystem)->ensureDirectoryExists(resource_path('views/emails'));
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/resources/views/emails', resource_path('views/emails'));

// Tests...
$stubs = $this->getTestStubsPath();

Expand Down Expand Up @@ -167,6 +171,7 @@ protected function installLivewireStack()
(new Filesystem)->ensureDirectoryExists(resource_path('markdown'));
(new Filesystem)->ensureDirectoryExists(resource_path('views/api'));
(new Filesystem)->ensureDirectoryExists(resource_path('views/auth'));
(new Filesystem)->ensureDirectoryExists(resource_path('views/components'));
(new Filesystem)->ensureDirectoryExists(resource_path('views/layouts'));
(new Filesystem)->ensureDirectoryExists(resource_path('views/profile'));

Expand All @@ -191,6 +196,9 @@ protected function installLivewireStack()
copy(__DIR__.'/../../stubs/app/Actions/Fortify/UpdateUserProfileInformation.php', app_path('Actions/Fortify/UpdateUserProfileInformation.php'));
copy(__DIR__.'/../../stubs/app/Actions/Jetstream/DeleteUser.php', app_path('Actions/Jetstream/DeleteUser.php'));

// Components...
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/livewire/resources/views/components', resource_path('views/components'));

// View Components...
copy(__DIR__.'/../../stubs/livewire/app/View/Components/AppLayout.php', app_path('View/Components/AppLayout.php'));
copy(__DIR__.'/../../stubs/livewire/app/View/Components/GuestLayout.php', app_path('View/Components/GuestLayout.php'));
Expand Down
56 changes: 0 additions & 56 deletions src/JetstreamServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public function boot()

Fortify::viewPrefix('auth.');

$this->configureComponents();
$this->configurePublishing();
$this->configureRoutes();
$this->configureCommands();
Expand All @@ -95,57 +94,6 @@ public function boot()
}
}

/**
* Configure the Jetstream Blade components.
*
* @return void
*/
protected function configureComponents()
{
$this->callAfterResolving(BladeCompiler::class, function () {
$this->registerComponent('action-message');
$this->registerComponent('action-section');
$this->registerComponent('application-logo');
$this->registerComponent('application-mark');
$this->registerComponent('authentication-card');
$this->registerComponent('authentication-card-logo');
$this->registerComponent('banner');
$this->registerComponent('button');
$this->registerComponent('confirmation-modal');
$this->registerComponent('confirms-password');
$this->registerComponent('danger-button');
$this->registerComponent('dialog-modal');
$this->registerComponent('dropdown');
$this->registerComponent('dropdown-link');
$this->registerComponent('form-section');
$this->registerComponent('input');
$this->registerComponent('checkbox');
$this->registerComponent('input-error');
$this->registerComponent('label');
$this->registerComponent('modal');
$this->registerComponent('nav-link');
$this->registerComponent('responsive-nav-link');
$this->registerComponent('responsive-switchable-team');
$this->registerComponent('secondary-button');
$this->registerComponent('section-border');
$this->registerComponent('section-title');
$this->registerComponent('switchable-team');
$this->registerComponent('validation-errors');
$this->registerComponent('welcome');
});
}

/**
* Register the given component.
*
* @param string $component
* @return void
*/
protected function registerComponent(string $component)
{
Blade::component('jetstream::components.'.$component, 'jet-'.$component);
}

/**
* Configure publishing for the package.
*
Expand All @@ -161,10 +109,6 @@ protected function configurePublishing()
__DIR__.'/../stubs/config/jetstream.php' => config_path('jetstream.php'),
], 'jetstream-config');

$this->publishes([
__DIR__.'/../resources/views' => resource_path('views/vendor/jetstream'),
], 'jetstream-views');

$this->publishes([
__DIR__.'/../database/migrations/2014_10_12_000000_create_users_table.php' => database_path('migrations/2014_10_12_000000_create_users_table.php'),
], 'jetstream-migrations');
Expand Down
2 changes: 1 addition & 1 deletion src/Mail/TeamInvitation.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(TeamInvitationModel $invitation)
*/
public function build()
{
return $this->markdown('jetstream::mail.team-invitation', ['acceptUrl' => URL::signedRoute('team-invitations.accept', [
return $this->markdown('emails.team-invitation', ['acceptUrl' => URL::signedRoute('team-invitations.accept', [
'invitation' => $this->invitation,
])])->subject(__('Team Invitation'));
}
Expand Down
64 changes: 32 additions & 32 deletions stubs/livewire/resources/views/api/api-token-manager.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div>
<!-- Generate API Token -->
<x-jet-form-section submit="createApiToken">
<x-form-section submit="createApiToken">
<x-slot name="title">
{{ __('Create API Token') }}
</x-slot>
Expand All @@ -12,20 +12,20 @@
<x-slot name="form">
<!-- Token Name -->
<div class="col-span-6 sm:col-span-4">
<x-jet-label for="name" value="{{ __('Token Name') }}" />
<x-jet-input id="name" type="text" class="mt-1 block w-full" wire:model.defer="createApiTokenForm.name" autofocus />
<x-jet-input-error for="name" class="mt-2" />
<x-label for="name" value="{{ __('Token Name') }}" />
<x-input id="name" type="text" class="mt-1 block w-full" wire:model.defer="createApiTokenForm.name" autofocus />
<x-input-error for="name" class="mt-2" />
</div>

<!-- Token Permissions -->
@if (Laravel\Jetstream\Jetstream::hasPermissions())
<div class="col-span-6">
<x-jet-label for="permissions" value="{{ __('Permissions') }}" />
<x-label for="permissions" value="{{ __('Permissions') }}" />

<div class="mt-2 grid grid-cols-1 md:grid-cols-2 gap-4">
@foreach (Laravel\Jetstream\Jetstream::$permissions as $permission)
<label class="flex items-center">
<x-jet-checkbox wire:model.defer="createApiTokenForm.permissions" :value="$permission"/>
<x-checkbox wire:model.defer="createApiTokenForm.permissions" :value="$permission"/>
<span class="ml-2 text-sm text-gray-600">{{ $permission }}</span>
</label>
@endforeach
Expand All @@ -35,22 +35,22 @@
</x-slot>

<x-slot name="actions">
<x-jet-action-message class="mr-3" on="created">
<x-action-message class="mr-3" on="created">
{{ __('Created.') }}
</x-jet-action-message>
</x-action-message>

<x-jet-button>
<x-button>
{{ __('Create') }}
</x-jet-button>
</x-button>
</x-slot>
</x-jet-form-section>
</x-form-section>

@if ($this->user->tokens->isNotEmpty())
<x-jet-section-border />
<x-section-border />

<!-- Manage API Tokens -->
<div class="mt-10 sm:mt-0">
<x-jet-action-section>
<x-action-section>
<x-slot name="title">
{{ __('Manage API Tokens') }}
</x-slot>
Expand Down Expand Up @@ -89,12 +89,12 @@
@endforeach
</div>
</x-slot>
</x-jet-action-section>
</x-action-section>
</div>
@endif

<!-- Token Value Modal -->
<x-jet-dialog-modal wire:model="displayingToken">
<x-dialog-modal wire:model="displayingToken">
<x-slot name="title">
{{ __('API Token') }}
</x-slot>
Expand All @@ -104,22 +104,22 @@
{{ __('Please copy your new API token. For your security, it won\'t be shown again.') }}
</div>

<x-jet-input x-ref="plaintextToken" type="text" readonly :value="$plainTextToken"
<x-input x-ref="plaintextToken" type="text" readonly :value="$plainTextToken"
class="mt-4 bg-gray-100 px-4 py-2 rounded font-mono text-sm text-gray-500 w-full"
autofocus autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
@showing-token-modal.window="setTimeout(() => $refs.plaintextToken.select(), 250)"
/>
</x-slot>

<x-slot name="footer">
<x-jet-secondary-button wire:click="$set('displayingToken', false)" wire:loading.attr="disabled">
<x-secondary-button wire:click="$set('displayingToken', false)" wire:loading.attr="disabled">
{{ __('Close') }}
</x-jet-secondary-button>
</x-secondary-button>
</x-slot>
</x-jet-dialog-modal>
</x-dialog-modal>

<!-- API Token Permissions Modal -->
<x-jet-dialog-modal wire:model="managingApiTokenPermissions">
<x-dialog-modal wire:model="managingApiTokenPermissions">
<x-slot name="title">
{{ __('API Token Permissions') }}
</x-slot>
Expand All @@ -128,26 +128,26 @@ class="mt-4 bg-gray-100 px-4 py-2 rounded font-mono text-sm text-gray-500 w-full
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
@foreach (Laravel\Jetstream\Jetstream::$permissions as $permission)
<label class="flex items-center">
<x-jet-checkbox wire:model.defer="updateApiTokenForm.permissions" :value="$permission"/>
<x-checkbox wire:model.defer="updateApiTokenForm.permissions" :value="$permission"/>
<span class="ml-2 text-sm text-gray-600">{{ $permission }}</span>
</label>
@endforeach
</div>
</x-slot>

<x-slot name="footer">
<x-jet-secondary-button wire:click="$set('managingApiTokenPermissions', false)" wire:loading.attr="disabled">
<x-secondary-button wire:click="$set('managingApiTokenPermissions', false)" wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-jet-secondary-button>
</x-secondary-button>

<x-jet-button class="ml-3" wire:click="updateApiToken" wire:loading.attr="disabled">
<x-button class="ml-3" wire:click="updateApiToken" wire:loading.attr="disabled">
{{ __('Save') }}
</x-jet-button>
</x-button>
</x-slot>
</x-jet-dialog-modal>
</x-dialog-modal>

<!-- Delete Token Confirmation Modal -->
<x-jet-confirmation-modal wire:model="confirmingApiTokenDeletion">
<x-confirmation-modal wire:model="confirmingApiTokenDeletion">
<x-slot name="title">
{{ __('Delete API Token') }}
</x-slot>
Expand All @@ -157,13 +157,13 @@ class="mt-4 bg-gray-100 px-4 py-2 rounded font-mono text-sm text-gray-500 w-full
</x-slot>

<x-slot name="footer">
<x-jet-secondary-button wire:click="$toggle('confirmingApiTokenDeletion')" wire:loading.attr="disabled">
<x-secondary-button wire:click="$toggle('confirmingApiTokenDeletion')" wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-jet-secondary-button>
</x-secondary-button>

<x-jet-danger-button class="ml-3" wire:click="deleteApiToken" wire:loading.attr="disabled">
<x-danger-button class="ml-3" wire:click="deleteApiToken" wire:loading.attr="disabled">
{{ __('Delete') }}
</x-jet-danger-button>
</x-danger-button>
</x-slot>
</x-jet-confirmation-modal>
</x-confirmation-modal>
</div>
16 changes: 8 additions & 8 deletions stubs/livewire/resources/views/auth/confirm-password.blade.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<x-guest-layout>
<x-jet-authentication-card>
<x-authentication-card>
<x-slot name="logo">
<x-jet-authentication-card-logo />
<x-authentication-card-logo />
</x-slot>

<div class="mb-4 text-sm text-gray-600">
{{ __('This is a secure area of the application. Please confirm your password before continuing.') }}
</div>

<x-jet-validation-errors class="mb-4" />
<x-validation-errors class="mb-4" />

<form method="POST" action="{{ route('password.confirm') }}">
@csrf

<div>
<x-jet-label for="password" value="{{ __('Password') }}" />
<x-jet-input id="password" class="block mt-1 w-full" type="password" name="password" required autocomplete="current-password" autofocus />
<x-label for="password" value="{{ __('Password') }}" />
<x-input id="password" class="block mt-1 w-full" type="password" name="password" required autocomplete="current-password" autofocus />
</div>

<div class="flex justify-end mt-4">
<x-jet-button class="ml-4">
<x-button class="ml-4">
{{ __('Confirm') }}
</x-jet-button>
</x-button>
</div>
</form>
</x-jet-authentication-card>
</x-authentication-card>
</x-guest-layout>
16 changes: 8 additions & 8 deletions stubs/livewire/resources/views/auth/forgot-password.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-guest-layout>
<x-jet-authentication-card>
<x-authentication-card>
<x-slot name="logo">
<x-jet-authentication-card-logo />
<x-authentication-card-logo />
</x-slot>

<div class="mb-4 text-sm text-gray-600">
Expand All @@ -14,21 +14,21 @@
</div>
@endif

<x-jet-validation-errors class="mb-4" />
<x-validation-errors class="mb-4" />

<form method="POST" action="{{ route('password.email') }}">
@csrf

<div class="block">
<x-jet-label for="email" value="{{ __('Email') }}" />
<x-jet-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autofocus />
<x-label for="email" value="{{ __('Email') }}" />
<x-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autofocus />
</div>

<div class="flex items-center justify-end mt-4">
<x-jet-button>
<x-button>
{{ __('Email Password Reset Link') }}
</x-jet-button>
</x-button>
</div>
</form>
</x-jet-authentication-card>
</x-authentication-card>
</x-guest-layout>
Loading

0 comments on commit 2dc1e91

Please sign in to comment.