Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop laravelcollective/html package (abandoned) #379

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
"illuminate/contracts": "^9.0|^10.0",
"illuminate/database": "^9.0|^10.0",
"illuminate/events": "^9.0|^10.0",
"illuminate/notifications": "^9.0|^10.0",
"laravelcollective/html": "^6.0"
"illuminate/notifications": "^9.0|^10.0"
},
"require-dev": {
"mockery/mockery": "^1.0",
Expand All @@ -40,7 +39,10 @@
"Studio\\Totem\\": "src/",
"Studio\\Totem\\Tests\\": "tests/",
"Database\\Factories\\": "database/factories/"
}
},
"files": [
"src/helpers.php"
]
},
"extra": {
"component": "package",
Expand Down
29 changes: 17 additions & 12 deletions resources/views/tasks/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,29 @@
@section('title')
<div class="uk-flex uk-flex-between uk-flex-middle">
<h4 class="uk-card-title uk-margin-remove">Tasks</h4>
{!! Form::open([
'id' => 'totem__search__form',
'url' => Request::fullUrl(),
'method' => 'GET',
'class' => 'uk-display-inline uk-search uk-search-default'
]) !!}
<span uk-search-icon></span>
{!! Form::text('q', request('q'), ['class' => 'uk-search-input', 'placeholder' => 'Search...']) !!}
{!! Form::close() !!}
<form
accept-charset="UTF-8"
method="GET"
action="{{ request()->fullUrl() }}"
id="totem__search__form"
class="uk-display-inline uk-search uk-search-default">
<span uk-search-icon></span>
<input
value="{{ request('q') }}"
placeholder="Search..."
name="q"
type="text"
class="uk-search-input">
</form>
</div>
@stop
@section('main-panel-content')
<table class="uk-table uk-table-responsive" cellpadding="0" cellspacing="0" class="mb1">
<thead>
<tr>
<th>{!! Html::columnSort('Description', 'description') !!}</th>
<th>{!! Html::columnSort('Average Runtime', 'average_runtime') !!}</th>
<th>{!! Html::columnSort('Last Run', 'last_ran_at') !!}</th>
<th>{!! \Studio\Totem\Helpers\columnSort('Description', 'description') !!}</th>
<th>{!! \Studio\Totem\Helpers\columnSort('Average Runtime', 'average_runtime') !!}</th>
<th>{!! \Studio\Totem\Helpers\columnSort('Last Run', 'last_ran_at') !!}</th>
<th>Next Run</th>
<th class="uk-text-center">Execute</th>
</tr>
Expand Down
55 changes: 0 additions & 55 deletions src/Providers/TotemFormServiceProvider.php

This file was deleted.

1 change: 0 additions & 1 deletion src/Providers/TotemServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public function register()
$this->app->alias('totem.tasks', TaskInterface::class);
$this->app->register(TotemRouteServiceProvider::class);
$this->app->register(TotemEventServiceProvider::class);
$this->app->register(TotemFormServiceProvider::class);
$this->app->register(ConsoleServiceProvider::class);
}

Expand Down
45 changes: 45 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Studio\Totem\Helpers;

use Illuminate\Support\HtmlString;

function columnSort(string $label, string $columnKey, bool $isDefault = false)
{
$icon = '';

if (request()->has('sort_by')) {
if (request()->input('sort_by') == $columnKey) {
$icon = ' <span class="fa fa-caret-'
.(request()->input('sort_direction', 'asc') == 'asc' ? 'up' : 'down')
.'"></span>';
}
} elseif ($isDefault) {
$icon = ' <span class="fa fa-caret-'
.(request()->input('sort_direction', 'asc') == 'asc' ? 'up' : 'down')
.'"></span>';
}

$order = 'asc';
if (request()->has('sort_direction')) {
$order = (request()->input('sort_direction') == 'desc' ? 'asc' : 'desc');
} elseif ($isDefault) {
$order = 'desc';
}

$url = request()->fullUrlWithQuery([
'sort_by' => $columnKey,
'sort_direction' => $order,
'filter' => request('filter'),
'limit' => request('limit'),
]);

return new HtmlString(
'<a href="'
.$url
.'">'
.$label
.$icon
.'</a>'
);
}
16 changes: 2 additions & 14 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace Studio\Totem\Tests;

use Collective\Html\FormFacade;
use Collective\Html\HtmlFacade;
use Collective\Html\HtmlServiceProvider;
use Illuminate\Contracts\Debug\ExceptionHandler;
use Illuminate\Support\Facades\Auth;
use Orchestra\Testbench\Exceptions\Handler;
Expand Down Expand Up @@ -47,25 +44,16 @@ protected function getEnvironmentSetUp($app)
{
$app['config']->set('database.default', 'testing');
$app['config']->set('database.connections.testing', [
'driver' => 'sqlite',
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
'prefix' => '',
]);
}

protected function getPackageAliases($app)
{
return [
'Form' => FormFacade::class,
'Html' => HtmlFacade::class,
];
}

protected function getPackageProviders($app)
{
return [
TotemServiceProvider::class,
HtmlServiceProvider::class,
];
}

Expand Down
Loading