#3645 - removed viewmodel and uses ILanguage directly in the view

This commit is contained in:
Bjarke Berg
2019-01-30 07:49:45 +01:00
parent ae9141f9e7
commit cf0095dc1c
5 changed files with 8 additions and 20 deletions
@@ -47,12 +47,12 @@
<a href="" ng-click="updatePreviewDevice(device)"><i class="icon {{device.icon}}" title="{{device.title}}"></i><span></span></a>
</li>
@if (Model.PreviewLinks != null && Model.PreviewLinks.Count() > 2)
@if (Model.Languages != null && Model.Languages.Count() > 2)
{
foreach (var previewLink in Model.PreviewLinks)
foreach (var previewLink in Model.Languages)
{
<li>
<a href="" ng-click="changeCulture('@previewLink.CultureId')" title="Preview in @previewLink.CultureName"><i class="icon icon-globe-europe---africa"></i><span>@previewLink.CultureName</span></a>
<a href="" ng-click="changeCulture('@previewLink.IsoCode')" title="Preview in @previewLink.CultureName"><i class="icon icon-globe-europe---africa"></i><span>@previewLink.CultureName</span></a>
</li>
}
}
@@ -1,8 +0,0 @@
namespace Umbraco.Web.Editors
{
public class BackOfficePreviewLinkModel
{
public string CultureName { get; set; }
public string CultureId { get; set; }
}
}
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using Umbraco.Core.Configuration;
using Umbraco.Core.Models;
using Umbraco.Web.Features;
namespace Umbraco.Web.Editors
@@ -7,12 +8,12 @@ namespace Umbraco.Web.Editors
public class BackOfficePreviewModel : BackOfficeModel
{
private readonly UmbracoFeatures _features;
public IEnumerable<BackOfficePreviewLinkModel> PreviewLinks { get; }
public IEnumerable<ILanguage> Languages { get; }
public BackOfficePreviewModel(UmbracoFeatures features, IGlobalSettings globalSettings, IEnumerable<BackOfficePreviewLinkModel> previewLinks) : base(features, globalSettings)
public BackOfficePreviewModel(UmbracoFeatures features, IGlobalSettings globalSettings, IEnumerable<ILanguage> languages) : base(features, globalSettings)
{
_features = features;
PreviewLinks = previewLinks;
Languages = languages;
}
public bool DisableDevicePreview => _features.Disabled.DisableDevicePreview;
+1 -5
View File
@@ -44,12 +44,8 @@ namespace Umbraco.Web.Editors
public ActionResult Index()
{
var availableLanguages = _localizationService.GetAllLanguages();
var previewLinks = availableLanguages.Select(x => new BackOfficePreviewLinkModel() {
CultureName = x.CultureName,
CultureId = x.IsoCode}
);
var model = new BackOfficePreviewModel(_features, _globalSettings, previewLinks);
var model = new BackOfficePreviewModel(_features, _globalSettings, availableLanguages);
if (model.PreviewExtendedHeaderView.IsNullOrWhiteSpace() == false)
{
-1
View File
@@ -138,7 +138,6 @@
<Compile Include="Editors\PackageController.cs" />
<Compile Include="Editors\KeepAliveController.cs" />
<Compile Include="Editors\MacrosController.cs" />
<Compile Include="Editors\BackOfficePreviewLinkModel.cs" />
<Compile Include="Editors\RelationTypeController.cs" />
<Compile Include="Logging\WebProfiler.cs" />
<Compile Include="Logging\WebProfilerComponent.cs" />