Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Working with links and pop-ups for an plugin
timme2707
New
Because I'm not allowed to post in Developing, I using this category.
I'm currently developing a plugin, to reservate resources (por example an car), for vanilla and I got a few questions. The plugins appears in a new page (works good) and prints an simple html table (currently reservated resources).
How does the pop up work for activity/discussion deletion? I want to use this also for delete a row via link. Looked already in the discussion model and found the function that deletes the db entry and also found the link generation, but nothing about the pop up.
// Are you sure? YesNoI want to open a detailed information page inside a pop up, is this possible not to complicated?
- Generally, how does it work to trigger a function via a link with the garden framework? Like the bookmark link.
Thanks everyone for helping me.
1
Comments
Not exactly sure what you are looking for (vielleicht kannst du es ja für mich auch kurz mal in Deutsch schreiben), but if you want a confirmation dialog, you do it like that:
The "PopConfirm" class is the magic that triggers the confirmation dialogue.
You need to have a method in your plugin which is doing the deletion and it should end with:
You should always check for the correct TransientKey to prevent click jacking
This is exactly that what I need. Thanks!
(Zu 3. : Wie trigger ich die diese Methode zum löschen, bzw. wo definiere ich welche aufgerufen werden soll?)
In deinem Plugin muss eine solche "delete" Methode implementiert werden. Hier mal ein Code Schnippsel aus einem Plugin, dass ich hier nicht hochgeladen habe:
In dem View dazu ist dieser Code:
<?= anchor(t('Delete'), $link.'/delete/'.$row[$primaryKey].'&tk='.$transientKey, ['class' => 'Button SmallButton Danger PopConfirm']) ?>
Falls du dein Plugin in einem öffentlichen Repository hast, kann ich gerne mal drüber gucken. Ansonsten kannst du aber auch einfach hier Code einstellen (oberhalb und unterhalb eines Code Blocks musst du jeweils eine Zeile mit drei Tilden
~~~
setzen, damit der Code richtig formatiert ausgegeben wird.There must be such a "delete" method implement in the plugin like the one below. It is a code snippet from a Plugin that I haven't uploaded here:
The accompanying view has the following code:
<?= anchor(t('Delete'), $link.'/delete/'.$row[$primaryKey].'&tk='.$transientKey, ['class' => 'Button SmallButton Danger PopConfirm']) ?>
If you've got your plugin in a public repository, I'll be happy to take a look at it. But you could also paste it here, if you like to (enclose the code with three tildes in a single line above and below in order to get properly formatted code)
For the sake of non German speakers who may want to learn from this, can we get a translation bitte?
Sorry, I was even thinking about answering completely in English but then have been too lazy and only chose German.
It's tempting being able to write in German. @rbrahmson: I've edited the comment above.
Danke R_J, I appreciate that. The subject of this discussion intrigued me because of my previous inqueries into popups.
@timme2707 - sure would be nice to see your plugin.
Happy Holidays!
Happy new year and Dankeschön!
I'll try it out and later put them here.