Ejemplo n.º 1
0
        public override void ExpandView(MixCmsContext _context = null, IDbContextTransaction _transaction = null)
        {
            Cultures = Helper.LoadCultures(Id, Specificulture, _context, _transaction);
            if (!string.IsNullOrEmpty(this.Tags))
            {
                ListTag = JArray.Parse(this.Tags);
            }

            // Load page views
            this.Templates = this.Templates ?? MixTemplates.UpdateViewModel.Repository.GetModelListBy(
                t => t.Theme.Id == ActivedTheme && t.FolderType == this.TemplateFolderType, _context, _transaction).Data;
            var templateName = Template?.Split('/')[1] ?? MixConstants.DefaultTemplate.Page;

            this.View     = Templates.First(t => !string.IsNullOrEmpty(templateName) && templateName.Equals($"{t.FileName}{t.Extension}"));
            this.Template = CommonHelper.GetFullPath(new string[]
            {
                this.View?.FileFolder
                , this.View?.FileName
            });
            // Load Attributes
            LoadAttributes(_context, _transaction);
            // Load master views
            this.Masters = this.Masters ?? MixTemplates.UpdateViewModel.Repository.GetModelListBy(
                t => t.Theme.Id == ActivedTheme && t.FolderType == MixEnums.EnumTemplateFolder.Masters.ToString(), _context, _transaction).Data;
            var masterName = Layout?.Split('/')[1] ?? MixConstants.DefaultTemplate.Master;

            this.Master = Masters.First(t => !string.IsNullOrEmpty(masterName) && masterName.Equals($"{t.FileName}"));
            this.Layout = $"{this.Master?.FileFolder}/{this.Master?.FileName}";

            this.ModuleNavs = GetModuleNavs(_context, _transaction);
            this.ParentNavs = GetParentNavs(_context, _transaction);
            //this.ChildNavs = GetChildNavs(_context, _transaction);
            this.UrlAliases = GetAliases(_context, _transaction);
        }