YaleSTC / shifts

Application to easily track shifts, reports, and payforms for employees.
MIT License
23 stars 18 forks source link

Consider rewriting views in Haml or Slim #362

Open mnquintana opened 10 years ago

mnquintana commented 10 years ago

So far, our biggest projects (reservations and shifts) have had all their views written in HTML and ERB. This is the default, and it's worked so far. Having said that, I think there is a better way: Haml.

We used Haml for all the views in (now on hiatus) Doris, and it is incredible what it can do to clean up views and enforce consistent, readable, sustainable style. I think we'd be far more productive and our code far more readable and consistent with it.

Caveats:

orenyk commented 10 years ago

I've looked into Haml a bit and it seems way more readable than ERB, I've just never had time to learn it properly or implement it. I'd even consider doing the same for Reservations if you think it makes sense.

mnquintana commented 10 years ago

We might also want to consider Slim: http://slim-lang.com/

Its syntax is even simpler and it's apparently much faster than Haml.

I'm not sure (other than performance) which would be better between Slim and Haml - still researching.

mnquintana commented 10 years ago

Okay, after my research, Slim is better than Haml in virtually every way, and the only reason it's not more popular than Haml is precedent / name recognition, basically. Arguably, for Rubyists it's a little easier to follow Haml's HTML attribute syntax (it's a hash!), but Slim's is actually just the standard HTML attribute syntax, so, actually that might be better.

Slim also has an ERB > Slim conversion script: https://github.com/slim-template/html2slim (update: this script seems to be buggy / poorly maintained)

So in conclusion, if we do this, we should switch to Slim.