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

20 lines
717 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2018-11-18 11:00:15 +05:30
module RepositoryLanguagesHelper
def repository_languages_bar(languages)
return if languages.none?
2019-12-26 22:10:19 +05:30
content_tag :div, class: 'progress repository-languages-bar js-show-on-project-root' do
2018-11-18 11:00:15 +05:30
safe_join(languages.map { |lang| language_progress(lang) })
end
end
def language_progress(lang)
content_tag :div, nil,
class: "progress-bar has-tooltip",
style: "width: #{lang.share}%; background-color:#{lang.color}",
2018-12-05 23:21:45 +05:30
data: { html: true },
title: "<span class=\"repository-language-bar-tooltip-language\">#{escape_javascript(lang.name)}</span>&nbsp;<span class=\"repository-language-bar-tooltip-share\">#{lang.share.round(1)}%</span>"
2018-11-18 11:00:15 +05:30
end
end