public static InstantArticleItemModel CreateFrom(int type, InstantArticleItemModel model) { _createFromDic.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); return(_createFromDic[(InstantArticleItemType)type](model)); }
protected XElement AddCaption(InstantArticleItemModel item) { var caption = (CaptionItem)item.Children.First(c => c.IsCaption); var captionAttrDic = caption.Attributes.ToDictionary(a => a.Name, a => a); return(new XElement("figcaption", new XElement("h1", GetAttributeValue(captionAttrDic["title"])), new XElement("cite", GetAttributeValue(captionAttrDic["credits"])))); }
private InstantArticleItemModel _CreateItemChildViewModel(InstantArticleItemModel model) { var type = (InstantArticleItemType)model.ItemTypeId; var vm = InstantArticleModelFactory.CreateFrom((int)model.ItemTypeId, model); vm.Name = InstantArticleModelFactory.Items[type].Name; vm.Type = (InstantArticleItemType)model.ItemTypeId; vm.AttributeValues = Common.ItemData.ContainsKey(type) ? Common.ItemData[type].AttributeValues : null; return(vm); }
private InstantArticleItemModel _CreateItemViewModel(InstantArticleItemModel model) { var type = (InstantArticleItemType)model.ItemTypeId; return(new InstantArticleItemModel(model) { Name = InstantArticleModelFactory.Items[type].Name, Type = (InstantArticleItemType)model.ItemTypeId, AttributeValues = Common.ItemData.ContainsKey(type) ? Common.ItemData[type].AttributeValues : null, Children = model.Children.IsNullOrEmpty() ? null : model.Children.Select(c => _CreateItemChildViewModel(c)).ToList() }); }
public override XElement ToXElement() { var attrDic = Attributes.ToDictionary(a => a.Name, a => a); var attrs = InstantArticleItemModel.ToXAttribute(attrDic); //var attrs = new[] //{ // new XAttribute("src", attrDic["src"].Value), // new XAttribute("data-mode", attrDic["data-mode"].Value), // new XAttribute("data-fb-disable-360", attrDic["data-fb-disable-360"].Value), //}; var el = new XElement( "figure", new XElement("img", attrs), AddCaption(this)); return(el); }
public ContentResult DeleteItem(InstantArticleItemModel item) { var itemModels = new List <InstantArticleItemModel>(); try { //remove children first if (!item.Children.IsNullOrEmpty()) { _articleItemRepos.Remove(item.Children.Select(c => c.Id).ToList()); } _articleItemRepos.Remove(item.Id); itemModels = _GetItems(item.InstantArticleId); } catch { return(_ConvertToJSON(new { Success = false })); } return(_ConvertToJSON(new { Success = true, Items = itemModels })); }
public PullQuoteItem(InstantArticleItemModel model) : base(model) { }
public VideoItem(InstantArticleItemModel model) : base(model) { }
public FacebookEmbedItem(InstantArticleItemModel model) : base(model) { }
public MapItem(InstantArticleItemModel model) : base(model) { }
public TwitterEmbedItem(InstantArticleItemModel model) : base(model) { }
public CaptionItem(InstantArticleItemModel model) : base(model) { }
public ItemWithCaption(InstantArticleItemModel model) : base(model) { }
public SlideShowItem(InstantArticleItemModel model) : base(model) { }
public InstagramEmbedItem(InstantArticleItemModel model) : base(model) { }
public TextItem(InstantArticleItemModel model) : base(model) { }
public BlockQuoteItem(InstantArticleItemModel model) : base(model) { }
public YouTubeEmbedItem(InstantArticleItemModel model) : base(model) { }
public ImageItem(InstantArticleItemModel model) : base(model) { }