debian-mirror-gitlab/app/helpers/programming_languages_helper.rb
2023-03-05 14:24:40 +05:30

20 lines
515 B
Ruby

# frozen_string_literal: true
module ProgrammingLanguagesHelper
def search_language_placeholder
placeholder = _('Language')
return placeholder unless params[:language].present?
programming_languages.find { |language| language.id.to_s == params[:language] }&.name ||
placeholder
end
def programming_languages
@programming_languages ||= ProgrammingLanguage.most_popular
end
def language_state_class(language)
params[:language] == language.id.to_s ? 'is-active' : ''
end
end