Adapt_framework: View Model Code to Models - Create standard models

Created on 28 Jul 2016  路  9Comments  路  Source: adaptlearning/adapt_framework

We should create a series of core component models for standard model behaviour.

  • This will reduce the footprint for bug fixing
  • Facilitate reuse
  • Standardise common behaviour
enhancement Epic

All 9 comments

we need a core model for each items, mcq and slider

the mcq one is done, but it still lives in the mcq

graphic, text, blank and media still need doing.

graphic, text, blank and media still need doing.

what do you envisage going into the models for those?

Nothing, just the bog standard model. They just need to conform to the model / view separation standard. I'd like to kill off "view only" components.

Oh right, I see - something a bit like this?

return Adapt.register('blank', {
        model: ComponentModel.extend({}), // Need to create a new class in the inheritance chain so that it can be extended per component type if necessary later
        view: BlankView
});

Exactly. Then we can drop all that compatibility rubbish from QuestionView (not that it's needed for the presentation components, it will just feel a lot cleaner).

Excellent. Would you be happy to keep the view code in adapt-contrib-blank.js - or would you want it moved to a separate .js file?

It's fine in the main file I think. I'd prefer a separate file as an example for everyone to follow but it's really only a stylistic wish. (I updated your code example btw ^ just so that you notice)

OK all done

Was this page helpful?
0 / 5 - 0 ratings