summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/stylesheets/projects.css.scss14
-rw-r--r--app/controllers/projects_controller.rb2
-rw-r--r--app/controllers/repositories_controller.rb2
-rw-r--r--app/models/commit.rb1
-rw-r--r--app/models/project.rb15
-rw-r--r--app/models/repository.rb10
-rw-r--r--app/views/repositories/_head.html.haml2
-rw-r--r--app/views/repositories/branches.html.haml3
-rw-r--r--app/views/repositories/show.html.haml16
-rw-r--r--app/views/repositories/tags.html.haml3
10 files changed, 64 insertions, 4 deletions
diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss
index 316ef033e28..79fb64cd9a4 100644
--- a/app/assets/stylesheets/projects.css.scss
+++ b/app/assets/stylesheets/projects.css.scss
@@ -672,3 +672,17 @@ body.project-page h2.icon.loading {
}
}
}
+
+a.project-update.titled {
+ position: relative;
+ padding-right: 310px !important;
+
+ .right-block {
+ padding: 10px;
+ width: 280px;
+ background: #f5f5f5;
+ position: absolute;
+ right: 0;
+ top: 0;
+ }
+}
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 1e859ceac31..69e1cc3645b 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -69,7 +69,7 @@ class ProjectsController < ApplicationController
def show
return render "projects/empty" unless @project.repo_exists? && @project.has_commits?
limit = (params[:limit] || 20).to_i
- @activities = @project.cached_updates(limit)
+ @activities = @project.updates_wo_repo(limit)
end
def files
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 9a112f4674f..1e715931320 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -9,7 +9,7 @@ class RepositoriesController < ApplicationController
layout "project"
def show
- @activities = @project.fresh_commits(20)
+ @activities = @project.commits_with_refs(20)
end
def branches
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 33d3b202ee7..695dfa5277e 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -2,6 +2,7 @@ class Commit
attr_accessor :commit
attr_accessor :head
+ attr_accessor :refs
delegate :message,
:committed_date,
diff --git a/app/models/project.rb b/app/models/project.rb
index 33dd85e2f32..93637822a74 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -79,6 +79,7 @@ class Project < ActiveRecord::Base
:repo_exists?,
:commit,
:commits,
+ :commits_with_refs,
:tree,
:heads,
:commits_since,
@@ -144,6 +145,10 @@ class Project < ActiveRecord::Base
users_projects.find_by_user_id(user_id)
end
+ def fresh_merge_requests(n)
+ merge_requests.includes(:project, :author).order("created_at desc").first(n)
+ end
+
def fresh_issues(n)
issues.includes(:project, :author).order("created_at desc").first(n)
end
@@ -290,6 +295,16 @@ class Project < ActiveRecord::Base
end[0...n]
end
+ def updates_wo_repo(n=3)
+ [
+ fresh_issues(n),
+ fresh_merge_requests(n),
+ fresh_notes(n)
+ ].compact.flatten.sort do |x, y|
+ y.created_at <=> x.created_at
+ end[0...n]
+ end
+
def check_limit
unless owner.can_create_project?
errors[:base] << ("Your own projects limit is #{owner.projects_limit}! Please contact administrator to increase it")
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 6f90fd0b910..8da5d2dd54a 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -112,6 +112,16 @@ class Repository
commits[0...n]
end
+ def commits_with_refs(n = 20)
+ commits = repo.refs.map { |ref| Commit.new(ref.commit, ref) }
+
+ commits.sort! do |x, y|
+ y.committed_date <=> x.committed_date
+ end[0..n]
+
+ commits
+ end
+
def commits_since(date)
commits = heads.map do |h|
repo.log(h.name, nil, :since => date).each { |c| Commit.new(c, h) }
diff --git a/app/views/repositories/_head.html.haml b/app/views/repositories/_head.html.haml
index c22286ec094..894a301db9c 100644
--- a/app/views/repositories/_head.html.haml
+++ b/app/views/repositories/_head.html.haml
@@ -1,7 +1,7 @@
.merge-tabs.repository
= link_to project_repository_path(@project), :class => "activities-tab tab #{'active' if current_page?(project_repository_path(@project)) }" do
%span
- Activities
+ History
= link_to branches_project_repository_path(@project), :class => "tab #{'active' if current_page?(branches_project_repository_path(@project)) }" do
%span
Branches
diff --git a/app/views/repositories/branches.html.haml b/app/views/repositories/branches.html.haml
index 3a63e761a46..befa88cc8d0 100644
--- a/app/views/repositories/branches.html.haml
+++ b/app/views/repositories/branches.html.haml
@@ -6,5 +6,8 @@
%a.update-item{:href => project_commits_path(@project, :ref => branch.name)}
%span.update-title{:style => "margin-bottom:0px;"}
= branch.name
+ %span.update-author.right
+ = time_ago_in_words(branch.commit.committed_date)
+ ago
- else
%h3 No brances
diff --git a/app/views/repositories/show.html.haml b/app/views/repositories/show.html.haml
index 494f82b9433..128c85299ff 100644
--- a/app/views/repositories/show.html.haml
+++ b/app/views/repositories/show.html.haml
@@ -4,4 +4,18 @@
#news-feed.news-feed
.project-box.project-updates.ui-box.ui-box-small.ui-box-big
- @activities.each do |update|
- = render "projects/feed", :update => update, :project => @project
+ %a.project-update.titled{:href => project_commits_path(@project, :ref => update.head.name)}
+ = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40
+ %span.update-title
+ = dashboard_feed_title(update)
+ %span.update-author
+ %strong= update.author_name
+ authored
+ = time_ago_in_words(update.created_at)
+ ago
+ .right-block
+ %span.update-title
+ %span.commit.tag= update.head.name
+ %span.update-author
+ .right= truncate update.commit.id
+
diff --git a/app/views/repositories/tags.html.haml b/app/views/repositories/tags.html.haml
index 6c8e377a72a..bff838fa7f0 100644
--- a/app/views/repositories/tags.html.haml
+++ b/app/views/repositories/tags.html.haml
@@ -6,5 +6,8 @@
%a.update-item{:href => project_commits_path(@project, :ref => tag.name)}
%span.update-title{:style => "margin-bottom:0px;"}
= tag.name
+ %span.update-author.right
+ = time_ago_in_words(tag.commit.committed_date)
+ ago
- else
%h3 No tags