Ejemplo n.º 1
0
        public ActionResult PreviewBar()
        {
            var profile = HttpContext.Profile;

            //return early if we are not previewing
            if (profile == null ||
                profile.PropertyValues["PreviewSkinID"] == null ||
                !CommonLogic.IsInteger(profile.GetPropertyValue("PreviewSkinID").ToString()))
            {
                return(Content(String.Empty));
            }

            var customer = HttpContext.GetCustomer();

            var previewSkinId   = int.Parse(HttpContext.Profile.GetPropertyValue("PreviewSkinID").ToString());
            var previewSkin     = new SkinProvider().GetSkinById(previewSkinId);
            var previewSkinName = !String.IsNullOrEmpty(previewSkin.DisplayName)
                                ? previewSkin.DisplayName
                                : previewSkin.Name;

            var previewBarViewModel = new PreviewBarViewModel
            {
                PreviewText       = String.Format(AppLogic.GetString("admin.skinselector.PreviewWarning", customer.LocaleSetting), previewSkinName),
                PreviewBarCssPath = "~/App_Templates/Admin_Default/previewstyles.css"
            };

            return(PartialView(ViewNames.PreviewBarPartial, previewBarViewModel));
        }
Ejemplo n.º 2
0
        public ActionResult PreviewBar()
        {
            var profile = HttpContext.Profile;

            //return early if we are not previewing
            if (profile == null ||
                profile.PropertyValues["PreviewSkinID"] == null ||
                !CommonLogic.IsInteger(profile.GetPropertyValue("PreviewSkinID").ToString()))
            {
                return(Content(String.Empty));
            }

            var customer = HttpContext.GetCustomer();

            var previewSkinId   = int.Parse(HttpContext.Profile.GetPropertyValue("PreviewSkinID").ToString());
            var previewSkin     = new SkinProvider().GetSkinById(previewSkinId);
            var previewSkinName = !String.IsNullOrEmpty(previewSkin.DisplayName)
                                ? previewSkin.DisplayName
                                : previewSkin.Name;

            var previewBarViewModel = new PreviewBarViewModel
            {
                PreviewText       = String.Format("You are previewing the <span class=\"preview - skin - name\">{0}</span> skin.  Click the button to the right to end the preview.", previewSkinName),
                PreviewBarCssPath = "~/App_Templates/Admin_Default/previewstyles.css"
            };

            return(PartialView(ViewNames.PreviewBarPartial, previewBarViewModel));
        }