To add a bit more (I read the full rulings which are interesting), the supreme court didn't say Teresa May (i.e., the government based on the prime minister's wish) could not trigger article 50.
What they said was, the government (and in the old days, the King) could not take a step that would affect people's legal rights without parliament's clear approval, and that this was such a step - so May would have to ask parliament to give its approval and couldn't just go ahead without it. Which after a bit of debate, they did.
The legal dispute in court was about two issues: (1) whether or not it could be said that parliament had given its approval already, and (2) if it hadn't, did it need to.
As background, there are some actions that the King - (which in modern times also includes the King or Queen's government led by his/her Prime Minister) used to be able to take just because he was King, without anyone else being asked (the "Royal Prerogative"), and other actions he/she can't take because it's Parliament that has the right to say yes or no , not the King/Queen (or his/her government).
So the real question behind the case - which gave it its legal importance - was simply, would triggering article 50 after a referendum that Parliament had approved but not said specifically what would happen if people voted 'yes', be (1) an action in the first group, where the King/Queen/government could do it without asking parliament, or (2) an action in the second group, where they could not do it until parliament specifically said "The King/Queen/government is authorised to trigger article 50" - and, if it was in the second group, had parliament effectively said "go ahead" already or hadn't they.
Examples of the kinds of questions involved in the decision were - does parliament agreeing to hold a referendum, also count legally as its agreement to do what the referendum says? How was parliament's approval handled in other UK referendums? Is leaving also implied in the EU treaties, so that in agreeing to endorse the EEC/EU treaties, parliament had also implicitly agreed they could be withdrawn at some future time if the government so desired? Would withdrawal actually change the legal rights of British citizens, or was that technically not a direct "effect" of the act of withdrawal itself? And so on.