Ejemplo n.º 1
0
        public CardView MakeCardForStory(PivotalStory story)
        {
            var card = new CardView {
                Type = story.Type.ToString().ToLower(),
                CurrentState = TranslateState(story.CurrentState),
                Size = story.Estimate,
                Title = story.Name,
                Owner = GetOwner(story),
                AvatarUrl = GetAvatarUrl(story),
                Url = story.Url,
                ProjectName = GetProjectName(story),
                Id = story.Id
            };

            CardBadge badge;
            foreach(var item in story.Labels) {
                if(TryGetBadge(item, out badge))
                    card.AddBadge(badge);
                else
                    card.AddLabel(item);
            }

            if(TryGetBadge("type:" + story.Type, out badge))
                card.AddBadge(badge);

            foreach(var item in story.Tasks)
                card.AddTask(new CardTask
                {
                    Name = item.Description,
                    IsComplete = item.IsComplete,
                    ImageUrl = item.IsComplete ? TaskCompleteUrl : TaskPendingUrl
                });

            return card;
        }