dervishe- / f-droid-web

A simple and lightweight webpage which aims is to present the apps stored in a f-droid repository
GNU Lesser General Public License v3.0
15 stars 6 forks source link

Template all HTML output #23

Closed pserwylo closed 9 years ago

pserwylo commented 9 years ago

This will make it easier to:

For the record, I'm starting some work on this in my own branch, and will propose a PR in the future if you think it is useful.

dervishe- commented 9 years ago

Thanks pserwylo :) I'm actually thinking about making the all things with objects (separate rendering and backend). If you think it could be useful for you let me know, we talk about it.

pserwylo commented 9 years ago

thinking about making the all things with objects (separate rendering and backend)

Sure, classes make it easier to prevent coding errors (for example my IDE knows that $app->detail doesn't exist, but can't tell me if $app['detail'] exists or not). However it will not in itself help with separating rendering from backend.

Feel free to check out my progress to see what it looks like - you'll notice almost zero HTML in index.php.

if you think it could be useful for you let me know

I've already finished the templating stuff, so it wont be of immediate help. However as discussed above, it is good practice because then our tooling will be better at identifying problems. I will ask that you wait for a couple of days until this is merged though, or else there will be a lot of merge sadness and conflicts :)

Will keep you posted about my progress, and when I've got some documentation in a README and finished the bootstrap theme, I will submit a pull request for both.

dervishe- commented 9 years ago

Usually, i used POO in PHP but i let the html be built client side with js manipulating dom (the only thing, the PHP do is building a basic frame/sketch). In this way, i only exchange json (short and fast). I already see your work and it's very interesting :) Just two things, make sure the rendering of the page is WCAG2.0 AA compliant (but i also could check that after the commit of your work) because i think it's very important that at least for the default template, we have accessibility. The second things, is: could you instead of the README page, just make a wiki page ? i try to have all the documentation in it. (But i can also make it and you correct it if i make mistake). For the merge, i will wait for your work first (unfortunately, i've also other works to do too) anyhow, thanks a lot for your work. :)

dervishe- commented 9 years ago

Just few things:

pserwylo commented 9 years ago

make sure the rendering of the page is WCAG2.0 AA compliant

I don't have much experience with accessibility (shame on me), but will try to make sure the boostrap theme is compliant. Can you recommend a good way to check for WCAG compliance? The boostrap documentation emphasises accessibility quite a bit, so shouldn't be too much of a problem actually making it accessible. As for the default template, I've essentially made it output the same DOM as you had originally, so should also be good.

Is use of js mandatory? (Because, the website have to work even with js not activated like with noscript)

The JS I've got in the boostrap theme is for showing and hiding things - so I guess the site will still work fine with noscript. However, that is another thing I can check before merging. I actually plan on moving the CSS/JS assets into a subfolder of the relevant template. So your existing CSS would stay as is, but exist only for the default template. More importantly, my bootstrap CSS + JS would only be in a subfolder of the bootstrap template. This way, people can simply delete the theme folders that they don't want, and their webserver will no longer even have the option of serving these files.

Usually, i used OOP in PHP but i let the html be built client side with js manipulating the dom...

Out of curiosity, are you saying this is what you historically do with your other projects, or what you plan to do with this project? The reason I ask is because the site is guaranteed not to work with noscript if most of the DOM is created/manipulated in JS. I did notice your discussion with hans (hc) on the F-Droid forums, where he suggested a static JSON + HTML file. That may be a good alternative, but I see that as a different project, or an extension of what you have done here. The good thing about F-Droid being decentralised is that you or I could use the PHP version, while others who don't want to run PHP on their webserver could opt for a different solution which uses JSON + HTML. Thats just my thoughts though.

dervishe- commented 9 years ago

For the accessibility, here is some resources:

For the js, if it's just present to show/hide somethings we don't need it i think (take a tour here: https://repos.debrouillonet.org/?sheet=processing.test.histoire_d_oeuf and put your mouse on the old versions on the app's sheet, i made it in pure css (I agree with your solution to put each asset in its theme folder)

For your last question, yes it was just an historical remark :)

pserwylo commented 9 years ago

Cool, thanks for the links. I'm now going to stop talking about Accessibility + JS on this thread, because I've decided to commit the boostrap template as a separate PR. The initial PR #24 will deal only with replacing existing HTML with templates - not adding additional templates. If need be, we can discuss again on the PR which includes the Bootstrap theme (in the future).

dervishe- commented 9 years ago

Thanks, great job. I check the accessibility and it's fine ! :) I just add a $bloc declaration in the build_pager function (it was missing)