Use Project creator's avatar in fork listing. #2406

This commit is contained in:
Rubén Dávila 2016-01-11 15:36:42 -05:00
parent 7765ce1875
commit 2b05bf4be5
5 changed files with 12 additions and 4 deletions

View file

@ -4,6 +4,7 @@ class Projects::ForksController < Projects::ApplicationController
before_action :authorize_download_code!
def index
@forked_projects = project.forks.includes(:creator)
end
def new
@ -13,7 +14,7 @@ class Projects::ForksController < Projects::ApplicationController
def create
namespace = Namespace.find(params[:namespace_key])
@forked_project = namespace.projects.find_by(path: project.path)
@forked_project = nil unless @forked_project && @forked_project.forked_from_project == project

View file

@ -9,7 +9,7 @@
%span.count
= @project.forks_count
- else
= link_to new_namespace_project_forks_path(@project.namespace, @project), title: "Fork project", class: 'btn has_tooltip' do
= link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn has_tooltip' do
= icon('code-fork fw')
Fork
%div.count-with-arrow

View file

@ -0,0 +1,3 @@
.projects-list-holder
= render 'shared/projects/list', projects: @forked_projects, use_creator_avatar: true

View file

@ -1,5 +1,6 @@
- projects_limit = 20 unless local_assigns[:projects_limit]
- avatar = true unless local_assigns[:avatar] == false
- use_creator_avatar = false unless local_assigns[:use_creator_avatar] == true
- stars = true unless local_assigns[:stars] == false
- ci = false unless local_assigns[:ci] == true
- skip_namespace = false unless local_assigns[:skip_namespace] == true
@ -8,7 +9,7 @@
- projects.each_with_index do |project, i|
- css_class = (i >= projects_limit) ? 'hide' : nil
= render "shared/projects/project", project: project, skip_namespace: skip_namespace,
avatar: avatar, stars: stars, css_class: css_class, ci: ci
avatar: avatar, stars: stars, css_class: css_class, ci: ci, use_creator_avatar: use_creator_avatar
- if projects.size > projects_limit
%li.bottom.center

View file

@ -13,7 +13,10 @@
= link_to project_path(project), class: dom_class(project) do
- if avatar
.dash-project-avatar
= project_icon(project, alt: '', class: 'avatar project-avatar s46')
- if use_creator_avatar
= image_tag avatar_icon(project.creator.email, 46), class: "avatar s46", alt:''
- else
= project_icon(project, alt: '', class: 'avatar project-avatar s46')
%span.project-full-name
%span.namespace-name
- if project.namespace && !skip_namespace