-
Notifications
You must be signed in to change notification settings - Fork 985
Adding new tokens from the tokenInput interface. #237
base: master
Are you sure you want to change the base?
Conversation
…stead of GET on the backend script. there is also a config var allowAddToken which enables/disables this new functionality. it is set to false by default so as not to break existing implementations of this plugin.
… 404 error is encountered.
if you prefer to use POST for all communications rather than a combination of GET and POST, you'll need two separate endpoints. addTokenURL overrides the assumption that the same URL endpoint will be used for both actions.
add token paths can now be customized down to the URL and method, letting devs choose which HTTP method they want for both the search query and the add token query
why are the changes so big? the diff shows a lot of changes in the readme, and also for example moving DEFAULT_CLASSES from one place to another, and incorrect indents. |
those last commits included some unnecessary changes, which have been fixed so the new pull request is more compatible with the existing master branch. thanks @azinazadi for pointing those out.
@azinazadi not sure why the diff shows that i changed the entire readme, i definitely didn't. i only added some settings to the one section. but regardless, i moved DEFAULT_CLASSES back where it should be and fixed a couple other mistakes. should be ready to go! |
yes. may be it was just some white spaces. cool |
@tubbo It would be great if you could please provide some example on this. the .die('click') does not seems to get called. |
@alagunambi is it erroring? if it's not getting called, that would indicate to me that a click event wasn't bound on the element, and therefore a die() doesn't need to happen. what's the exact problem you're experiencing? the only live examples up right now are private, as this was developed for an in-house CMS. but i could probably gist something quickly tomorrow morning... |
Tokens can now be added to the database from within tokenInput. To enable this feature, simply set
addTokenAllow: true
and create a POST action in your endpoint for REST compatibility. Otherwise, you can useaddTokenURL
to specify the URL that you want to hit when a user wants to add their newly-created token to the database. If you already use POST for your search query action, you can specify another HTTP method like GET or PUT in its place.We have deployed this modified version of jquery.tokeninput on a number of live production servers, and it works great. We think it would make a great addition to the plugin!