Commit 5f4a7c3e04f9511be01234b9f2d7bd0134491b22

Authored by Dmitriy Zaporozhets
1 parent 40ac2ebc

Home tab added, Repository tab removed\n Ability to download branch

app/assets/images/Home-UI.PNG

782 Bytes

app/assets/images/home_icon.PNG 0 → 100644

596 Bytes

app/assets/stylesheets/common.scss
@@ -98,6 +98,7 @@ a { @@ -98,6 +98,7 @@ a {
98 } 98 }
99 99
100 nav.main_menu { 100 nav.main_menu {
  101 + overflow:hidden;
101 border-radius: 4px; 102 border-radius: 4px;
102 margin: auto; 103 margin: auto;
103 margin:30px $app_padding; 104 margin:30px $app_padding;
@@ -116,7 +117,7 @@ nav.main_menu { @@ -116,7 +117,7 @@ nav.main_menu {
116 117
117 118
118 .count { 119 .count {
119 - color:#bbb; 120 + color:#aaa;
120 margin-left:3px; 121 margin-left:3px;
121 } 122 }
122 123
@@ -149,7 +150,9 @@ nav.main_menu { @@ -149,7 +150,9 @@ nav.main_menu {
149 150
150 151
151 &.home { 152 &.home {
152 - padding:7px 35px; 153 + background: url(home_icon.PNG) no-repeat center center;
  154 + text-indent:-9999px;
  155 + min-width:40px;
153 156
154 img { 157 img {
155 position:relative; 158 position:relative;
@@ -157,7 +160,7 @@ nav.main_menu { @@ -157,7 +160,7 @@ nav.main_menu {
157 } 160 }
158 } 161 }
159 &.current { 162 &.current {
160 - background:#DDD; 163 + background-color:#DDD;
161 } 164 }
162 } 165 }
163 } 166 }
@@ -346,3 +349,24 @@ img.lil_av { @@ -346,3 +349,24 @@ img.lil_av {
346 .well.padded { 349 .well.padded {
347 padding:29px; 350 padding:29px;
348 } 351 }
  352 +
  353 +.download_repo_link {
  354 + background: url("images.png") no-repeat 0 -48px;
  355 + padding-left:20px;
  356 +}
  357 +
  358 +.number {
  359 + border-radius: 4px;
  360 + text-shadow: none;
  361 + background: rgba(0,0,0,.12);
  362 + text-align: center;
  363 + padding: 2px 4px;
  364 + line-height:20px;
  365 + margin-left:2px;
  366 +}
  367 +
  368 +table a code {
  369 + position: relative;
  370 + top: -2px;
  371 + margin-right: 3px;
  372 +}
app/controllers/protected_branches_controller.rb
@@ -7,6 +7,7 @@ class ProtectedBranchesController < ApplicationController @@ -7,6 +7,7 @@ class ProtectedBranchesController < ApplicationController
7 before_filter :require_non_empty_project 7 before_filter :require_non_empty_project
8 8
9 before_filter :authorize_admin_project!, :only => [:destroy, :create] 9 before_filter :authorize_admin_project!, :only => [:destroy, :create]
  10 + before_filter :render_full_content
10 11
11 layout "project" 12 layout "project"
12 13
app/controllers/repositories_controller.rb
@@ -5,6 +5,7 @@ class RepositoriesController < ApplicationController @@ -5,6 +5,7 @@ class RepositoriesController < ApplicationController
5 before_filter :add_project_abilities 5 before_filter :add_project_abilities
6 before_filter :authorize_read_project! 6 before_filter :authorize_read_project!
7 before_filter :require_non_empty_project 7 before_filter :require_non_empty_project
  8 + before_filter :render_full_content
8 9
9 layout "project" 10 layout "project"
10 11
app/helpers/projects_helper.rb
@@ -22,6 +22,8 @@ module ProjectsHelper @@ -22,6 +22,8 @@ module ProjectsHelper
22 end 22 end
23 23
24 if controller.controller_name == "snippets" || 24 if controller.controller_name == "snippets" ||
  25 + controller.controller_name == "hooks" ||
  26 + controller.controller_name == "deploy_keys" ||
25 controller.controller_name == "team_members" 27 controller.controller_name == "team_members"
26 "current" 28 "current"
27 end 29 end
@@ -33,11 +35,26 @@ module ProjectsHelper @@ -33,11 +35,26 @@ module ProjectsHelper
33 end 35 end
34 36
35 def repository_tab_class 37 def repository_tab_class
36 - if controller.controller_name == "repositories" ||  
37 - controller.controller_name == "hooks" || 38 + #if controller.controller_name == "repositories" ||
  39 + #controller.controller_name == "hooks" ||
  40 + #controller.controller_name == "deploy_keys"
  41 + #"current"
  42 + #end
  43 + end
  44 +
  45 + def commit_tab_class
  46 + if controller.controller_name == "commits" ||
  47 + controller.controller_name == "repositories" ||
  48 + controller.controller_name == "protected_branches"
  49 + "current"
  50 + end
  51 + end
  52 +
  53 + def branches_tab_class
  54 + if current_page?(branches_project_repository_path(@project)) ||
38 controller.controller_name == "protected_branches" || 55 controller.controller_name == "protected_branches" ||
39 - controller.controller_name == "deploy_keys"  
40 - "current" 56 + current_page?(project_repository_path(@project))
  57 + 'active'
41 end 58 end
42 end 59 end
43 end 60 end
app/views/commits/_head.html.haml
@@ -6,12 +6,19 @@ @@ -6,12 +6,19 @@
6 6
7 %li{:class => "#{'active' if current_page?(project_commits_path(@project)) }"} 7 %li{:class => "#{'active' if current_page?(project_commits_path(@project)) }"}
8 = link_to project_commits_path(@project) do 8 = link_to project_commits_path(@project) do
9 - %span  
10 Commits 9 Commits
11 %li{:class => "#{'active' if current_page?(compare_project_commits_path(@project)) }"} 10 %li{:class => "#{'active' if current_page?(compare_project_commits_path(@project)) }"}
12 = link_to compare_project_commits_path(@project) do 11 = link_to compare_project_commits_path(@project) do
13 - %span  
14 Compare 12 Compare
  13 + %li{:class => "#{branches_tab_class}"}
  14 + = link_to project_repository_path(@project) do
  15 + Branches
  16 + %span.number= @project.repo.branches.count
  17 +
  18 + %li{:class => "#{'active' if current_page?(tags_project_repository_path(@project)) }"}
  19 + = link_to tags_project_repository_path(@project) do
  20 + Tags
  21 + %span.number= @project.repo.tags.count
15 22
16 23
17 24
app/views/hooks/index.html.haml
1 -= render "repositories/head" 1 += render "projects/project_head"
2 2
3 - if can? current_user, :admin_project, @project 3 - if can? current_user, :admin_project, @project
4 .alert-message.block-message 4 .alert-message.block-message
app/views/layouts/_app_menu.html.haml
1 %nav.main_menu 1 %nav.main_menu
2 - = link_to "Projects", projects_path, :class => "#{"current" if current_page?(projects_path) || current_page?(root_path)}" 2 + = render "layouts/const_menu_links"
  3 + -#= link_to "Projects", projects_path, :class => "#{"current" if current_page?(projects_path) || current_page?(root_path)}"
3 = link_to "Issues", dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide" 4 = link_to "Issues", dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide"
4 = link_to "Requests", dashboard_merge_requests_path, :class => "#{"current" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide" 5 = link_to "Requests", dashboard_merge_requests_path, :class => "#{"current" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide"
5 = link_to "Help", help_path, :class => "#{"current" if controller.controller_name == "help"}" 6 = link_to "Help", help_path, :class => "#{"current" if controller.controller_name == "help"}"
app/views/layouts/_const_menu_links.html.haml 0 → 100644
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 += link_to "Home", root_path, :class => "home #{"current" if current_page?(projects_path) || current_page?(root_path)}", :title => "Home"
app/views/layouts/_project_menu.html.haml
1 %nav.main_menu 1 %nav.main_menu
  2 + = render "layouts/const_menu_links"
2 = link_to project_path(@project), :class => "#{project_tab_class}", :title => "Project" do 3 = link_to project_path(@project), :class => "#{project_tab_class}", :title => "Project" do
3 Project 4 Project
4 5
5 - if @project.repo_exists? 6 - if @project.repo_exists?
6 - = link_to "Repository", project_repository_path(@project), :class => repository_tab_class  
7 = link_to "Files", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class 7 = link_to "Files", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class
8 - = link_to "Commits", project_commits_path(@project), :class => (controller.controller_name == "commits") ? "current" : nil 8 + = link_to "Commits", project_commits_path(@project), :class => commit_tab_class
9 9
10 = link_to "Network", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil 10 = link_to "Network", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil
11 - if @project.issues_enabled 11 - if @project.issues_enabled
app/views/layouts/admin.html.haml
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 = render "layouts/head_panel", :title => "Admin area" 6 = render "layouts/head_panel", :title => "Admin area"
7 .container 7 .container
8 %nav.main_menu 8 %nav.main_menu
  9 + = render "layouts/const_menu_links"
9 = link_to "Users", admin_users_path, :class => controller.controller_name == "users" ? "current" : nil 10 = link_to "Users", admin_users_path, :class => controller.controller_name == "users" ? "current" : nil
10 = link_to "Projects", admin_projects_path, :class => controller.controller_name == "projects" ? "current" : nil 11 = link_to "Projects", admin_projects_path, :class => controller.controller_name == "projects" ? "current" : nil
11 = link_to "Emails", admin_emails_path, :class => controller.controller_name == "mailer" ? "current" : nil 12 = link_to "Emails", admin_emails_path, :class => controller.controller_name == "mailer" ? "current" : nil
app/views/layouts/profile.html.haml
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 = render "layouts/head_panel", :title => "Profile" 6 = render "layouts/head_panel", :title => "Profile"
7 .container 7 .container
8 %nav.main_menu 8 %nav.main_menu
  9 + = render "layouts/const_menu_links"
9 = link_to "Profile", profile_path, :class => current_page?(:controller => "profile", :action => :show) ? "current" : nil 10 = link_to "Profile", profile_path, :class => current_page?(:controller => "profile", :action => :show) ? "current" : nil
10 = link_to "Password & token", profile_password_path, :class => current_page?(:controller => "profile", :action => :password) ? "current" : nil 11 = link_to "Password & token", profile_password_path, :class => current_page?(:controller => "profile", :action => :password) ? "current" : nil
11 = link_to "Design", profile_design_path, :class => current_page?(:controller => "profile", :action => :design) ? "current" : nil 12 = link_to "Design", profile_design_path, :class => current_page?(:controller => "profile", :action => :design) ? "current" : nil
app/views/projects/_project_head.html.haml
@@ -16,3 +16,16 @@ @@ -16,3 +16,16 @@
16 %li{ :class => " #{'active' if (controller.controller_name == "snippets") }" } 16 %li{ :class => " #{'active' if (controller.controller_name == "snippets") }" }
17 = link_to project_snippets_path(@project), :class => "snippets-tab tab" do 17 = link_to project_snippets_path(@project), :class => "snippets-tab tab" do
18 Snippets 18 Snippets
  19 + -#%li{:class => "#{'active' if current_page?(project_repository_path(@project)) }"}
  20 + -#= link_to project_repository_path(@project) do
  21 + -#%span
  22 + -#Activities
  23 + %li{:class => "#{'active' if controller.controller_name == "hooks" }"}
  24 + = link_to project_hooks_path(@project) do
  25 + %span
  26 + Hooks
  27 + %li{:class => "#{'active' if controller.controller_name == "deploy_keys"}"}
  28 + - if can? current_user, :admin_project, @project
  29 + = link_to project_deploy_keys_path(@project) do
  30 + %span
  31 + Deploy Keys
app/views/repositories/_branch.html.haml 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +%tr
  2 + %td
  3 + = link_to project_commits_path(@project, :ref => branch.name) do
  4 + %strong= branch.name
  5 + - if branch.name == @project.root_ref
  6 + %span.label default
  7 + %td
  8 + = link_to project_commits_path(@project, branch.commit.id) do
  9 + %code= branch.commit.id.to_s[0..10]
  10 +
  11 + = image_tag gravatar_icon(Commit.new(branch.commit).author_email), :class => "", :width => 16
  12 + = truncate(Commit.new(branch.commit).safe_message, :length => 40)
  13 + %td
  14 + %span.update-author.right
  15 + = time_ago_in_words(branch.commit.committed_date)
  16 + ago
  17 + %td
  18 + - if can? current_user, :download_code, @project
  19 + = link_to "Download", archive_project_repository_path(@project, :ref => branch.name), :class => "visible_link download_repo_link"
  20 +
app/views/repositories/_branches_head.html.haml
1 -= render "repositories/head" 1 += render "commits/head"
2 %ul.pills 2 %ul.pills
3 - %li{:class => ("active" if current_page?(branches_project_repository_path(@project)))}  
4 - = link_to branches_project_repository_path(@project) do  
5 - All 3 + %li{:class => ("active" if current_page?(project_repository_path(@project)))}
  4 + = link_to project_repository_path(@project) do
  5 + Recent
6 %li{:class => ("active" if current_page?(project_protected_branches_path(@project)))} 6 %li{:class => ("active" if current_page?(project_protected_branches_path(@project)))}
7 = link_to project_protected_branches_path(@project) do 7 = link_to project_protected_branches_path(@project) do
8 Protected 8 Protected
  9 + %li{:class => ("active" if current_page?(branches_project_repository_path(@project)))}
  10 + = link_to branches_project_repository_path(@project) do
  11 + All
9 %hr 12 %hr
app/views/repositories/_feed.html.haml
@@ -4,9 +4,13 @@ @@ -4,9 +4,13 @@
4 = link_to project_commits_path(@project, :ref => commit.head.name) do 4 = link_to project_commits_path(@project, :ref => commit.head.name) do
5 %strong 5 %strong
6 = commit.head.name 6 = commit.head.name
  7 + - if commit.head.name == @project.root_ref
  8 + %span.label default
  9 +
7 %td 10 %td
8 %div 11 %div
9 - %code= commit.id.to_s[0..10] 12 + = link_to project_commits_path(@project, commit.id) do
  13 + %code= commit.id.to_s[0..10]
10 = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16 14 = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16
11 = truncate(commit.safe_message, :length => 40) 15 = truncate(commit.safe_message, :length => 40)
12 %td 16 %td
app/views/repositories/_head.html.haml
1 -%ul.tabs  
2 - %li{:class => "#{'active' if current_page?(project_repository_path(@project)) }"}  
3 - = link_to project_repository_path(@project) do  
4 - %span  
5 - Activities  
6 - %li{:class => "#{'active' if current_page?(branches_project_repository_path(@project)) || current_page?(project_protected_branches_path(@project)) }"}  
7 - = link_to branches_project_repository_path(@project) do  
8 - %span  
9 - Branches  
10 - %li{:class => "#{'active' if current_page?(tags_project_repository_path(@project)) }"}  
11 - = link_to tags_project_repository_path(@project) do  
12 - %span  
13 - Tags  
14 - %li{:class => "#{'active' if controller.controller_name == "hooks" }"}  
15 - = link_to project_hooks_path do  
16 - %span  
17 - Hooks  
18 - %li{:class => "#{'active' if controller.controller_name == "deploy_keys"}"}  
19 - - if can? current_user, :admin_project, @project  
20 - = link_to project_deploy_keys_path(@project) do  
21 - %span  
22 - Deploy Keys  
23 - 1 += render "projects/project_head"
app/views/repositories/branches.html.haml
1 = render "repositories/branches_head" 1 = render "repositories/branches_head"
2 - unless @branches.empty? 2 - unless @branches.empty?
3 %table.zebra-striped.borders 3 %table.zebra-striped.borders
4 - %thead  
5 - %tr  
6 - %th Name  
7 - %th Last commit  
8 %tbody 4 %tbody
9 - @branches.each do |branch| 5 - @branches.each do |branch|
10 - %tr  
11 - %td  
12 - = link_to project_commits_path(@project, :ref => branch.name) do  
13 - %strong= branch.name  
14 - - if branch.name == @project.root_ref  
15 - %span.label default  
16 - %td  
17 - = link_to project_commits_path(@project, branch.commit.id) do  
18 - = truncate branch.commit.id.to_s, :length => 10  
19 - = time_ago_in_words(branch.commit.committed_date)  
20 - ago 6 + = render "repositories/branch", :branch => branch
app/views/repositories/show.html.haml
1 -= render "head"  
2 -%h3  
3 - = @project.name  
4 - - if can? current_user, :download_code, @project  
5 - = link_to "Download", archive_project_repository_path(@project), :class => "btn small right"  
6 -  
7 -  
8 -%hr  
9 -.entry  
10 - %p  
11 - Last commit was  
12 - %small  
13 - %code= @activities.first.commit.id.to_s[0..10]  
14 -  
15 - = time_ago_in_words(@activities.first.commit.committed_date)  
16 - ago to  
17 - = link_to project_commits_path(@project, :ref => @activities.first.head.name), :class => "visible_link" do  
18 - %span.label= @activities.first.head.name  
19 -.alert-message.block-message.warning  
20 - .input  
21 - .input-prepend  
22 - %span.add-on git clone  
23 - = text_field_tag :project_clone, @project.url_to_repo, :class => "xlarge one_click_select git_clone_url"  
24 -  
25 -  
26 -  
27 -%h5.cgray  
28 - Recently updated branches 1 += render "branches_head"
29 2
30 %table.zebra-striped.borders 3 %table.zebra-striped.borders
31 - @activities.each do |update| 4 - @activities.each do |update|
32 - = render "repositories/feed", :update => update, :project => @project 5 + = render "repositories/branch", :branch => update.head
33 6
app/views/repositories/tags.html.haml
1 -= render "head" 1 += render "commits/head"
2 - unless @tags.empty? 2 - unless @tags.empty?
3 %table.zebra-striped.borders 3 %table.zebra-striped.borders
4 - @tags.each do |tag| 4 - @tags.each do |tag|
5 %tr 5 %tr
6 %td 6 %td
7 - = tag.name  
8 - %code= tag.commit.id.to_s[0..10] 7 + %strong= link_to tag.name, project_commits_path(@project, :ref => tag.name), :class => ""
  8 + %td
  9 + = link_to project_commits_path(@project, tag.commit.id) do
  10 + %code= tag.commit.id.to_s[0..10]
  11 + = image_tag gravatar_icon(Commit.new(tag.commit).author_email), :class => "", :width => 16
  12 + = truncate(Commit.new(tag.commit).safe_message, :length => 40)
  13 + %td
9 %span.update-author.right 14 %span.update-author.right
10 = time_ago_in_words(tag.commit.committed_date) 15 = time_ago_in_words(tag.commit.committed_date)
11 ago 16 ago
12   17  
13 %td 18 %td
14 - if can? current_user, :download_code, @project 19 - if can? current_user, :download_code, @project
15 - = link_to "Download", archive_project_repository_path(@project, :ref => tag.name), :class => "btn small"  
16 - = link_to "Commits", project_commits_path(@project, :ref => tag.name), :class => "btn small" 20 + = link_to "Download", archive_project_repository_path(@project, :ref => tag.name), :class => "visible_link download_repo_link"
17 21
18 - else 22 - else
19 %h3 No tags 23 %h3 No tags
spec/requests/repositories_spec.rb
@@ -18,10 +18,6 @@ describe "Repository" do @@ -18,10 +18,6 @@ describe "Repository" do
18 current_path.should == project_repository_path(@project) 18 current_path.should == project_repository_path(@project)
19 end 19 end
20 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 21 it "should have link to last commit for activities tab" do
26 page.should have_content(@project.commit.safe_message[0..20]) 22 page.should have_content(@project.commit.safe_message[0..20])
27 end 23 end