allow fallback + optional languages
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using zero.Core.Api;
|
||||
using zero.Core.Entities;
|
||||
@@ -49,6 +51,25 @@ namespace zero.Web.Controllers
|
||||
public IActionResult GetSupportedCultures() => Json(Api.GetAllCultures(Options.SupportedLanguages));
|
||||
|
||||
|
||||
public async Task<IActionResult> GetForPicker() => Json((await Api.GetAll()).Select(x => new SelectModel()
|
||||
{
|
||||
Id = x.Id,
|
||||
Name = x.Name,
|
||||
IsActive = x.IsActive
|
||||
}));
|
||||
|
||||
|
||||
public async Task<IActionResult> GetPreviews(List<string> ids)
|
||||
{
|
||||
return JsonPreviews(await Api.GetByIds(ids.ToArray()), item => new PreviewModel()
|
||||
{
|
||||
Id = item.Id,
|
||||
Icon = "fth-globe",
|
||||
Name = item.Name
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Save language
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user