nilenso/ashoka-survey-web

Using Draper to replace build_mustache_templates

timothyandrew opened this issue · 1 comments

We replaced the build_mustache_templates file with a draper decorator in c5788fb. We aren't sure if this is the right way to do it, though. How clean is that approach?

Also, we considered going through the filesystem to fetch the different types we have to generate templates for. Would that be better? Right now we just have

  def template_types
    ['RadioQuestion', 'SingleLineQuestion', 'MultilineQuestion',
     'NumericQuestion', 'DateQuestion', 'MultiChoiceQuestion',
     'DropDownQuestion', 'PhotoQuestion', 'RatingQuestion', 'SurveyDetails',
     'MultiChoiceOption', 'RadioOption', 'DropDownOption'
     ]
  end

Also, how do we test that decorator?