module CommitHelper def render_commit_stats(stats) res = [""] ind=0 stats.files.each do |filename, adds, deletes, total| res << "" res << "" res << "" ind +=1 end res << "
#{h(filename.rtruncate 120)}" res << I18n.t("layout.projects.inline_changes_count", count: total).strip + " (" + I18n.t("layout.projects.inline_additions_count", count: adds).strip + ", " + I18n.t("layout.projects.inline_deletions_count", count: deletes).strip + ")" res << "
" res.join("\n").html_safe end # def format_commit_message(message) # h(message).gsub("\n", "
").html_safe # end def commit_date(date) I18n.localize(date, { format: "%d %B %Y" }) end def short_hash_id(id) id[0..19] end def shortest_hash_id(id, size=10) id[0..size-1] end def commit_author_link(author) name = author.name email = author.email u = User.where(email: email).first u.present? ? link_to(name, user_path(u)) : mail_to(email, name) end def commits_pluralize(commits_count) Russian.p(commits_count, *commits_pluralization_arr) end protected def commits_pluralization_arr pluralize ||= t('layout.commits.pluralize').map {|base, title| title.to_s} end end