On 03/15/2016 07:26 PM, Bryan Richter wrote: > I want to create some structure for the templates/ directory, which is > a mess right now. This is related to a number of confusing aspects of > Yesod, so let's start with a little Q&A: > > Q. What is a Widget? > > A. It is a section of a webpage. It can be just a little snippet of > html, or it can be a bundle of html, css, and javascript. The html of > a Widget can be anything from a little <li> to a gigantic <section>. > > Q. How do I make a Widget? > > A. A widget is created in Haskell. Haskellers have a variety of options > for making a Widget. They can be created from template files found in > the templates/ directory, or they can be created from templates > written directly in the Haskell files. > > Q. How do I know if a template file (and the Widget it creates) is for > a particular page, or a form, or what? > > A. You can't. There is nothing intrinsically tying the name of a > template file to a page on the website. > > Q. I am writing a page and I want to use some custom form or other > helper Widget. How do I add it to my page? > > A. The Widget you are going to use has to come from Haskell. There are > no other options. Even if you know the template file that creates the > Widget, you have to create the Widget in Haskell first before adding > it to your page. > > I WANT TO CHANGE SOME OF THESE FACTS. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > First of all, I want there to be one, standard way of making Widgets. > Second, there are a few special categories of Widgets I want to make > explicit by their filenames. > > So, here are my recommendations. > > - Every Widget is created from files under templates/. No > quasiquotes, Haskellers, except for dire situations. > > - Top-level page Widgets are found under "templates/page/". > > - Top-level form Widgets are found under "templates/form/". > > - Widgets for custom form fields are found under "templates/field/". > > - Helper Widgets will live at the top-level (templates/) until > more categories are discovered. > > If nobody has a problem with these recommendations, here are the steps > we should take to implement them: > > 1. Make sure each Widget is being generated from a template file. > > - We should probably break this task down into per-Haskell-file > batches. > > 2. Reorganize Widget files according to the given heirarchy. >
Sounds good to me. Can we add to this also consistency in templates file naming? And can we also document your suggestions / hacks somewhere for tags / jumps to go between the widget calls in Haskell and the templates files?
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Dev mailing list [email protected] https://lists.snowdrift.coop/mailman/listinfo/dev
