diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index bcde979..61ad438 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -107,7 +107,7 @@ def admin_previewphase @phase = Phase.find(params[:id]) authorize @phase.template - @template = Phase.template + @template = @phase.template end diff --git a/app/models/question.rb b/app/models/question.rb index d6ec73e..7a37132 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -96,11 +96,12 @@ # pulls together guidance from various sources for question guidances = {} theme_ids = question.theme_ids - - GuidanceGroup.where(org_id: org.id).each do |group| - group.guidances.each do |g| - g.themes.where("id IN (?)", theme_ids).each do |gg| - guidances["#{group.name} " + I18n.t('admin.guidance_lowercase_on') + " #{gg.title}"] = g + if theme_ids.present? + GuidanceGroup.where(org_id: org.id).each do |group| + group.guidances.each do |g| + g.themes.where("id IN (?)", theme_ids).each do |gg| + guidances["#{group.name} " + I18n.t('admin.guidance_lowercase_on') + " #{gg.title}"] = g + end end end end diff --git a/app/views/templates/_preview_question.html.erb b/app/views/templates/_preview_question.html.erb index dee1c97..37d3fb1 100644 --- a/app/views/templates/_preview_question.html.erb +++ b/app/views/templates/_preview_question.html.erb @@ -8,7 +8,7 @@