Skip to content

Commit ed70e4e

Browse files
committed
Naming duh
1 parent bbf64a9 commit ed70e4e

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

demo/app/Sharp/Authors/Commands/VisitFacebookProfileCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function buildCommandConfig(): void
2020

2121
public function execute(mixed $instanceId, array $data = []): array
2222
{
23-
return $this->link('https://facebook.com', targetBlank: true);
23+
return $this->link('https://facebook.com', openInNewTab: true);
2424
}
2525

2626
public function authorizeFor(mixed $instanceId): bool

docs/guide/commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Finally, let's review the return possibilities: after a Command has been execute
176176
- `return $this->refresh(mixed $ids)`*: refresh only instance(s) with an id in `$ids`, which can be either a single id or an array.
177177
- `return $this->view(string $bladeView, array $params = [])`: display a view right in Sharp; useful for page previews.
178178
- `return $this->html(string $htmlContent)`: display an HTML content.
179-
- `return $this->link(string $link, bool $targetBlank = false)`: redirect to the given path. The second argument, optional (default is `false`), is a boolean to open the link in a new tab.
179+
- `return $this->link(string $link, bool $openInNewTab = false)`: redirect to the given path. The second argument, optional (default is `false`), is a boolean to open the link in a new tab.
180180
- `return $this->download(string $filePath, ?string $fileName = null, ?string $diskName = null)`: the browser will download the specified file.
181181
- `return $this->streamDownload(string $fileContent, string $fileName)`: the browser will stream the specified file.
182182

src/Data/Commands/CommandResponseData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
// download & streamDownload actions returns the file directly in the response
1010
#[LiteralTypeScriptType(
11-
'{ action: "'.CommandAction::Link->value.'", link: string, targetBlank: boolean } | '.
11+
'{ action: "'.CommandAction::Link->value.'", link: string, openInNewTab: boolean } | '.
1212
'{ action: "'.CommandAction::Info->value.'", message: string, reload: boolean } | '.
1313
'{ action: "'.CommandAction::Refresh->value.'", items?: Array<{ [key: string]: any }> } | '.
1414
'{ action: "'.CommandAction::Reload->value.'" } | '.

src/EntityList/Commands/Command.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ protected function info(string $message, bool $reload = false): array
4444
];
4545
}
4646

47-
protected function link(string $link, bool $targetBlank = false): array
47+
protected function link(string $link, bool $openInNewTab = false): array
4848
{
4949
return [
5050
'action' => CommandAction::Link->value,
5151
'link' => $link,
52-
'targetBlank' => $targetBlank,
52+
'openInNewTab' => $openInNewTab,
5353
];
5454
}
5555

src/EntityList/Commands/EntityState.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function streamDownload(string $fileContent, string $fileName): array
4646
throw new SharpInvalidConfigException('StreamDownload return type is not supported for a state.');
4747
}
4848

49-
protected function link(string $link, bool $targetBlank = false): array
49+
protected function link(string $link, bool $openInNewTab = false): array
5050
{
5151
throw new SharpInvalidConfigException('Link return type is not supported for a state.');
5252
}

tests/Http/Api/Commands/ApiEntityListEntityCommandControllerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,11 @@ public function execute(array $data = []): array
238238
->assertJson([
239239
'action' => 'link',
240240
'link' => 'https://sharp.code16.fr',
241-
'targetBlank' => false,
241+
'openInNewTab' => false,
242242
]);
243243
});
244244

245-
it('allows to call an link + targetBlank entity command', function () {
245+
it('allows to call an link + openInNewTab entity command', function () {
246246
fakeListFor('person', new class() extends PersonList
247247
{
248248
protected function getEntityCommands(): ?array
@@ -257,7 +257,7 @@ public function label(): ?string
257257

258258
public function execute(array $data = []): array
259259
{
260-
return $this->link('https://sharp.code16.fr', targetBlank: true);
260+
return $this->link('https://sharp.code16.fr', openInNewTab: true);
261261
}
262262
},
263263
];
@@ -269,7 +269,7 @@ public function execute(array $data = []): array
269269
->assertJson([
270270
'action' => 'link',
271271
'link' => 'https://sharp.code16.fr',
272-
'targetBlank' => true,
272+
'openInNewTab' => true,
273273
]);
274274
});
275275

0 commit comments

Comments
 (0)