expfactory / expfactory-battery

version 1.0 expfactory battery template used with psiturk, django, and expfactory.github.io
MIT License
0 stars 11 forks source link

Local battery template overrides experiment's style.css #70

Open earcanal opened 6 years ago

earcanal commented 6 years ago

I'm not sure how the templates are generated, but the installed localbattery.html (2.5.47) contains:

<head>
    ...
    <link rel='stylesheet' href='static/css/default_style.css' type="text/css">
</head>

This refers to default_style.css after an experiment's style.css making it awkward to override styles (e.g. experiment background colour). As the canonical config.json includes default_style.css before style.css it looks like the reference in the template should be removed.

vsoch commented 6 years ago

Agreed, the user style needs to come first. We can't assume, however that the default_style.css would be included by the user in the config.json. Would it suffice to just move around the ordering so user style takes preference?

earcanal commented 6 years ago

Yeah, it's probably a better solution if the user style is the last thing in the template.

vsoch commented 6 years ago

This sounds good to me. Would you like to PR with the change?

earcanal commented 6 years ago

I would, but I can't figure out how that template is built.

vsoch commented 6 years ago

I believe it's here:

https://github.com/expfactory/expfactory-battery/blob/master/templates/exp.html

earcanal commented 6 years ago

How is that used to build localbattery.html?

vsoch commented 6 years ago

Ah apologies - it isn't! I think we want this one from the other repository:

https://github.com/expfactory/expfactory-python/blob/master/expfactory/templates/localbattery.html

Apologies, it's been a while!

earcanal commented 6 years ago

:) No worries. Might be easier for you to commit than process a PR for such a small change?

vsoch commented 6 years ago

good idea :)

All set : https://github.com/expfactory/expfactory-python/blob/master/expfactory/templates/localbattery.html

Give it a try!

earcanal commented 6 years ago

Something not quite right with that. Looks like default_style.css is being injected a bit too early (in relation to config.json includes, which puts it after jspsych.css).

vsoch commented 6 years ago

I haven't worked on this project in years, and I'm trying to help out because my colleagues are silent. If you would be able to, it would be great for you to test this and do a PR since others will likely have the same trouble. Thanks!

earcanal commented 6 years ago

PR submitted.