Comments (5)
You can use two buttons and ->visible($this->is_favorited)
You can also store svg icons and render as first param I believe
And maybe ->reload()
to show the other button automatically
Or ->successText($icon)
to avoid the reload maybe.
Haven't tried this, just speculating. Hope this helps!
$favoriteSvg = view()->make('svg.favorite')->render();
$unfavoriteSvg = view()->make('svg.unfavorite')->render();
Button::make($favoriteSvg, 'favorite_toggle')
->visible($this->is_favorited == false)
->reload(),
Button::make($unfavoriteSvg, 'favorite_toggle')
->visible($this->is_favorited)
->reload(),
Then you'd make a event / listener that attaches / detaches favorites
from nova-button.
Thanks @dillingham. I'll try it π
from nova-button.
Seems like it works but when successText is rendered , the new button has not a registered event, so I can't trigger again the toggle event.
I don't want to use reload because I want to toggle some of them at the same time.
Is there any chance to register again the event when successText is called?
Thanks in advance
from nova-button.
No not currently. That would require a new feature. Something like a toggle method with two passed events to switch between. Iβm open to a PR but donβt have time to do that myself. Your other option is to fork this or use it as inspiration for your own custom field. Good luck!
from nova-button.
Thanks @dillingham for the info!
I'll see what I'll do.
P.S: Do you know how can I edit a nova Vue component? I'm really newbie in Laravel and of course in Nova and I don't know how can I edit the resource table row for example. I don't know which file I have to look into nor edit, etc.
Thanks in advance
from nova-button.
Related Issues (20)
- For anyone seeking NOVA4 support
- Capturing User ID in the Event? HOT 1
- Button State - How to succeed or fail? HOT 1
- Button not showing on index with nova-mega-filter in use HOT 1
- Allow to set title attribute to the button to show tooltip HOT 2
- Display the Button on Create and Update forms HOT 10
- How to customize button text based on record value
- Details when the link has Name-Name
- Error on Safari
- Button not showing on index or detail
- Create link in resource table row HOT 2
- hi, can you plz delete this pull r HOT 1
- Using buttons in relationship fields that reference the parent HOT 1
- Confirm does not show dialogue box HOT 12
- Button on resource with custom indexQuery with grouped results failed HOT 1
- Programmatically disable button state
- Maintainer
- Left Align button needs to be reiterated carefully
- Feature to add column heading
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nova-button.