Skip to content

Commit

Permalink
#66 In the contributors widget, wiki contributors are displayed at the
Browse files Browse the repository at this point in the history
beginning and then repo contributors.

Still we have to filter lab members and customise the layout
  • Loading branch information
adrianq committed Mar 25, 2014
1 parent 0b5df03 commit 4c76efe
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions app/helpers/wiki_helper.rb
Expand Up @@ -41,30 +41,38 @@ def wiki_page_breadcrumb(page)
})
end

def contributors(project, mode)
contributorsDict = Hash.new
def contributors(project, page)
contributorsDict = ActiveSupport::OrderedHash.new

if mode == 'committers'
project.repository.committers.each do |committer, user_id|
contributorsDict[user_id] = committer
end
versions = page.content.versions.
select("id, author_id, version").
reorder('version DESC').
all

else
project.memberships.each do |user|
print "taka"
print user.user_id
versions.each do |ver|
unless ver.author.id.nil?
contributorsDict[ver.author.id] = {:name => ver.author.name, :contributorTo => 'wiki contributor'}
end
end

contributorsDict[user.user_id] = user.name
unless project.repository.nil?
project.repository.committers.each do |committer, user_id|
unless user_id.nil?
if contributorsDict.has_key?(user_id)
contributorsDict[user_id] = {:name => committer, :contributorTo => 'wiki & code contributor'}
else
contributorsDict[user_id] = {:name => committer, :contributorTo => 'code contributor'}
end
else
contributorsDict[committer.to_s.split('<').first] = {:name => committer, :contributorTo => 'code contributor'}
end
end

end

# @comittersArray = project.repository.committers
# project.memberships.each do |user|
# contributorsDict[user.user_id] = user.name
# end

# return repository.
# changesets.
# reorder("#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC").
# all
return contributorsDict
end

Expand Down

0 comments on commit 4c76efe

Please sign in to comment.