Commit e16cebac3eaadc0df93576358f60ae4a498ce15f

Authored by Dmitriy Zaporozhets
1 parent c6298678

Fixed styles, ProjectHook specs etc

app/assets/stylesheets/gitlab_bootstrap/blocks.scss
@@ -79,13 +79,44 @@ @@ -79,13 +79,44 @@
79 } 79 }
80 80
81 .title { 81 .title {
82 - padding: 0 10px;  
83 @include bg-gray-gradient; 82 @include bg-gray-gradient;
84 border-bottom: 1px solid #CCC; 83 border-bottom: 1px solid #CCC;
  84 + color: #456;
  85 + font-size: 16px;
  86 + text-shadow: 0 1px 1px #fff;
  87 + padding: 0px 10px;
  88 + line-height: 36px;
  89 + font-size: 14px;
  90 + font-weight: normal;
85 91
86 > a { 92 > a {
87 text-shadow: 0 1px 1px #fff; 93 text-shadow: 0 1px 1px #fff;
88 } 94 }
  95 +
  96 + form {
  97 + margin-bottom: 0;
  98 + margin-top: 3px;
  99 + }
  100 +
  101 + .nav-pills {
  102 + > li {
  103 + > a {
  104 + padding: 13px;
  105 + margin: 0;
  106 + font-size: 13px;
  107 + }
  108 + &.active {
  109 + > a {
  110 + background: #D5D5D5;
  111 + color: $style_color;
  112 + @include border-radius(0);
  113 + border-radius: 0;
  114 + border-left: 1px solid #CCC;
  115 + border-right: 1px solid #CCC;
  116 + }
  117 + }
  118 + }
  119 + }
89 } 120 }
90 121
91 &.padded { 122 &.padded {
app/assets/stylesheets/gitlab_bootstrap/lists.scss
@@ -25,6 +25,10 @@ @@ -25,6 +25,10 @@
25 25
26 &:last-child { 26 &:last-child {
27 border-bottom: none; 27 border-bottom: none;
  28 +
  29 + &.bottom {
  30 + background: #f5f5f5;
  31 + }
28 } 32 }
29 33
30 .author { color: #999; } 34 .author { color: #999; }
app/assets/stylesheets/gitlab_bootstrap/tables.scss
@@ -25,7 +25,7 @@ table { @@ -25,7 +25,7 @@ table {
25 } 25 }
26 26
27 th, td { 27 th, td {
28 - padding: 8px; 28 + padding: 10px;
29 line-height: 18px; 29 line-height: 18px;
30 text-align: left; 30 text-align: left;
31 } 31 }
app/assets/stylesheets/sections/issues.scss
@@ -61,31 +61,25 @@ input.check_all_issues { @@ -61,31 +61,25 @@ input.check_all_issues {
61 61
62 #issues-table-holder { 62 #issues-table-holder {
63 .issues_filters { 63 .issues_filters {
64 - form {  
65 - padding: 0;  
66 - margin: 0;  
67 - margin-top:7px  
68 - }  
69 } 64 }
70 65
71 .issues_bulk_update { 66 .issues_bulk_update {
72 margin: 0; 67 margin: 0;
73 form { 68 form {
74 - padding: 0;  
75 - margin: 0;  
76 - margin-top:7px 69 + float:left;
77 } 70 }
78 .update_selected_issues { 71 .update_selected_issues {
79 position: relative; 72 position: relative;
80 - top:-2px; 73 + top:5px;
81 margin-left: 4px; 74 margin-left: 4px;
82 float: left; 75 float: left;
83 } 76 }
84 77
85 .update_issues_text { 78 .update_issues_text {
86 padding: 3px; 79 padding: 3px;
87 - line-height: 18px; 80 + line-height: 28px;
88 float: left; 81 float: left;
  82 + color: #479;
89 } 83 }
90 } 84 }
91 } 85 }
app/assets/stylesheets/sections/projects.scss
@@ -8,14 +8,8 @@ @@ -8,14 +8,8 @@
8 8
9 .groups_box, 9 .groups_box,
10 .projects_box { 10 .projects_box {
11 - > h5 {  
12 - color: #456;  
13 - font-size: 16px;  
14 - text-shadow: 0 1px 1px #fff; 11 + > .title {
15 padding: 2px 15px; 12 padding: 2px 15px;
16 - line-height: 36px;  
17 - font-size: 14px;  
18 - font-weight: normal;  
19 } 13 }
20 .nav-projects-tabs li { padding: 0; } 14 .nav-projects-tabs li { padding: 0; }
21 .well-list { 15 .well-list {
app/models/commit.rb
@@ -98,6 +98,8 @@ class Commit @@ -98,6 +98,8 @@ class Commit
98 end 98 end
99 99
100 def initialize(raw_commit, head = nil) 100 def initialize(raw_commit, head = nil)
  101 + raise "Nil as raw commit passed" unless raw_commit
  102 +
101 @commit = raw_commit 103 @commit = raw_commit
102 @head = head 104 @head = head
103 end 105 end
@@ -136,7 +138,11 @@ class Commit @@ -136,7 +138,11 @@ class Commit
136 end 138 end
137 139
138 def prev_commit 140 def prev_commit
139 - parents.try :first 141 + @prev_commit ||= if parents.present?
  142 + Commit.new(parents.first)
  143 + else
  144 + nil
  145 + end
140 end 146 end
141 147
142 def prev_commit_id 148 def prev_commit_id
app/models/project.rb
@@ -361,8 +361,8 @@ class Project < ActiveRecord::Base @@ -361,8 +361,8 @@ class Project < ActiveRecord::Base
361 361
362 # Discover the default branch, but only if it hasn't already been set to 362 # Discover the default branch, but only if it hasn't already been set to
363 # something else 363 # something else
364 - if default_branch.nil?  
365 - update_attributes(default_branch: discover_default_branch) 364 + if repository && default_branch.nil?
  365 + update_attributes(default_branch: self.repository.discover_default_branch)
366 end 366 end
367 end 367 end
368 368
app/views/admin/dashboard/index.html.haml
1 .admin_dash.row 1 .admin_dash.row
2 .span3 2 .span3
3 .ui-box 3 .ui-box
4 - %h5 Projects 4 + %h5.title Projects
5 .data.padded 5 .data.padded
6 = link_to admin_projects_path do 6 = link_to admin_projects_path do
7 %h1= Project.count 7 %h1= Project.count
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 = link_to 'New Project', new_project_path, class: "btn small" 9 = link_to 'New Project', new_project_path, class: "btn small"
10 .span3 10 .span3
11 .ui-box 11 .ui-box
12 - %h5 Groups 12 + %h5.title Groups
13 .data.padded 13 .data.padded
14 = link_to admin_groups_path do 14 = link_to admin_groups_path do
15 %h1= Group.count 15 %h1= Group.count
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 = link_to 'New Group', new_admin_group_path, class: "btn small" 17 = link_to 'New Group', new_admin_group_path, class: "btn small"
18 .span3 18 .span3
19 .ui-box 19 .ui-box
20 - %h5 Users 20 + %h5.title Users
21 .data.padded 21 .data.padded
22 = link_to admin_users_path do 22 = link_to admin_users_path do
23 %h1= User.count 23 %h1= User.count
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 = link_to 'New User', new_admin_user_path, class: "btn small" 25 = link_to 'New User', new_admin_user_path, class: "btn small"
26 .span3 26 .span3
27 .ui-box 27 .ui-box
28 - %h5 28 + %h5.title
29 Resque Workers 29 Resque Workers
30 .data.padded 30 .data.padded
31 - if @resque_accessible 31 - if @resque_accessible
app/views/admin/projects/show.html.haml
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 %i.icon-edit 4 %i.icon-edit
5 Edit 5 Edit
6 6
7 -- if @repository.has_commits? 7 +- if @repository && @repository.has_commits?
8 - if !@repository.has_post_receive_file? 8 - if !@repository.has_post_receive_file?
9 %br 9 %br
10 .alert.alert-error 10 .alert.alert-error
@@ -65,42 +65,43 @@ @@ -65,42 +65,43 @@
65 Created at: 65 Created at:
66 %td 66 %td
67 = @project.created_at.stamp("March 1, 1999") 67 = @project.created_at.stamp("March 1, 1999")
  68 + %tr
  69 + %td
  70 + %b
  71 + Smart HTTP:
  72 + %td
  73 + = link_to @project.http_url_to_repo
  74 + %tr
  75 + %td
  76 + %b
  77 + SSH:
  78 + %td
  79 + = link_to @project.ssh_url_to_repo
68 80
69 -%table.zebra-striped  
70 - %thead 81 +- if @repository
  82 + %table.zebra-striped
  83 + %thead
  84 + %tr
  85 + %th Repository
  86 + %th
71 %tr 87 %tr
72 - %th Repository  
73 - %th  
74 - %tr  
75 - %td  
76 - %b  
77 - FS Path:  
78 - %td  
79 - %code= @repository.path_to_repo  
80 - %tr  
81 - %td  
82 - %b  
83 - Smart HTTP:  
84 - %td  
85 - = link_to @project.http_url_to_repo  
86 - %tr  
87 - %td  
88 - %b  
89 - SSH:  
90 - %td  
91 - = link_to @project.ssh_url_to_repo  
92 - %tr  
93 - %td  
94 - %b  
95 - Last commit at:  
96 - %td  
97 - = last_commit(@project)  
98 - %tr  
99 - %td  
100 - %b  
101 - Post Receive File:  
102 - %td  
103 - = check_box_tag :post_receive_file, 1, @repository.has_post_receive_file?, disabled: true 88 + %td
  89 + %b
  90 + FS Path:
  91 + %td
  92 + %code= @repository.path_to_repo
  93 + %tr
  94 + %td
  95 + %b
  96 + Last commit at:
  97 + %td
  98 + = last_commit(@project)
  99 + %tr
  100 + %td
  101 + %b
  102 + Post Receive File:
  103 + %td
  104 + = check_box_tag :post_receive_file, 1, @repository.has_post_receive_file?, disabled: true
104 105
105 %br 106 %br
106 %h5 107 %h5
app/views/commits/_commits.html.haml
1 - @commits.group_by { |c| c.committed_date.to_date }.each do |day, commits| 1 - @commits.group_by { |c| c.committed_date.to_date }.each do |day, commits|
2 %div.ui-box 2 %div.ui-box
3 - %h6.title 3 + %h5.title
4 %i.icon-calendar 4 %i.icon-calendar
5 = day.stamp("28 Aug, 2010") 5 = day.stamp("28 Aug, 2010")
6 %ul.well-list= render commits 6 %ul.well-list= render commits
app/views/dashboard/issues.html.haml
@@ -13,7 +13,8 @@ @@ -13,7 +13,8 @@
13 - @issues.group_by(&:project).each do |group| 13 - @issues.group_by(&:project).each do |group|
14 %div.ui-box 14 %div.ui-box
15 - @project = group[0] 15 - @project = group[0]
16 - %h5= link_to_project @project 16 + %h5.title
  17 + = link_to_project @project
17 %ul.well-list.issues_table 18 %ul.well-list.issues_table
18 - group[1].each do |issue| 19 - group[1].each do |issue|
19 = render(partial: 'issues/show', locals: {issue: issue}) 20 = render(partial: 'issues/show', locals: {issue: issue})
app/views/dashboard/merge_requests.html.haml
@@ -12,7 +12,8 @@ @@ -12,7 +12,8 @@
12 - @merge_requests.group_by(&:project).each do |group| 12 - @merge_requests.group_by(&:project).each do |group|
13 .ui-box 13 .ui-box
14 - @project = group[0] 14 - @project = group[0]
15 - %h5= link_to_project @project 15 + %h5.title
  16 + = link_to_project @project
16 %ul.well-list 17 %ul.well-list
17 - group[1].each do |merge_request| 18 - group[1].each do |merge_request|
18 = render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request}) 19 = render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request})
app/views/groups/_projects.html.haml
1 .projects_box 1 .projects_box
2 - %h5 2 + %h5.title
3 Projects 3 Projects
4 %small 4 %small
5 (#{projects.count}) 5 (#{projects.count})
app/views/groups/issues.html.haml
@@ -9,7 +9,8 @@ @@ -9,7 +9,8 @@
9 - @issues.group_by(&:project).each do |group| 9 - @issues.group_by(&:project).each do |group|
10 %div.ui-box 10 %div.ui-box
11 - @project = group[0] 11 - @project = group[0]
12 - %h5= @project.name 12 + %h5.title
  13 + = @project.name
13 %ul.well-list.issues_table 14 %ul.well-list.issues_table
14 - group[1].each do |issue| 15 - group[1].each do |issue|
15 = render(partial: 'issues/show', locals: {issue: issue}) 16 = render(partial: 'issues/show', locals: {issue: issue})
app/views/groups/merge_requests.html.haml
@@ -8,7 +8,8 @@ @@ -8,7 +8,8 @@
8 - @merge_requests.group_by(&:project).each do |group| 8 - @merge_requests.group_by(&:project).each do |group|
9 %ul.well-list.ui-box 9 %ul.well-list.ui-box
10 - @project = group[0] 10 - @project = group[0]
11 - %h5= @project.name 11 + %h5.title
  12 + = @project.name
12 - group[1].each do |merge_request| 13 - group[1].each do |merge_request|
13 = render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request}) 14 = render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request})
14 %hr 15 %hr
app/views/groups/people.html.haml
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 - if can?(current_user, :manage_group, @group) 5 - if can?(current_user, :manage_group, @group)
6 = render (@project ? "new_member" : "new_group_member") 6 = render (@project ? "new_member" : "new_group_member")
7 .ui-box 7 .ui-box
8 - %h5 8 + %h5.title
9 Team 9 Team
10 %small 10 %small
11 (#{@users.size}) 11 (#{@users.size})
app/views/issues/index.html.haml
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone") 30 = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")
31 = hidden_field_tag 'update[issues_ids]', [] 31 = hidden_field_tag 'update[issues_ids]', []
32 = hidden_field_tag :f, params[:f] 32 = hidden_field_tag :f, params[:f]
33 - = button_tag "Save", class: "btn update_selected_issues" 33 + = button_tag "Save", class: "btn update_selected_issues btn-small save-btn"
34 .issues_filters 34 .issues_filters
35 .left 35 .left
36 %ul.nav.nav-pills.left 36 %ul.nav.nav-pills.left
app/views/merge_requests/show/_commits.html.haml
1 - if @commits.present? 1 - if @commits.present?
2 .ui-box 2 .ui-box
3 - %h6.title 3 + %h5.title
4 %i.icon-list 4 %i.icon-list
5 Commits (#{@commits.count}) 5 Commits (#{@commits.count})
6 .merge-request-commits 6 .merge-request-commits
app/views/team_members/_team.html.haml
1 - grouper_project_members(@project).each do |access, members| 1 - grouper_project_members(@project).each do |access, members|
2 .ui-box 2 .ui-box
3 - %h5 3 + %h5.title
4 = Project.access_options.key(access).pluralize 4 = Project.access_options.key(access).pluralize
5 %small= members.size 5 %small= members.size
6 %ul.well-list 6 %ul.well-list
lib/static_model.rb
@@ -38,7 +38,7 @@ module StaticModel @@ -38,7 +38,7 @@ module StaticModel
38 end 38 end
39 39
40 def ==(other) 40 def ==(other)
41 - if other.is_a? StaticModel 41 + if other.is_a? ::StaticModel
42 id == other.id 42 id == other.id
43 else 43 else
44 super 44 super
spec/lib/extracts_path_spec.rb
@@ -7,7 +7,7 @@ describe ExtractsPath do @@ -7,7 +7,7 @@ describe ExtractsPath do
7 7
8 before do 8 before do
9 @project = project 9 @project = project
10 - project.stub(:ref_names).and_return(['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0']) 10 + project.stub(repository: stub(ref_names: ['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0']))
11 project.stub(path_with_namespace: 'gitlab/gitlab-ci') 11 project.stub(path_with_namespace: 'gitlab/gitlab-ci')
12 end 12 end
13 13
spec/models/project_hooks_spec.rb
@@ -71,8 +71,9 @@ describe Project, "Hooks" do @@ -71,8 +71,9 @@ describe Project, "Hooks" do
71 71
72 context "when gathering commit data" do 72 context "when gathering commit data" do
73 before do 73 before do
74 - @oldrev, @newrev, @ref = project.fresh_commits(2).last.sha, project.fresh_commits(2).first.sha, 'refs/heads/master'  
75 - @commit = project.fresh_commits(2).first 74 + @oldrev, @newrev, @ref = project.repository.fresh_commits(2).last.sha,
  75 + project.repository.fresh_commits(2).first.sha, 'refs/heads/master'
  76 + @commit = project.repository.fresh_commits(2).first
76 77
77 # Fill nil/empty attributes 78 # Fill nil/empty attributes
78 project.description = "This is a description" 79 project.description = "This is a description"