From b14f5f7fdf3517bec6f101608de724ec1a0abfd2 Mon Sep 17 00:00:00 2001 From: Aaron Ogle Date: Wed, 9 Jul 2014 13:29:44 -0400 Subject: [PATCH] Allow invisible places to be saved via the include_invisible options. --- src/place-form-view.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/place-form-view.js b/src/place-form-view.js index f70bc45..d2291e0 100644 --- a/src/place-form-view.js +++ b/src/place-form-view.js @@ -68,9 +68,17 @@ var Shareabouts = Shareabouts || {}; wait: true, // Explicitly set this. IE9 forgets sometimes. crossDomain: true, - beforeSend: function ($xhr) { + beforeSend: function ($xhr, options) { + var delim; // Add custom headers $xhr.setRequestHeader('X-Shareabouts-Silent', !!self.options.silent); + + // Add 'include_invisible' so that we can nicely save invisible places, + // but only if the user says it's okay via the options. + if (self.options.include_invisible) { + delim = options.url.indexOf('?') !== -1 ? '&' : '?'; + options.url = options.url + delim + 'include_invisible'; + } }, success: function(evt) { // Cool, now add it to the collection.