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 79 }
80 80  
81 81 .title {
82   - padding: 0 10px;
83 82 @include bg-gray-gradient;
84 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 92 > a {
87 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 122 &.padded {
... ...
app/assets/stylesheets/gitlab_bootstrap/lists.scss
... ... @@ -25,6 +25,10 @@
25 25  
26 26 &:last-child {
27 27 border-bottom: none;
  28 +
  29 + &.bottom {
  30 + background: #f5f5f5;
  31 + }
28 32 }
29 33  
30 34 .author { color: #999; }
... ...
app/assets/stylesheets/gitlab_bootstrap/tables.scss
... ... @@ -25,7 +25,7 @@ table {
25 25 }
26 26  
27 27 th, td {
28   - padding: 8px;
  28 + padding: 10px;
29 29 line-height: 18px;
30 30 text-align: left;
31 31 }
... ...
app/assets/stylesheets/sections/issues.scss
... ... @@ -61,31 +61,25 @@ input.check_all_issues {
61 61  
62 62 #issues-table-holder {
63 63 .issues_filters {
64   - form {
65   - padding: 0;
66   - margin: 0;
67   - margin-top:7px
68   - }
69 64 }
70 65  
71 66 .issues_bulk_update {
72 67 margin: 0;
73 68 form {
74   - padding: 0;
75   - margin: 0;
76   - margin-top:7px
  69 + float:left;
77 70 }
78 71 .update_selected_issues {
79 72 position: relative;
80   - top:-2px;
  73 + top:5px;
81 74 margin-left: 4px;
82 75 float: left;
83 76 }
84 77  
85 78 .update_issues_text {
86 79 padding: 3px;
87   - line-height: 18px;
  80 + line-height: 28px;
88 81 float: left;
  82 + color: #479;
89 83 }
90 84 }
91 85 }
... ...
app/assets/stylesheets/sections/projects.scss
... ... @@ -8,14 +8,8 @@
8 8  
9 9 .groups_box,
10 10 .projects_box {
11   - > h5 {
12   - color: #456;
13   - font-size: 16px;
14   - text-shadow: 0 1px 1px #fff;
  11 + > .title {
15 12 padding: 2px 15px;
16   - line-height: 36px;
17   - font-size: 14px;
18   - font-weight: normal;
19 13 }
20 14 .nav-projects-tabs li { padding: 0; }
21 15 .well-list {
... ...
app/models/commit.rb
... ... @@ -98,6 +98,8 @@ class Commit
98 98 end
99 99  
100 100 def initialize(raw_commit, head = nil)
  101 + raise "Nil as raw commit passed" unless raw_commit
  102 +
101 103 @commit = raw_commit
102 104 @head = head
103 105 end
... ... @@ -136,7 +138,11 @@ class Commit
136 138 end
137 139  
138 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 146 end
141 147  
142 148 def prev_commit_id
... ...
app/models/project.rb
... ... @@ -361,8 +361,8 @@ class Project < ActiveRecord::Base
361 361  
362 362 # Discover the default branch, but only if it hasn't already been set to
363 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 366 end
367 367 end
368 368  
... ...
app/views/admin/dashboard/index.html.haml
1 1 .admin_dash.row
2 2 .span3
3 3 .ui-box
4   - %h5 Projects
  4 + %h5.title Projects
5 5 .data.padded
6 6 = link_to admin_projects_path do
7 7 %h1= Project.count
... ... @@ -9,7 +9,7 @@
9 9 = link_to 'New Project', new_project_path, class: "btn small"
10 10 .span3
11 11 .ui-box
12   - %h5 Groups
  12 + %h5.title Groups
13 13 .data.padded
14 14 = link_to admin_groups_path do
15 15 %h1= Group.count
... ... @@ -17,7 +17,7 @@
17 17 = link_to 'New Group', new_admin_group_path, class: "btn small"
18 18 .span3
19 19 .ui-box
20   - %h5 Users
  20 + %h5.title Users
21 21 .data.padded
22 22 = link_to admin_users_path do
23 23 %h1= User.count
... ... @@ -25,7 +25,7 @@
25 25 = link_to 'New User', new_admin_user_path, class: "btn small"
26 26 .span3
27 27 .ui-box
28   - %h5
  28 + %h5.title
29 29 Resque Workers
30 30 .data.padded
31 31 - if @resque_accessible
... ...
app/views/admin/projects/show.html.haml
... ... @@ -4,7 +4,7 @@
4 4 %i.icon-edit
5 5 Edit
6 6  
7   -- if @repository.has_commits?
  7 +- if @repository && @repository.has_commits?
8 8 - if !@repository.has_post_receive_file?
9 9 %br
10 10 .alert.alert-error
... ... @@ -65,42 +65,43 @@
65 65 Created at:
66 66 %td
67 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 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 106 %br
106 107 %h5
... ...
app/views/commits/_commits.html.haml
1 1 - @commits.group_by { |c| c.committed_date.to_date }.each do |day, commits|
2 2 %div.ui-box
3   - %h6.title
  3 + %h5.title
4 4 %i.icon-calendar
5 5 = day.stamp("28 Aug, 2010")
6 6 %ul.well-list= render commits
... ...
app/views/dashboard/issues.html.haml
... ... @@ -13,7 +13,8 @@
13 13 - @issues.group_by(&:project).each do |group|
14 14 %div.ui-box
15 15 - @project = group[0]
16   - %h5= link_to_project @project
  16 + %h5.title
  17 + = link_to_project @project
17 18 %ul.well-list.issues_table
18 19 - group[1].each do |issue|
19 20 = render(partial: 'issues/show', locals: {issue: issue})
... ...
app/views/dashboard/merge_requests.html.haml
... ... @@ -12,7 +12,8 @@
12 12 - @merge_requests.group_by(&:project).each do |group|
13 13 .ui-box
14 14 - @project = group[0]
15   - %h5= link_to_project @project
  15 + %h5.title
  16 + = link_to_project @project
16 17 %ul.well-list
17 18 - group[1].each do |merge_request|
18 19 = render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request})
... ...
app/views/groups/_projects.html.haml
1 1 .projects_box
2   - %h5
  2 + %h5.title
3 3 Projects
4 4 %small
5 5 (#{projects.count})
... ...
app/views/groups/issues.html.haml
... ... @@ -9,7 +9,8 @@
9 9 - @issues.group_by(&:project).each do |group|
10 10 %div.ui-box
11 11 - @project = group[0]
12   - %h5= @project.name
  12 + %h5.title
  13 + = @project.name
13 14 %ul.well-list.issues_table
14 15 - group[1].each do |issue|
15 16 = render(partial: 'issues/show', locals: {issue: issue})
... ...
app/views/groups/merge_requests.html.haml
... ... @@ -8,7 +8,8 @@
8 8 - @merge_requests.group_by(&:project).each do |group|
9 9 %ul.well-list.ui-box
10 10 - @project = group[0]
11   - %h5= @project.name
  11 + %h5.title
  12 + = @project.name
12 13 - group[1].each do |merge_request|
13 14 = render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request})
14 15 %hr
... ...
app/views/groups/people.html.haml
... ... @@ -5,7 +5,7 @@
5 5 - if can?(current_user, :manage_group, @group)
6 6 = render (@project ? "new_member" : "new_group_member")
7 7 .ui-box
8   - %h5
  8 + %h5.title
9 9 Team
10 10 %small
11 11 (#{@users.size})
... ...
app/views/issues/index.html.haml
... ... @@ -30,7 +30,7 @@
30 30 = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")
31 31 = hidden_field_tag 'update[issues_ids]', []
32 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 34 .issues_filters
35 35 .left
36 36 %ul.nav.nav-pills.left
... ...
app/views/merge_requests/show/_commits.html.haml
1 1 - if @commits.present?
2 2 .ui-box
3   - %h6.title
  3 + %h5.title
4 4 %i.icon-list
5 5 Commits (#{@commits.count})
6 6 .merge-request-commits
... ...
app/views/team_members/_team.html.haml
1 1 - grouper_project_members(@project).each do |access, members|
2 2 .ui-box
3   - %h5
  3 + %h5.title
4 4 = Project.access_options.key(access).pluralize
5 5 %small= members.size
6 6 %ul.well-list
... ...
lib/static_model.rb
... ... @@ -38,7 +38,7 @@ module StaticModel
38 38 end
39 39  
40 40 def ==(other)
41   - if other.is_a? StaticModel
  41 + if other.is_a? ::StaticModel
42 42 id == other.id
43 43 else
44 44 super
... ...
spec/lib/extracts_path_spec.rb
... ... @@ -7,7 +7,7 @@ describe ExtractsPath do
7 7  
8 8 before do
9 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 11 project.stub(path_with_namespace: 'gitlab/gitlab-ci')
12 12 end
13 13  
... ...
spec/models/project_hooks_spec.rb
... ... @@ -71,8 +71,9 @@ describe Project, "Hooks" do
71 71  
72 72 context "when gathering commit data" do
73 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 78 # Fill nil/empty attributes
78 79 project.description = "This is a description"
... ...