Esempio n. 1
0
        public static string GetNewsletterColumns(this HtmlHelper html, ContentAreaItem content, out int columns)
        {
            var newsletterColumn = NewsletterColumns.twelve;

            DisplayOption displayOption = content.LoadDisplayOption();

            if (displayOption != null)
            {
                switch (displayOption.Tag)
                {
                case WebGlobal.ContentAreaTags.FullWidth:
                    newsletterColumn = NewsletterColumns.twelve;
                    break;

                case WebGlobal.ContentAreaTags.TwoThirdsWidth:
                    newsletterColumn = NewsletterColumns.eight;
                    break;

                case WebGlobal.ContentAreaTags.HalfWidth:
                    newsletterColumn = NewsletterColumns.six;
                    break;

                case WebGlobal.ContentAreaTags.OneThirdWidth:
                    newsletterColumn = NewsletterColumns.four;
                    break;

                case WebGlobal.ContentAreaTags.Slider:
                    newsletterColumn = NewsletterColumns.twelve;
                    break;
                }
            }
            columns = (int)newsletterColumn;
            return(newsletterColumn.ToString());
        }
Esempio n. 2
0
        public static string GetNewsletterImageWidth(this HtmlHelper html, ContentAreaItem content, bool halfWidth = false)
        {
            DisplayOption displayOption = content.LoadDisplayOption();

            if (!halfWidth)
            {
                if (displayOption != null)
                {
                    switch (displayOption.Tag)
                    {
                    case WebGlobal.ContentAreaTags.FullWidth:
                        return(ImageFile.NewsletterWidths.FULL);

                    case WebGlobal.ContentAreaTags.TwoThirdsWidth:
                        return(ImageFile.NewsletterWidths.WIDE);

                    case WebGlobal.ContentAreaTags.HalfWidth:
                        return(ImageFile.NewsletterWidths.HALF);

                    case WebGlobal.ContentAreaTags.OneThirdWidth:
                        return(ImageFile.NewsletterWidths.NARROW);
                    }
                }
                return(ImageFile.NewsletterWidths.FULL);
            }
            else
            {
                if (displayOption != null)
                {
                    switch (displayOption.Tag)
                    {
                    case WebGlobal.ContentAreaTags.FullWidth:
                        return(ImageFile.NewsletterWidths.HALF);

                    case WebGlobal.ContentAreaTags.TwoThirdsWidth:
                        return(ImageFile.NewsletterWidths.NARROW);

                    case WebGlobal.ContentAreaTags.HalfWidth:
                        return(ImageFile.NewsletterWidths.NARROW);

                    case WebGlobal.ContentAreaTags.OneThirdWidth:
                        return(ImageFile.NewsletterWidths.NARROW);
                    }
                }
                return(ImageFile.NewsletterWidths.HALF);
            }
        }
Esempio n. 3
0
        public ContentAreaItemContext(ViewDataDictionary viewData, ContentAreaItem contentAreaItem)
        {
            _viewData = viewData;
            var displayOption = contentAreaItem.LoadDisplayOption() ?? new DisplayOption
            {
                Id   = Guid.NewGuid().ToString(),
                Name = "Unknown"
            };

            if (!_viewData.ContainsKey(Constants.CurrentDisplayOptionKey))
            {
                _viewData.Add(Constants.CurrentDisplayOptionKey, displayOption);
            }
            else
            {
                _viewData[Constants.CurrentDisplayOptionKey] = displayOption;
            }
        }
        public ContentAreaItemContext(ViewDataDictionary viewData, ContentAreaItem contentAreaItem)
        {
            _viewData = viewData;
            var displayOption = contentAreaItem.LoadDisplayOption() ?? new DisplayOption
                                                                       {
                                                                           Id = Guid.NewGuid().ToString(),
                                                                           Name = "Unknown"
                                                                       };

            if (!_viewData.ContainsKey(Constants.CurrentDisplayOptionKey))
            {
                _viewData.Add(Constants.CurrentDisplayOptionKey, displayOption);
            }
            else
            {
                _viewData[Constants.CurrentDisplayOptionKey] = displayOption;
            }
        }