From 7057fbf404968aed61d108967514e5ffc18fe91b Mon Sep 17 00:00:00 2001 From: Jeff Stubler Date: Mon, 2 Jan 2017 19:55:26 -0600 Subject: Add updated time to project list --- app/assets/stylesheets/pages/projects.scss | 1 + app/helpers/projects_helper.rb | 2 +- app/views/shared/projects/_project.html.haml | 34 +++++++++++++----------- changelogs/unreleased/26509-show-update-time.yml | 4 +++ spec/helpers/projects_helper_spec.rb | 2 +- 5 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 changelogs/unreleased/26509-show-update-time.yml diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index 717ebb44a23..75b4b920b53 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -610,6 +610,7 @@ pre.light-well { .controls { margin-left: auto; + text-align: right; } .ci-status-link { diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 6b9e4267281..7fbdbe507ef 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -160,7 +160,7 @@ module ProjectsHelper end def project_list_cache_key(project) - key = [project.namespace.cache_key, project.cache_key, controller.controller_name, controller.action_name, current_application_settings.cache_key, 'v2.3'] + key = [project.namespace.cache_key, project.cache_key, controller.controller_name, controller.action_name, current_application_settings.cache_key, 'v2.4'] key << pipeline_status_cache_key(project.pipeline_status) if project.pipeline_status.has_status? key diff --git a/app/views/shared/projects/_project.html.haml b/app/views/shared/projects/_project.html.haml index 761f0b606b5..dd130ac058c 100644 --- a/app/views/shared/projects/_project.html.haml +++ b/app/views/shared/projects/_project.html.haml @@ -7,6 +7,7 @@ - show_last_commit_as_description = false unless local_assigns[:show_last_commit_as_description] == true && project.commit - css_class += " no-description" if project.description.blank? && !show_last_commit_as_description - cache_key = project_list_cache_key(project) +- updated_tooltip = time_ago_with_tooltip(project.updated_at) %li.project-row{ class: css_class } = cache(cache_key) do @@ -36,18 +37,21 @@ = markdown_field(project, :description) .controls - - if project.archived - %span.prepend-left-10.label.label-warning archived - - if project.pipeline_status.has_status? - %span.prepend-left-10 - = render_project_pipeline_status(project.pipeline_status) - - if forks - %span.prepend-left-10 - = icon('code-fork') - = number_with_delimiter(project.forks_count) - - if stars - %span.prepend-left-10 - = icon('star') - = number_with_delimiter(project.star_count) - %span.prepend-left-10.visibility-icon.has-tooltip{ data: { container: 'body', placement: 'left' }, title: visibility_icon_description(project) } - = visibility_level_icon(project.visibility_level, fw: true) + .prepend-top-0 + - if project.archived + %span.prepend-left-10.label.label-warning archived + - if project.pipeline_status.has_status? + %span.prepend-left-10 + = render_project_pipeline_status(project.pipeline_status) + - if forks + %span.prepend-left-10 + = icon('code-fork') + = number_with_delimiter(project.forks_count) + - if stars + %span.prepend-left-10 + = icon('star') + = number_with_delimiter(project.star_count) + %span.prepend-left-10.visibility-icon.has-tooltip{ data: { container: 'body', placement: 'left' }, title: visibility_icon_description(project) } + = visibility_level_icon(project.visibility_level, fw: true) + .prepend-top-5 + updated #{updated_tooltip} diff --git a/changelogs/unreleased/26509-show-update-time.yml b/changelogs/unreleased/26509-show-update-time.yml new file mode 100644 index 00000000000..012fd00dd87 --- /dev/null +++ b/changelogs/unreleased/26509-show-update-time.yml @@ -0,0 +1,4 @@ +--- +title: Add update time to project lists. +merge_request: 8514 +author: Jeff Stubler diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb index 40efab6e4f7..b44af79811f 100644 --- a/spec/helpers/projects_helper_spec.rb +++ b/spec/helpers/projects_helper_spec.rb @@ -93,7 +93,7 @@ describe ProjectsHelper do end it "includes a version" do - expect(helper.project_list_cache_key(project)).to include("v2.3") + expect(helper.project_list_cache_key(project).last).to start_with('v') end it "includes the pipeline status when there is a status" do -- cgit v1.2.1