debian-mirror-gitlab/app/helpers/programming_languages_helper.rb

21 lines
515 B
Ruby
Raw Normal View History

2023-03-04 22:38:38 +05:30
# 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