Skip to content

Commit

Permalink
fix ga
Browse files Browse the repository at this point in the history
  • Loading branch information
danharrin committed Mar 13, 2021
1 parent 6498adc commit 24a422f
Show file tree
Hide file tree
Showing 24 changed files with 899 additions and 473 deletions.
2 changes: 1 addition & 1 deletion resources/lang/ca/pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
'results' => 'resultats.',
],

];
];
2 changes: 1 addition & 1 deletion resources/lang/ca/table.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@
'placeholder' => 'Cerca',
],

];
];
4 changes: 2 additions & 2 deletions resources/views/cells/icon.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@php
$iconToShow = null;
foreach ($column->options as $icon => $callback) {
foreach ($column->getOptions() as $icon => $callback) {
if (! $callback($column->getValue($record))) {
continue;
}
Expand All @@ -23,7 +23,7 @@
@elseif ($column->getUrl($record) !== null)
<a
href="{{ $column->getUrl($record) }}"
@if ($column->shouldOpenUrlInNewTab)
@if ($column->shouldOpenUrlInNewTab())
target="_blank"
rel="noopener noreferrer"
@endif
Expand Down
8 changes: 4 additions & 4 deletions resources/views/cells/image.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
>
<img
src="{{ $column->getPath($record) }}"
class="{{ $column->rounded ? 'rounded-full' : null }}"
class="{{ $column->isRounded() ? 'rounded-full' : null }}"
style="
{!! $column->getHeight() !== null ? "height: {$column->getHeight()};" : null !!}
{!! $column->getWidth() !== null ? "width: {$column->getWidth()};" : null !!}
Expand All @@ -15,14 +15,14 @@ class="{{ $column->rounded ? 'rounded-full' : null }}"
@elseif ($column->getUrl($record) !== null)
<a
href="{{ $column->getUrl($record) }}"
@if ($column->shouldOpenUrlInNewTab)
@if ($column->shouldOpenUrlInNewTab())
target="_blank"
rel="noopener noreferrer"
@endif
>
<img
src="{{ $column->getPath($record) }}"
class="{{ $column->rounded ? 'rounded-full' : null }}"
class="{{ $column->isRounded() ? 'rounded-full' : null }}"
style="
{!! $column->getHeight() !== null ? "height: {$column->getHeight()};" : null !!}
{!! $column->getWidth() !== null ? "width: {$column->getWidth()};" : null !!}
Expand All @@ -32,7 +32,7 @@ class="{{ $column->rounded ? 'rounded-full' : null }}"
@else
<img
src="{{ $column->getPath($record) }}"
class="{{ $column->rounded ? 'rounded-full' : null }}"
class="{{ $column->isRounded() ? 'rounded-full' : null }}"
style="
{!! $column->getHeight() !== null ? "height: {$column->getHeight()};" : null !!}
{!! $column->getWidth() !== null ? "width: {$column->getWidth()};" : null !!}
Expand Down
4 changes: 2 additions & 2 deletions resources/views/cells/text.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@php
$primaryClasses = $column->primary ? 'font-medium' : null;
$primaryClasses = $column->isPrimary() ? 'font-medium' : null;
@endphp

<div class="py-4">
Expand All @@ -15,7 +15,7 @@ class="{{ $primaryClasses }} hover:underline hover:text-primary-600 transition-c
<a
href="{{ $column->getUrl($record) }}"
class="{{ $primaryClasses }} hover:underline hover:text-primary-600 transition-colors duration-200"
@if ($column->shouldOpenUrlInNewTab)
@if ($column->shouldOpenUrlInNewTab())
target="_blank"
rel="noopener noreferrer"
@endif
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/filter.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<option>{{ __('tables::table.filter.placeholder') }}</option>

@foreach ($table->getVisibleFilters() as $filter)
<option value="{{ $filter->name }}">{{ __($filter->label) }}</option>
<option value="{{ $filter->getName() }}">{{ __($filter->getLabel()) }}</option>
@endforeach
</select>
@endif
Expand Down
11 changes: 6 additions & 5 deletions resources/views/components/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ class="border-gray-300 rounded shadow-sm text-primary-600 focus:border-primary-6
<th class="px-6 py-3 text-left text-gray-600" scope="col">
@if ($table->isSortable() && $column->isSortable())
<button
wire:click="sortBy('{{ $column->name }}')"
wire:click="sortBy('{{ $column->getName() }}')"
type="button"
class="flex items-center space-x-1 text-xs font-medium tracking-wider text-left uppercase group focus:outline-none focus:underline"
>
<span>{{ __($column->label) }}</span>
<span>{{ __($column->getLabel()) }}</span>

<span class="relative flex items-center">
@if ($sortColumn === $column->name)
@if ($sortColumn === $column->getName())
<span>
@if ($sortDirection === 'asc')
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>
Expand All @@ -44,7 +44,7 @@ class="flex items-center space-x-1 text-xs font-medium tracking-wider text-left
</span>
</button>
@else
<span class="text-xs font-medium tracking-wider uppercase">{{ __($column->label) }}</span>
<span class="text-xs font-medium tracking-wider uppercase">{{ __($column->getLabel()) }}</span>
@endif
</th>
@endforeach
Expand All @@ -56,6 +56,7 @@ class="flex items-center space-x-1 text-xs font-medium tracking-wider text-left
<tbody class="text-sm leading-tight divide-y divide-gray-200">
@forelse ($records as $record)
<tr
wire:key="{{ $record->getKey() }}"
wire:loading.class="opacity-50"
class="{{ $loop->index % 2 ? 'bg-gray-50' : null }}"
>
Expand All @@ -75,7 +76,7 @@ class="border-gray-300 rounded shadow-sm text-primary-600 focus:border-primary-6
@endforeach

<td class="px-6 py-4 text-right whitespace-nowrap">
@foreach ($table->recordActions as $recordAction)
@foreach ($table->getRecordActions() as $recordAction)
{{ $recordAction->render($record) }}
@endforeach
</td>
Expand Down
28 changes: 28 additions & 0 deletions resources/views/record-actions/icon.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@if ($action = $recordAction->getAction($record))
<button
wire:click="{{ $action }}('{{ $record->getKey() }}')"
{!! $recordAction->getTitle() ? 'title="' . __($recordAction->getTitle()) . '"' : null !!}
type="button"
class="font-medium transition-colors duration-200 text-primary-600 hover:text-primary-700"
>
<x-dynamic-component :component="$recordAction->getIcon()" class="w-4 h-4 inline" />
</button>
@elseif ($url = $recordAction->getUrl($record))
<a
href="{{ $url }}"
{!! $recordAction->getTitle() ? 'title="' . __($recordAction->getTitle()) . '"' : null !!}
@if ($recordAction->shouldOpenUrlInNewTab())
target="_blank"
rel="noopener noreferrer"
@endif
class="font-medium transition-colors duration-200 text-primary-600 hover:text-primary-700"
>
<x-dynamic-component :component="$recordAction->getIcon()" class="w-4 h-4 inline" />
</a>
@else
<span
class="inline-flex items-center font-medium text-primary-600"
>
<x-dynamic-component :component="$recordAction->getIcon()" class="w-4 h-4 inline" />
</span>
@endif
42 changes: 30 additions & 12 deletions resources/views/record-actions/link.blade.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
@if ($recordAction->action)
@if ($action = $recordAction->getAction($record))
<button
wire:click="{{ $recordAction->action }}('{{ $record->getKey() }}')"
wire:click="{{ $action }}('{{ $record->getKey() }}')"
{!! $recordAction->getTitle() ? 'title="' . __($recordAction->getTitle()) . '"' : null !!}
type="button"
class="font-medium transition-colors duration-200 text-primary-600 hover:underline hover:text-primary-700"
class="inline-flex items-center font-medium transition-colors duration-200 text-primary-600 hover:underline hover:text-primary-700"
>
{{ __($recordAction->label) }}
@if ($recordAction->hasIcon())
<x-dynamic-component :component="$recordAction->getIcon()" class="w-4 h-4 mr-1 inline" />
@endif

{{ __($recordAction->getLabel()) }}
</button>
@elseif ($recordAction->url)
@elseif ($url = $recordAction->getUrl($record))
<a
href="{{ $recordAction->getUrl($record) }}"
class="font-medium transition-colors duration-200 text-primary-600 hover:underline hover:text-primary-700"
@if ($recordAction->shouldOpenUrlInNewTab)
target="_blank"
rel="noopener noreferrer"
href="{{ $url }}"
{!! $recordAction->getTitle() ? 'title="' . __($recordAction->getTitle()) . '"' : null !!}
@if ($recordAction->shouldOpenUrlInNewTab())
target="_blank"
rel="noopener noreferrer"
@endif
class="inline-flex items-center font-medium transition-colors duration-200 text-primary-600 hover:underline hover:text-primary-700"
>
{{ __($recordAction->label) }}
@if ($recordAction->hasIcon())
<x-dynamic-component :component="$recordAction->getIcon()" class="w-4 h-4 mr-1 inline" />
@endif

{{ __($recordAction->getLabel()) }}
</a>
@else
<span>{{ __($recordAction->label) }}</span>
<span
class="inline-flex items-center font-medium text-primary-600"
>
@if ($recordAction->hasIcon())
<x-dynamic-component :component="$recordAction->getIcon()" class="w-4 h-4 mr-1 inline" />
@endif

{{ __($recordAction->getLabel()) }}
</span>
@endif
30 changes: 22 additions & 8 deletions src/Columns/Boolean.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,46 @@

class Boolean extends Icon
{
public $falseIcon = 'heroicon-o-x-circle';
protected $falseIcon = 'heroicon-o-x-circle';

public $trueIcon = 'heroicon-s-check-circle';
protected $trueIcon = 'heroicon-s-check-circle';

protected function setUp()
{
$this->options([
$this->falseIcon => fn ($value) => ! $value,
$this->trueIcon => fn ($value) => $value,
$this->getFalseIcon() => fn ($value) => ! $value,
$this->getTrueIcon() => fn ($value) => $value,
]);
}

public function falseIcon($icon)
{
$this->falseIcon = $icon;
$this->configure(function () use ($icon) {
$this->falseIcon = $icon;

$this->setUp();
$this->setUp();
});

return $this;
}

public function getFalseIcon()
{
return $this->falseIcon;
}

public function getTrueIcon()
{
return $this->trueIcon;
}

public function trueIcon($icon)
{
$this->trueIcon = $icon;
$this->configure(function () use ($icon) {
$this->trueIcon = $icon;

$this->setUp();
$this->setUp();
});

return $this;
}
Expand Down
Loading

0 comments on commit 24a422f

Please sign in to comment.