cleanup and annoying line endings.
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.WebApi;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Formatting;
|
||||
using Umbraco.Web.Trees;
|
||||
|
||||
namespace Umbraco.Web.Editors
|
||||
@@ -17,23 +14,23 @@ namespace Umbraco.Web.Editors
|
||||
public class SectionController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
public IEnumerable<Section> GetSections()
|
||||
{
|
||||
{
|
||||
|
||||
var sections = Services.SectionService.GetAllowedSections(Security.GetUserId());
|
||||
|
||||
var sectionModels = sections.Select(Mapper.Map<Core.Models.Section, Section>).ToArray();
|
||||
|
||||
//Check if there are empty dashboards or dashboards that will end up empty based on the current user's access
|
||||
//and add the meta data about them
|
||||
var dashboardHelper = new DashboardHelper(Services.SectionService);
|
||||
//this is a bit nasty since we'll be proxying via the app tree controller but we sort of have to do that
|
||||
//since tree's by nature are controllers and require request contextual data.
|
||||
var sectionModels = sections.Select(Mapper.Map<Core.Models.Section, Section>).ToArray();
|
||||
|
||||
//Check if there are empty dashboards or dashboards that will end up empty based on the current user's access
|
||||
//and add the meta data about them
|
||||
var dashboardHelper = new DashboardHelper(Services.SectionService);
|
||||
//this is a bit nasty since we'll be proxying via the app tree controller but we sort of have to do that
|
||||
//since tree's by nature are controllers and require request contextual data.
|
||||
var appTreeController = new ApplicationTreeController
|
||||
{
|
||||
ControllerContext = ControllerContext
|
||||
};
|
||||
var dashboards = dashboardHelper.GetDashboards(Security.CurrentUser);
|
||||
//now we can add metadata for each section so that the UI knows if there's actually anything at all to render for
|
||||
var dashboards = dashboardHelper.GetDashboards(Security.CurrentUser);
|
||||
//now we can add metadata for each section so that the UI knows if there's actually anything at all to render for
|
||||
//a dashboard for a given section, then the UI can deal with it accordingly (i.e. redirect to the first tree)
|
||||
foreach (var section in sectionModels)
|
||||
{
|
||||
@@ -49,11 +46,11 @@ namespace Umbraco.Web.Editors
|
||||
{
|
||||
//get the first tree in the section and get it's root node route path
|
||||
var sectionTrees = appTreeController.GetApplicationTrees(section.Alias, null, null).Result;
|
||||
section.RoutePath = sectionTrees.IsContainer == false
|
||||
? sectionTrees.RoutePath
|
||||
section.RoutePath = sectionTrees.IsContainer == false
|
||||
? sectionTrees.RoutePath
|
||||
: sectionTrees.Children[0].RoutePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sectionModels;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user