magpie-ea / magpie-modules

the reusable front-end bits in the _magpie modules
MIT License
7 stars 1 forks source link

Restructure views #48

Closed JannisBush closed 5 years ago

JannisBush commented 5 years ago

Currently, all views are independent of each other and there is a lot of redundant code.

The idea is to create base views (maybe two TTV-trial-type-view and ITV-instruction-type-view), and all the other views just modify these. This would also make it easier to create custom views.

There are two possible ways of doing this:

  1. The normal views wrap the base views and define things like viewTemplate, answerContainerElem etc. and then everything will be put together in the base view. (enableResponse or handleKeyPress could get tricky, and maybe hard to debug)
  2. The base views just provide the basic layout and structure and the normal views "inherit" from them and redefine the render function. (The render function is >90% of most views, therefore we might gain not too much from this, but additionally creating new babeUtils functions could help)

In addition some shared functionalities should become part of babeUtils.