Exemple #1
0
        public override IHtmlString RenderItemColumn(System.Web.Mvc.ViewContext viewContext)
        {
            var inheritableData = DataItem as IInheritable;

            if (inheritableData != null && !inheritableData.IsLocalized(Site.Current))
            {
                var page = inheritableData as Page;

                if (page != null)
                {
                    if (page.Parent != null && page.Parent.IsLocalized(Site.Current))
                    {
                        return(new HtmlString("Unsynced".Localize()));
                    }
                }
                return(new HtmlString("Inherited".Localize()));
            }
            return(new HtmlString("-"));
        }
Exemple #2
0
 public CsJsViewContext(System.Web.Mvc.ViewContext viewContext)
 {
     _viewContext = viewContext;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GridColumnFilterableCellSettings"/> class.
 /// </summary>
 /// <param name="settings">The settings.</param>
 public GridColumnFilterableCellSettingsBuilder(GridColumnFilterableCellSettings settings, System.Web.Mvc.ViewContext viewContext, IUrlGenerator urlGenerator)
 {
     this.viewContext = viewContext;
     this.urlGenerator = urlGenerator;
     this.settings = settings;
 }
        string GetContentAsGrid(Node nMail)
        {
            string gridHTML = null;
            // Try as grid
            var pc = Umbraco.Web.UmbracoContext.Current?.ContentCache?.GetById(nMail.Id);
            string alias = EnmUmbracoPropertyAlias.body.ToString();
            if (pc != null)
            {
                var p = pc.GetProperty(alias);
                if (p == null)
                    return null;
                var model = p.Value;
                if (model == null)
                    return null;
                var cc = new System.Web.Mvc.ControllerContext
                {
                    RequestContext = Umbraco.Web.UmbracoContext.Current.HttpContext.Request.RequestContext
                };

                var viewContext = new System.Web.Mvc.ViewContext(cc, new FakeView(), new System.Web.Mvc.ViewDataDictionary(model), new System.Web.Mvc.TempDataDictionary(), new StringWriter());
                if (!viewContext.RouteData.Values.ContainsKey("controller"))
                    viewContext.RouteData.Values.Add("controller", "cheese");

                var htmlHelper = new System.Web.Mvc.HtmlHelper(viewContext, new System.Web.Mvc.ViewPage());
                gridHTML = Umbraco.Web.GridTemplateExtensions.GetGridHtml(htmlHelper, pc, alias).ToHtmlString();
            }
            return gridHTML;
        }