diff options
author | Hannes Rosenögger <123haynes@gmail.com> | 2015-03-13 13:39:26 +0300 |
---|---|---|
committer | Hannes Rosenögger <123haynes@gmail.com> | 2015-03-18 10:42:42 +0300 |
commit | 9e5738b0072f8715d52801f3469be9f3742beb97 (patch) | |
tree | e6f83c4c42e05309ef20150796aefe372026e68f /app/controllers/users_controller.rb | |
parent | dbd347bfa00e133da8ac178612ed8c30ef871ca4 (diff) |
Extend the commit calendar to show the actual commits for a date
Diffstat (limited to 'app/controllers/users_controller.rb')
-rw-r--r-- | app/controllers/users_controller.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8a13394dbac..68130eb128c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -32,6 +32,7 @@ class UsersController < ApplicationController def calendar projects = Project.where(id: authorized_projects_ids & @user.contributed_projects_ids) + calendar = Gitlab::CommitsCalendar.new(projects, @user) @timestamps = calendar.timestamps @starting_year = calendar.starting_year @@ -40,6 +41,24 @@ class UsersController < ApplicationController render 'calendar', layout: false end + def calendar_activities + projects = Project.where(id: authorized_projects_ids & @user.contributed_projects_ids) + + date = Date.parse(params[:date]) rescue nil + if date + @calendar_activities = Gitlab::CommitsCalendar.get_commits_for_date(projects, @user, date) + else + @calendar_activities = {} + end + + # get the total number of unique commits + @commit_count = @calendar_activities.values.flatten.map(&:id).uniq.count + + @calendar_date = date + + render 'calendar_activities', layout: false + end + def determine_layout if current_user 'navless' |