Commit 2c1b06a10f3cc182c003516f18699998e5e7a1dc
Exists in
master
and in
4 other branches
Merge branch 'feature/repository_tab'
Showing
11 changed files
with
153 additions
and
0 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, | ... | ... |
| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | +class RepositoriesController < ApplicationController | |
| 2 | + before_filter :project | |
| 3 | + | |
| 4 | + # Authorize | |
| 5 | + before_filter :add_project_abilities | |
| 6 | + before_filter :authorize_read_project! | |
| 7 | + before_filter :require_non_empty_project | |
| 8 | + | |
| 9 | + layout "project" | |
| 10 | + | |
| 11 | + def show | |
| 12 | + @activities = @project.fresh_commits(20) | |
| 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 | |
| 22 | +end | ... | ... |
app/helpers/projects_helper.rb
app/views/layouts/project.html.haml
| ... | ... | @@ -24,6 +24,7 @@ |
| 24 | 24 | .fixed |
| 25 | 25 | %aside |
| 26 | 26 | = link_to "Project", project_path(@project), :class => project_tab_class |
| 27 | + = link_to "Repository", project_repository_path(@project), :class => repository_tab_class | |
| 27 | 28 | = link_to "Tree", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class |
| 28 | 29 | = link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil |
| 29 | 30 | = link_to "Network graph", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil | ... | ... |
| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | +.merge-tabs.repository | |
| 2 | + = link_to project_repository_path(@project), :class => "activities-tab tab #{'active' if current_page?(project_repository_path(@project)) }" do | |
| 3 | + %span | |
| 4 | + Activities | |
| 5 | + = link_to branches_project_repository_path(@project), :class => "tab #{'active' if current_page?(branches_project_repository_path(@project)) }" do | |
| 6 | + %span | |
| 7 | + Branches | |
| 8 | + = link_to tags_project_repository_path(@project), :class => "tab #{'active' if current_page?(tags_project_repository_path(@project)) }" do | |
| 9 | + %span | |
| 10 | + Tags | |
| 11 | + -#= link_to "#", :class => "tab" do | |
| 12 | + %span | |
| 13 | + Hooks | |
| 14 | + -#= link_to "#", :class => "tab" do | |
| 15 | + %span | |
| 16 | + Deploy Keys | |
| 17 | + | |
| 18 | + | |
| 19 | + | ... | ... |
| ... | ... | @@ -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,7 @@ |
| 1 | +- content_for(:body_class, "project-page dashboard") | |
| 2 | += render "head" | |
| 3 | + | |
| 4 | +#news-feed.news-feed | |
| 5 | + .project-box.project-updates.ui-box.ui-box-small.ui-box-big | |
| 6 | + - @activities.each do |update| | |
| 7 | + = render "projects/feed", :update => update, :project => @project | ... | ... |
| ... | ... | @@ -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
db/schema.rb
| ... | ... | @@ -13,6 +13,18 @@ |
| 13 | 13 | |
| 14 | 14 | ActiveRecord::Schema.define(:version => 20111220190817) do |
| 15 | 15 | |
| 16 | + create_table "features", :force => true do |t| | |
| 17 | + t.string "name" | |
| 18 | + t.string "branch_name" | |
| 19 | + t.integer "assignee_id" | |
| 20 | + t.integer "author_id" | |
| 21 | + t.integer "project_id" | |
| 22 | + t.datetime "created_at" | |
| 23 | + t.datetime "updated_at" | |
| 24 | + t.string "version" | |
| 25 | + t.integer "status", :default => 0, :null => false | |
| 26 | + end | |
| 27 | + | |
| 16 | 28 | create_table "issues", :force => true do |t| |
| 17 | 29 | t.string "title" |
| 18 | 30 | t.integer "assignee_id" | ... | ... |
| ... | ... | @@ -0,0 +1,58 @@ |
| 1 | +require 'spec_helper' | |
| 2 | + | |
| 3 | +describe "Repository" do | |
| 4 | + | |
| 5 | + before do | |
| 6 | + @user = Factory :user | |
| 7 | + @project = Factory :project | |
| 8 | + @project.add_access(@user, :read, :write) | |
| 9 | + login_with @user | |
| 10 | + end | |
| 11 | + | |
| 12 | + describe "GET /:project_name/repository" do | |
| 13 | + before do | |
| 14 | + visit project_repository_path(@project) | |
| 15 | + end | |
| 16 | + | |
| 17 | + it "should be on projects page" do | |
| 18 | + current_path.should == project_repository_path(@project) | |
| 19 | + end | |
| 20 | + | |
| 21 | + it "should have link to repo activities" do | |
| 22 | + page.should have_content("Activities") | |
| 23 | + end | |
| 24 | + | |
| 25 | + it "should have link to last commit for activities tab" do | |
| 26 | + page.should have_content(@project.commit.safe_message[0..20]) | |
| 27 | + page.should have_content(@project.commit.author_name) | |
| 28 | + end | |
| 29 | + | |
| 30 | + it "should show commits list" do | |
| 31 | + page.all(:css, ".project-update").size.should == 20 | |
| 32 | + end | |
| 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 | |
| 57 | +end | |
| 58 | + | ... | ... |