Commit a667c713128b3dd8dece604e4aae3519ab7e57ed
1 parent
d8247012
Exists in
master
and in
4 other branches
repo branches and tags
Showing
7 changed files
with
62 additions
and
5 deletions
Show diff stats
app/assets/stylesheets/projects.css.scss
| ... | ... | @@ -598,6 +598,7 @@ h4.middle-panel { |
| 598 | 598 | } |
| 599 | 599 | } |
| 600 | 600 | } |
| 601 | +.merge-tabs.repository .tab span{ background: url("images.png") no-repeat -38px -77px; } | |
| 601 | 602 | .activities-tab span { background: url("images.png") no-repeat -161px -1px; } |
| 602 | 603 | .stat-tab span, |
| 603 | 604 | .team-tab span, | ... | ... |
app/controllers/repositories_controller.rb
| ... | ... | @@ -11,4 +11,12 @@ class RepositoriesController < ApplicationController |
| 11 | 11 | def show |
| 12 | 12 | @activities = @project.fresh_commits(20) |
| 13 | 13 | end |
| 14 | + | |
| 15 | + def branches | |
| 16 | + @branches = @project.repo.heads.sort_by(&:name) | |
| 17 | + end | |
| 18 | + | |
| 19 | + def tags | |
| 20 | + @tags = @project.repo.tags.sort_by(&:name).reverse | |
| 21 | + end | |
| 14 | 22 | end | ... | ... |
app/views/repositories/_head.html.haml
| ... | ... | @@ -2,16 +2,16 @@ |
| 2 | 2 | = link_to project_repository_path(@project), :class => "activities-tab tab #{'active' if current_page?(project_repository_path(@project)) }" do |
| 3 | 3 | %span |
| 4 | 4 | Activities |
| 5 | - = link_to "#", :class => "tab" do | |
| 5 | + = link_to branches_project_repository_path(@project), :class => "tab #{'active' if current_page?(branches_project_repository_path(@project)) }" do | |
| 6 | 6 | %span |
| 7 | 7 | Branches |
| 8 | - = link_to "#", :class => "tab" do | |
| 8 | + = link_to tags_project_repository_path(@project), :class => "tab #{'active' if current_page?(tags_project_repository_path(@project)) }" do | |
| 9 | 9 | %span |
| 10 | 10 | Tags |
| 11 | - = link_to "#", :class => "tab" do | |
| 11 | + -#= link_to "#", :class => "tab" do | |
| 12 | 12 | %span |
| 13 | 13 | Hooks |
| 14 | - = link_to "#", :class => "tab" do | |
| 14 | + -#= link_to "#", :class => "tab" do | |
| 15 | 15 | %span |
| 16 | 16 | Deploy Keys |
| 17 | 17 | ... | ... |
| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | += render "head" | |
| 2 | +- unless @branches.empty? | |
| 3 | + %div.update-data.ui-box.ui-box-small | |
| 4 | + .data | |
| 5 | + - @branches.each do |branch| | |
| 6 | + %a.update-item{:href => project_commits_path(@project, :ref => branch.name)} | |
| 7 | + %span.update-title{:style => "margin-bottom:0px;"} | |
| 8 | + = branch.name | |
| 9 | +- else | |
| 10 | + %h3 No brances | ... | ... |
| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | += render "head" | |
| 2 | +- unless @tags.empty? | |
| 3 | + %div.update-data.ui-box.ui-box-small | |
| 4 | + .data | |
| 5 | + - @tags.each do |tag| | |
| 6 | + %a.update-item{:href => project_commits_path(@project, :ref => tag.name)} | |
| 7 | + %span.update-title{:style => "margin-bottom:0px;"} | |
| 8 | + = tag.name | |
| 9 | +- else | |
| 10 | + %h3 No tags | ... | ... |
config/routes.rb
| ... | ... | @@ -46,7 +46,12 @@ Gitlab::Application.routes.draw do |
| 46 | 46 | get "files" |
| 47 | 47 | end |
| 48 | 48 | |
| 49 | - resource :repository | |
| 49 | + resource :repository do | |
| 50 | + member do | |
| 51 | + get "branches" | |
| 52 | + get "tags" | |
| 53 | + end | |
| 54 | + end | |
| 50 | 55 | |
| 51 | 56 | resources :refs, :only => [], :path => "/" do |
| 52 | 57 | collection do | ... | ... |
spec/requests/repositories_spec.rb
| ... | ... | @@ -31,5 +31,28 @@ describe "Repository" do |
| 31 | 31 | page.all(:css, ".project-update").size.should == 20 |
| 32 | 32 | end |
| 33 | 33 | end |
| 34 | + | |
| 35 | + describe "GET /:project_name/repository/branches" do | |
| 36 | + before do | |
| 37 | + visit branches_project_repository_path(@project) | |
| 38 | + end | |
| 39 | + | |
| 40 | + it "should have link to repo activities" do | |
| 41 | + page.should have_content("Branches") | |
| 42 | + page.should have_content("master") | |
| 43 | + end | |
| 44 | + end | |
| 45 | + | |
| 46 | + # TODO: Add new repo to seeds with tags list | |
| 47 | + describe "GET /:project_name/repository/tags" do | |
| 48 | + before do | |
| 49 | + visit tags_project_repository_path(@project) | |
| 50 | + end | |
| 51 | + | |
| 52 | + it "should have link to repo activities" do | |
| 53 | + page.should have_content("Tags") | |
| 54 | + page.should have_content("No tags") | |
| 55 | + end | |
| 56 | + end | |
| 34 | 57 | end |
| 35 | 58 | ... | ... |