From 8494170550063c2d0308963cbd14cb46a292c401 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 22 Mar 2015 14:52:44 -0700 Subject: [PATCH] Improve contribution calendar per day info --- app/assets/javascripts/calendar.js.coffee | 3 --- app/assets/stylesheets/generic/calendar.scss | 21 ------------------- app/views/users/calendar_activities.html.haml | 7 +++---- lib/gitlab/contributions_calendar.rb | 4 ++-- 4 files changed, 5 insertions(+), 30 deletions(-) diff --git a/app/assets/javascripts/calendar.js.coffee b/app/assets/javascripts/calendar.js.coffee index 99e7d3a029f..d08ef9361a6 100644 --- a/app/assets/javascripts/calendar.js.coffee +++ b/app/assets/javascripts/calendar.js.coffee @@ -27,7 +27,6 @@ class @calendar legendCellPadding: 3 onClick: (date, count) -> formated_date = date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate() - $(".calendar_commit_activity").fadeOut 400 $.ajax url: calendar_activities_path data: @@ -36,6 +35,4 @@ class @calendar dataType: "html" success: (data) -> $(".user-calendar-activities").html data - $(".calendar_commit_activity").find(".js-toggle-content").hide() - $(".calendar_commit_activity").fadeIn 400 diff --git a/app/assets/stylesheets/generic/calendar.scss b/app/assets/stylesheets/generic/calendar.scss index e2ab7fc51a5..a36fefe22c5 100644 --- a/app/assets/stylesheets/generic/calendar.scss +++ b/app/assets/stylesheets/generic/calendar.scss @@ -1,21 +1,8 @@ .user-calendar-activities { - - .calendar_commit_activity { - padding: 5px 0 0; - } - .calendar_onclick_hr { padding: 0; margin: 10px 0; } - - .calendar_commit_date { - color: #999; - } - - .calendar_activity_summary { - font-size: 14px; - } .str-truncated { max-width: 70%; @@ -31,14 +18,6 @@ background-color: #ddd; } } - - .commit-row-message { - color: #333; - &:hover { - color: #444; - text-decoration: underline; - } - } } /** * This overwrites the default values of the cal-heatmap gem diff --git a/app/views/users/calendar_activities.html.haml b/app/views/users/calendar_activities.html.haml index 4200233dc4b..027a93a75fc 100644 --- a/app/views/users/calendar_activities.html.haml +++ b/app/views/users/calendar_activities.html.haml @@ -1,4 +1,3 @@ -.calendar_commit_activity %h4.prepend-top-20 %span.light Contributions for %strong #{@calendar_date.to_s(:short)} @@ -9,14 +8,14 @@ %span.light %i.fa.fa-clock-o = event.created_at.to_s(:time) - - if event.push? && event.commits_count > 0 - pushed #{event.commits_count} commits to + - if event.push? + #{event.action_name} #{event.ref_type} #{event.ref_name} - else = event_action_name(event) - if event.target %strong= link_to "##{event.target_iid}", [event.project.namespace.becomes(Namespace), event.project, event.target] - at + at %strong - if event.project = link_to_project event.project diff --git a/lib/gitlab/contributions_calendar.rb b/lib/gitlab/contributions_calendar.rb index 79e0a514f9e..3fd0823df06 100644 --- a/lib/gitlab/contributions_calendar.rb +++ b/lib/gitlab/contributions_calendar.rb @@ -14,11 +14,11 @@ module Gitlab date_from = 1.year.ago date_to = Date.today - events = Event.contributions.where(author_id: user.id). + events = Event.reorder(nil).contributions.where(author_id: user.id). where("created_at > ?", date_from).where(project_id: projects). group('date(created_at)'). select('date(created_at), count(id) as total_amount'). - reorder(nil).map(&:attributes) + map(&:attributes) dates = (1.year.ago.to_date..(Date.today + 1.day)).to_a