From b6170d2d8b1017ce135c17916a03ebcc2d3bcf67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20D=C3=A1vila?= Date: Tue, 12 Jan 2016 20:07:59 -0500 Subject: Show last commit as description. #2406 --- app/views/projects/forks/index.html.haml | 2 +- app/views/shared/projects/_list.html.haml | 3 ++- app/views/shared/projects/_project.html.haml | 9 +++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/views/projects/forks/index.html.haml b/app/views/projects/forks/index.html.haml index 2150e2e42fb..fabd6b573a2 100644 --- a/app/views/projects/forks/index.html.haml +++ b/app/views/projects/forks/index.html.haml @@ -22,7 +22,7 @@ .projects-list-holder = render 'shared/projects/list', projects: @public_forks, use_creator_avatar: true, - forks: true + forks: true, show_last_commit_as_description: true - if protected_count > 0 %ul.projects-list diff --git a/app/views/shared/projects/_list.html.haml b/app/views/shared/projects/_list.html.haml index 0c774d217c3..b3f45373f6b 100644 --- a/app/views/shared/projects/_list.html.haml +++ b/app/views/shared/projects/_list.html.haml @@ -5,13 +5,14 @@ - forks = false unless local_assigns[:forks] == true - ci = false unless local_assigns[:ci] == true - skip_namespace = false unless local_assigns[:skip_namespace] == true +- show_last_commit_as_description = false unless local_assigns[:show_last_commit_as_description] == true %ul.projects-list - projects.each_with_index do |project, i| - css_class = (i >= projects_limit) ? 'hide' : nil = render "shared/projects/project", project: project, skip_namespace: skip_namespace, avatar: avatar, stars: stars, css_class: css_class, ci: ci, use_creator_avatar: use_creator_avatar, - forks: forks + forks: forks, show_last_commit_as_description: show_last_commit_as_description - if projects.size > projects_limit %li.bottom.center diff --git a/app/views/shared/projects/_project.html.haml b/app/views/shared/projects/_project.html.haml index 96ecb9dadb6..c1dcdb9f0b2 100644 --- a/app/views/shared/projects/_project.html.haml +++ b/app/views/shared/projects/_project.html.haml @@ -4,7 +4,8 @@ - ci = false unless local_assigns[:ci] == true - skip_namespace = false unless local_assigns[:skip_namespace] == true - css_class = '' unless local_assigns[:css_class] -- css_class += " no-description" unless project.description.present? +- show_last_commit_as_description = false unless local_assigns[:show_last_commit_as_description] == true +- css_class += " no-description" if project.description.blank? && !show_last_commit_as_description - ci_commit = project.ci_commit(project.commit.sha) if ci && !project.empty_repo? && project.commit - cache_key = [project.namespace, project, controller.controller_name, controller.action_name, current_application_settings, 'v2.2'] - cache_key.push(ci_commit.status) if ci_commit @@ -38,6 +39,10 @@ %span %i.fa.fa-star = project.star_count - - if project.description.present? + - if show_last_commit_as_description + .project-description + = link_to_gfm project.commit.title, namespace_project_commit_path(project.namespace, project, project.commit), + class: "commit-row-message" + - elsif project.description.present? .project-description = markdown(project.description, pipeline: :description) -- cgit v1.2.1