diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-28 23:00:41 -0800 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-28 23:00:41 -0800 |
| commit | c39f80bdb412bc9cc7646de0929efe8cb5b870d4 (patch) | |
| tree | 6c459de47167e38a0110973855cff9b2d2246e5c | |
| parent | 815e9aa283f113051268370908776c5517dab711 (diff) | |
| download | gitlab-ce-c39f80bdb412bc9cc7646de0929efe8cb5b870d4.tar.gz | |
Refactor commit calendar a bit. Fixed dates
| -rw-r--r-- | app/assets/javascripts/calendar.js.coffee | 16 | ||||
| -rw-r--r-- | app/controllers/users_controller.rb | 4 | ||||
| -rw-r--r-- | lib/gitlab/commits_calendar.rb | 8 |
3 files changed, 10 insertions, 18 deletions
diff --git a/app/assets/javascripts/calendar.js.coffee b/app/assets/javascripts/calendar.js.coffee index e3bb420a278..c5465f92076 100644 --- a/app/assets/javascripts/calendar.js.coffee +++ b/app/assets/javascripts/calendar.js.coffee @@ -4,7 +4,7 @@ class @calendar day: "numeric" year: "numeric" - constructor: (timestamps,starting_year,starting_month,activities_path) -> + constructor: (timestamps, starting_year, starting_month, activities_path) -> cal = new CalHeatMap() cal.init itemName: ["commit"] @@ -46,7 +46,7 @@ class @calendar $("#loading_commits").hide() return ), 400 - return + return return return @@ -54,17 +54,17 @@ class @calendar $("#calendar_onclick_placeholder").hide() $("#calendar_onclick_placeholder").html -> "<span class='calendar_onclick_second'><b>" + - ((if nb is null then "no" else nb)) + - "</b><span class='calendar_commit_date'> commit" + - ((if (nb isnt 1) then "s" else "")) + " " + - date.toLocaleDateString("en-US", options) + + ((if nb is null then "no" else nb)) + + "</b><span class='calendar_commit_date'> commit" + + ((if (nb isnt 1) then "s" else "")) + " " + + date.toLocaleDateString("en-US", options) + "</span><hr class='calendar_onclick_hr'></span>" $.each data, (key, data) -> $.each data, (index, data) -> $("#calendar_onclick_placeholder").append -> "Pushed <b>" + ((if data is null then "no" else data)) + " commit" + - ((if (data isnt 1) then "s" else "")) + - "</b> to <a href='/" + index + "'>" + + ((if (data isnt 1) then "s" else "")) + + "</b> to <a href='/" + index + "'>" + index + "</a><hr class='calendar_onclick_hr'>" return return diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a5e80f7e008..28de2707778 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -28,8 +28,8 @@ class UsersController < ApplicationController user_repositories = visible_projects.map(&:repository) @timestamps = Gitlab::CommitsCalendar.create_timestamp(user_repositories, @user, false) - @starting_year = Gitlab::CommitsCalendar.starting_year(@timestamps) - @starting_month = Gitlab::CommitsCalendar.starting_month(@timestamps) + @starting_year = (Time.now - 1.year).strftime("%Y") + @starting_month = Date.today.strftime("%m").to_i @last_commit_date = Gitlab::CommitsCalendar.last_commit_date(@timestamps) respond_to do |format| diff --git a/lib/gitlab/commits_calendar.rb b/lib/gitlab/commits_calendar.rb index a862e67a598..93256187fd2 100644 --- a/lib/gitlab/commits_calendar.rb +++ b/lib/gitlab/commits_calendar.rb @@ -60,14 +60,6 @@ module Gitlab end end - def self.starting_year(timestamps) - DateTime.now.to_date - 1 - end - - def self.starting_month(timestamps) - Date.today.strftime("%m").to_i - end - def self.last_commit_date(timestamps) latest_commit_date(timestamps).to_formatted_s(:long).to_s end |
