Skip to content

Added new "Triggers" button type - #11

Merged
Nav33d merged 2 commits into
verbb:developfrom
lindseydiloreto:develop
Feb 27, 2017
Merged

Added new "Triggers" button type#11
Nav33d merged 2 commits into
verbb:developfrom
lindseydiloreto:develop

Conversation

@lindseydiloreto

@lindseydiloreto lindseydiloreto commented Jul 3, 2016

Copy link
Copy Markdown
Contributor

This PR adds a new type of button: Triggers

Instead of being a "radio button in disguise", a trigger acts more like an actual button. As in, you click it and something immediately happens.

There are two types of triggers... "Link" and "JavaScript".

  • A link trigger is a straightforward link. Enter the URL of the page you would like to be taken to. You can optionally have the link open in a new window.
  • A JavaScript trigger will run whatever JS you specify. Generally speaking, it'll make sense to simply call a function, which would enact more complex behavior.

Button Box is awesome, I hope you find this PR useful! Please let me know if you have any questions. :)

@lindseydiloreto

Copy link
Copy Markdown
Contributor Author

Here's a practical example...

settings-example

For the JavaScript trigger, emailCustomer would be a custom user function, which could trigger anything they want. That JS function would have to be included separately, but it could be as simple or complex as they need. It could even trigger a controller action... the possibilities are nearly endless!

@lindseydiloreto

Copy link
Copy Markdown
Contributor Author

Just added the ability to parse element tags in links.

EXAMPLES:

A link to view the "notes" of this entry on the front-end...

{url}#notes

JS to send an email about this entry...

sendEntryMessage({id});

In the examples above, {url} and {id} will be parsed from the current element. And just like dynamic entry titles, any element field handle can be used.

@joshangell

Copy link
Copy Markdown

I will merge this soon, I promise! Just fighting the tide of client work ...

@lindseydiloreto

Copy link
Copy Markdown
Contributor Author

Lol, sounds good. :)

@lindseydiloreto

Copy link
Copy Markdown
Contributor Author

Hi Josh! I don't suppose you've had a chance to look at this yet?

@joshangell

Copy link
Copy Markdown

Hey Lindsey, sorry I didn’t have time in the end - I’ve passed this over to @Nav33d who is taking over maintenance of this project. I don’t see any reason why it can’t just be merged, but it probably makes sense to test it out first.

@lindseydiloreto

Copy link
Copy Markdown
Contributor Author

Thanks @joshangell!

Hi @Nav33d! Would you mind taking a look at this PR? I've found this feature to be extremely helpful, and it works beautifully within the larger context of the Button Box plugin.

Please let me know if you have any questions! :)

@Nav33d
Nav33d merged commit 8e3b3ae into verbb:develop Feb 27, 2017
@Nav33d

Nav33d commented Feb 27, 2017

Copy link
Copy Markdown
Contributor

Hi @lindseydiloreto,

Apologies for the delayed reply! I have now merged the pull request.

Many thanks

@lindseydiloreto

lindseydiloreto commented Feb 27, 2017

Copy link
Copy Markdown
Contributor Author

Fantastic, thanks @Nav33d!

Would you mind mentioning the Trigger type in the README and/or docs? There are some examples at the top of this thread which you could use on the site.

Let me know if you need anything else from me! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants