1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-21 13:41:37 +00:00

Fix string list parameters

This commit is contained in:
jendib
2013-08-01 23:32:55 +02:00
parent 0f75faeccc
commit 19db8f2445
5 changed files with 10 additions and 9 deletions

View File

@@ -107,6 +107,7 @@ var App = angular.module('docs', ['ui.state', 'ui.bootstrap', 'ui.route', 'ui.ke
// Configuring $http
$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
$httpProvider.defaults.headers.put['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
$httpProvider.defaults.transformRequest = [function(data) {
var param = function(obj) {
var query = '';
@@ -118,7 +119,7 @@ var App = angular.module('docs', ['ui.state', 'ui.bootstrap', 'ui.route', 'ui.ke
if(value instanceof Array) {
for(i=0; i<value.length; ++i) {
subValue = value[i];
fullSubName = name + '[]';
fullSubName = name;
innerObj = {};
innerObj[fullSubName] = subValue;
query += param(innerObj) + '&';

View File

@@ -40,7 +40,7 @@ App.controller('Document', function($scope, $state, Restangular) {
search: $scope.search.query,
create_date_min: $scope.isAdvancedSearchCollapsed || !$scope.search.createDateMin ? null : $scope.search.createDateMin.getTime(),
create_date_max: $scope.isAdvancedSearchCollapsed || !$scope.search.createDateMax ? null : $scope.search.createDateMax.getTime(),
'tags[]': $scope.isAdvancedSearchCollapsed ? null : _.pluck($scope.search.tags, 'id')
'tags': $scope.isAdvancedSearchCollapsed ? null : _.pluck($scope.search.tags, 'id')
})
.then(function(data) {
$scope.documents = data.documents;

View File

@@ -45,7 +45,7 @@ App.controller('DocumentEdit', function($scope, $q, $http, $state, $stateParams,
}
// Extract ids from tags
document['tags[]'] = _.pluck(document.tags, 'id');
document.tags = _.pluck(document.tags, 'id');
if ($scope.isEdit()) {
promise = Restangular