Browse Source

Fix parameters being encoded by default in tab, add encodeParameters setting to API #2752

pull/2755/merge
Jack Lukic 9 years ago
parent
commit
1cac8a53f9
3 changed files with 16 additions and 8 deletions
  1. 1
      RELEASE-NOTES.md
  2. 14
      src/definitions/behaviors/api.js
  3. 9
      src/definitions/modules/tab.js

1
RELEASE-NOTES.md

@ -10,6 +10,7 @@
- **Button** - Added `labeled button` variation for display a count next to a button.
- **Divider** - Vertical divider can now be used multiple times in a single column row (not just 50/50 split). #2808
- **Input** - Added `disabled` state for inputs #2694
- **API** - Added `encodeParameters` option to enable/disable parameters being encoded with `encodeURIComponent` #2752
**Additional Enhancements**
- **Menu** - `text menu` now uses padding for hitboxes to make target area for links larger

14
src/definitions/behaviors/api.js

@ -109,7 +109,7 @@ $.api = $.fn.api = function(parameters) {
;
}
else if(settings.on == 'now') {
module.debug('Querying API now', triggerEvent);
module.debug('Querying API endpoint immediately');
module.query();
}
}
@ -358,7 +358,11 @@ $.api = $.fn.api = function(parameters) {
}
else {
module.verbose('Found required variable', variable, value);
url = url.replace(templatedString, module.get.urlEncodedValue(value));
value = (settings.encodeParameters)
? module.get.urlEncodedValue(value)
: value
;
url = url.replace(templatedString, value);
}
});
}
@ -724,7 +728,7 @@ $.api = $.fn.api = function(parameters) {
module.debug('URL value is already encoded, avoiding double encoding', value);
return value;
}
module.verbose('Encoding value for url', value, encodedValue);
module.verbose('Encoding value using encodeURIComponent', value, encodedValue);
return encodedValue;
},
defaultData: function() {
@ -990,7 +994,7 @@ $.api.settings = {
name : 'API',
namespace : 'api',
debug : true,
debug : false,
verbose : false,
performance : true,
@ -1015,6 +1019,8 @@ $.api.settings = {
// duration for error state
errorDuration : 2000,
encodeParameters : true,
// API action to use
action : false,

9
src/definitions/modules/tab.js

@ -440,10 +440,11 @@ $.fn.tab = function(parameters) {
var
$tab = module.get.tabElement(tabPath),
apiSettings = {
dataType : 'html',
on : 'now',
cache : settings.alwaysRefresh,
headers : {
dataType : 'html',
encodeParameters : false,
on : 'now',
cache : settings.alwaysRefresh,
headers : {
'X-Remote': true
},
onSuccess : function(response) {

Loading…
Cancel
Save