allow fallback + optional languages

This commit is contained in:
2020-07-20 12:02:02 +02:00
parent 3388a67bc8
commit e9b99d90ee
9 changed files with 123 additions and 17 deletions
@@ -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>