This repository has been archived by the owner on Nov 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mdpoulter
committed
Sep 7, 2019
0 parents
commit aa93087
Showing
16 changed files
with
11,389 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/.idea | ||
/vendor | ||
/node_modules | ||
package-lock.json | ||
composer.phar | ||
composer.lock | ||
phpunit.xml | ||
.phpunit.result.cache | ||
.DS_Store | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Laravel Nova Link Field | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
|
||
#### Index View | ||
![](github/index.png?raw=true) | ||
|
||
#### Edit View | ||
![](github/edit.png?raw=true) | ||
|
||
## Installation | ||
|
||
1. `composer require khalin/nova-link-field` | ||
|
||
## Usage | ||
|
||
1. Include the dependency `use Khalin\Nova\Fields\Link;` | ||
2. Add to the `Fields` array | ||
``` | ||
Link::make('Charge Id', 'stripe_id'), | ||
``` | ||
|
||
## Advanced usage | ||
|
||
### Edit link href: | ||
For this needs you can use `url()` function (accept `Callable` or `string`) | ||
|
||
Example: | ||
``` | ||
Link::make('Charge Id', 'stripe_id') | ||
->url(function () { | ||
return "https://dashboard.stripe.com/payments/{$this->stripe_id}"; | ||
}) | ||
``` | ||
|
||
### Set custom link text | ||
For this needs you can use `text()` function (accept `Callable` or `text`) | ||
|
||
Example: | ||
``` | ||
Link::make('Charge Id', 'stripe_id') | ||
->url(function () { | ||
return "https://dashboard.stripe.com/payments/{$this->stripe_id}"; | ||
}) | ||
->text("Go To Stripe") | ||
``` | ||
|
||
#### Open link in blank window | ||
For this needs you can use `blank()` function. | ||
|
||
Example: | ||
``` | ||
Link::make('Charge Id', 'stripe_id') | ||
->url(function () { | ||
return "https://dashboard.stripe.com/payments/{$this->stripe_id}"; | ||
}) | ||
->blank() | ||
``` | ||
|
||
#### Add additional classes to `<a>` | ||
For this needs you can use `classes()` function (accept `Callable` or `text`). | ||
|
||
Example: | ||
``` | ||
Link::make('Charge Id', 'stripe_id') | ||
->classes(function () { | ||
return null === $this->charge_id ? 'charge__pending' : "charge_successfull"; | ||
}) | ||
``` | ||
|
||
|
||
### TODO | ||
- [ ] Cover field with tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "simplesquid/nova-link-field", | ||
"version": "0.0.4", | ||
"license": "MIT", | ||
"description": "A Laravel Nova Link field. Fork of khalin/nova-link-field.", | ||
"keywords": [ | ||
"laravel", | ||
"nova", | ||
"field", | ||
"link" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Matthew Poulter", | ||
"email": "[email protected]", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": ">=7.1.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"SimpleSquid\\Nova\\Fields\\Link\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"SimpleSquid\\Nova\\Fields\\Link\\FieldServiceProvider" | ||
] | ||
} | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/*! | ||
* Copyright (c) 2019 Matthew Poulter. All rights reserved. | ||
*/ | ||
|
||
.table td span.link-field { | ||
display: block; | ||
} | ||
|
Oops, something went wrong.