Class: Concepts::UntranslatedController

Inherits:
ConceptsController
  • Object
show all
Defined in:
app/controllers/concepts/untranslated_controller.rb

Overview

TODO: This class (including the view) should not exist! Please move this back into the alphabetical_controller. The only difference between those two controllers is the scope used. Use if statements or published methods instead. “DRYness”

Instance Method Summary collapse

Instance Method Details

#indexObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/concepts/untranslated_controller.rb', line 23

def index
  authorize! :read, Concept::Base

  scope = Iqvoc::Concept.pref_labeling_class.label_class.
    begins_with(params[:prefix]).
    missing_translation(I18n.locale, Iqvoc::Concept.pref_labeling_languages.first)

  if I18n.locale.to_s == Iqvoc::Concept.pref_labeling_languages.first # TODO: Should be 404!
    @labels = []
    flash.now[:error] = I18n.t("txt.views.untranslated_concepts.unavailable")
  else
    @labels = scope.order("LOWER(labels.value)").page(params[:page])
  end
end