#3417 retreive a list with parameter editors from API
This commit is contained in:
@@ -94,6 +94,13 @@ function macroResource($q, $http, umbRequestHelper) {
|
||||
$http.get(umbRequestHelper.getApiUrl("macroApiBaseUrl", "GetPartialViews"),
|
||||
"Failed to get partial views")
|
||||
);
|
||||
},
|
||||
|
||||
getParameterEditors: function () {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(umbRequestHelper.getApiUrl("macroApiBaseUrl", "GetParameterEditors"),
|
||||
"Failed to get parameter editors")
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</umb-control-group>
|
||||
|
||||
<umb-control-group label="Editor" description="">
|
||||
<select class="input-block-level" ng-model="model.parameter.editor" ng-options="i as i for i in model.editors"></select>
|
||||
<select class="input-block-level" ng-model="model.parameter.editor" ng-options="i.alias as (i.name) for i in model.editors"></select>
|
||||
</umb-control-group>
|
||||
|
||||
|
||||
|
||||
@@ -71,10 +71,23 @@ function MacrosEditController($scope, $q, $routeParams, macroResource, editorSta
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function getParameterEditors() {
|
||||
var deferred = $q.defer();
|
||||
|
||||
macroResource.getParameterEditors().then(function (data) {
|
||||
deferred.resolve(data);
|
||||
}, function () {
|
||||
deferred.reject();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function init() {
|
||||
vm.page.loading = true;
|
||||
|
||||
vm.promises['partialViews'] = getPartialViews();
|
||||
vm.promises['parameterEditors'] = getParameterEditors();
|
||||
|
||||
$q.all(vm.promises).then(function (values) {
|
||||
var keys = Object.keys(values);
|
||||
@@ -85,6 +98,10 @@ function MacrosEditController($scope, $q, $routeParams, macroResource, editorSta
|
||||
if (keys[i] === 'partialViews') {
|
||||
vm.views = values[key];
|
||||
}
|
||||
|
||||
if (keys[i] === 'parameterEditors') {
|
||||
vm.parameterEditors = values[key];
|
||||
}
|
||||
}
|
||||
|
||||
vm.page.loading = false;
|
||||
@@ -130,9 +147,7 @@ function MacrosEditController($scope, $q, $routeParams, macroResource, editorSta
|
||||
"editor": "Link picker"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
vm.parameterEditors = ['editor', 'Link picker', 'Image picker'];
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace Umbraco.Web.Editors
|
||||
using System.Linq;
|
||||
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Web.Composing;
|
||||
|
||||
/// <summary>
|
||||
/// The API controller used for editing dictionary items
|
||||
@@ -82,6 +83,17 @@ namespace Umbraco.Web.Editors
|
||||
return this.Request.CreateResponse(HttpStatusCode.OK, views);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the available parameter editors
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The <see cref="HttpResponseMessage"/>.
|
||||
/// </returns>
|
||||
public HttpResponseMessage GetParameterEditors()
|
||||
{
|
||||
return this.Request.CreateResponse(HttpStatusCode.OK, Current.ParameterEditors);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds all the macro partials
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user