talonframework / talon

An app builder framework for Phoenix
MIT License
164 stars 9 forks source link

Change default action on page controller #70

Closed smpallen99 closed 7 years ago

smpallen99 commented 7 years ago

The default action name for the page controller should be something standard, not page.

I suggest that it be index to align with the default template name from discussion in #66

dsnider commented 7 years ago

Phoenix doc example uses :show for this: https://hexdocs.pm/phoenix/Phoenix.Router.html

Should we go with that?

smpallen99 commented 7 years ago

Our model is different than the example in the phoenix docs. We have a separate view for each page. Furthermore, I would like to see a separate controller for each page. So, I think the default action should be index. However, functionally it does not make much difference. If there is a strong argument to use show, I my change my opinion.

dsnider commented 7 years ago

I agree about the separate view being relevant. With a single page controller and a single view, I'd say to use a single template folder with the templates named by page.

With one controller and N views, we have a resource named template folder and either a show/index template. It's arguable with this scenario. My thought was to let the PageController index action handle the scenario when the page wasn't provided. I'm not overly wedded either way. Further, our decision on #71 may be impact this.

dsnider commented 7 years ago

Went with index action: https://github.com/talonframework/talon/pull/73/commits/862fedeb1bf17516e48fcad2345a5a02717ad8d2