summaryrefslogtreecommitdiff
path: root/app/controllers/users_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/users_controller.rb')
-rw-r--r--app/controllers/users_controller.rb19
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'