In general, Ted was the first to fall for Robin, and she liked him back, but they where to different to make it work. Although they dated for a year (Season 2), they didn't even got to move in together. Barney first felt something for Robin in Miracles, and after a whole season of walking with it, he finally confessed to her. They dated for a while, but as they where two 'alpha wolves' in one relationship, they knew it wouldn't work, and broke up. Both of them has showed to be still in love with her, but she denied both.
Robin and Barney got engaged after Barney performed The Robin, and got married in The End of the Aisle. It can be assumed that, after they got divorced and Ted's wife died, Robin and Ted got together.
Purple Giraffe - Ted organises three parties for Robin, and they eventually kiss on the roof.