diff options
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/repository_languages_helper.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/helpers/repository_languages_helper.rb b/app/helpers/repository_languages_helper.rb new file mode 100644 index 00000000000..9a842cf5ce0 --- /dev/null +++ b/app/helpers/repository_languages_helper.rb @@ -0,0 +1,16 @@ +module RepositoryLanguagesHelper + def repository_languages_bar(languages) + return if languages.none? + + content_tag :div, class: 'progress repository-languages-bar' do + 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}", + title: lang.name + end +end |