diff --git a/app/controllers/git/base_controller.rb b/app/controllers/git/base_controller.rb index 5784d39f2..027d3bf60 100644 --- a/app/controllers/git/base_controller.rb +++ b/app/controllers/git/base_controller.rb @@ -1,12 +1,17 @@ class Git::BaseController < ApplicationController before_filter :authenticate_user! + before_filter :find_platfrom before_filter :find_project before_filter :find_repository protected + def find_platform + @platform = Platform.find_by_name!(params[:platform_name]) + end + def find_project - @project = Project.find_by_title!(params[:project_name]) + @project = Project.find_by_name!(params[:project_name]) end def find_repository diff --git a/app/controllers/git/repositories_controller.rb b/app/controllers/git/repositories_controller.rb index 8f224d563..39cace0d9 100644 --- a/app/controllers/git/repositories_controller.rb +++ b/app/controllers/git/repositories_controller.rb @@ -5,9 +5,9 @@ class Git::RepositoriesController < Git::BaseController @tree = @commit.tree end - def commits - branch_name = (params[:branch] ? params[:branch] : "master") - @commits = @repository.commits(branch_name) - end +# def commits +# branch_name = (params[:branch] ? params[:branch] : "master") +# @commits = @repository.commits(branch_name) +# end end \ No newline at end of file diff --git a/app/controllers/git/trees_controller.rb b/app/controllers/git/trees_controller.rb index ed154ea65..af9ed8a09 100644 --- a/app/controllers/git/trees_controller.rb +++ b/app/controllers/git/trees_controller.rb @@ -7,6 +7,6 @@ class Git::TreesController < Git::BaseController @tree = @repository.tree(@treeish) @tree = @tree / @path if @path -# render :template => "repositories/show" + render :template => "git/repositories/show" end end \ No newline at end of file diff --git a/app/models/git/repository.rb b/app/models/git/repository.rb index 0ee2fdfd6..b07145539 100644 --- a/app/models/git/repository.rb +++ b/app/models/git/repository.rb @@ -1,5 +1,5 @@ class Git::Repository - delegate :commits, :tree, :to => :repo + delegate :commits, :tree, :tags, :heads, :to => :repo attr_accessor :path, :name diff --git a/app/views/git/repositories/show.html.haml b/app/views/git/repositories/show.html.haml new file mode 100644 index 000000000..5568b5761 --- /dev/null +++ b/app/views/git/repositories/show.html.haml @@ -0,0 +1,34 @@ +.row= link_to "Commits", commits_path(@platform.name, @project.name, @treeish) +.row.tags + %h3 Tags: + %ul + - @repository.tags.each do |tag| + %li= link_to tag.name, tree_path(@platform.name, @project.name, tag.name) + +.row.heads + %h3 Heads: + %ul + - @repository.heads.each do |head| + %li= link_to head.name, tree_path(@platform.name, @project.name, head.name) + +%table + %thead + %tr + %th name + %th age + %th message + + %tbody + - if @path.present? + %tr + %td + = link_to "..", tree_path(@platform.name, @project.name, @treeish, File.join([@path, ".."].compact)) + - @tree.contents.each do |entry| + %tr + %td + - if entry.is_a?(Grit::Blob) + = link_to entry.name, blob_path(@platform.name, @project.name, @treeish, File.join([@path, entry.name].compact)) + - else + = link_to "#{entry.name}/", tree_path(@platform.name, @project.name, @repository.name, @treeish, File.join([@path, entry.name].compact)) + %td==   + %td==   \ No newline at end of file