Commit c9af8e757948838cd6e7232dc189debd61e0c799

Authored by gitlabhq
1 parent af99e4af

New project page improved. User profile improved. Show issues, participant on Milestone show page.

app/assets/images/new_project.png 0 → 100644

257 Bytes

app/assets/stylesheets/gitlab_bootstrap.scss
@@ -111,6 +111,7 @@ table { @@ -111,6 +111,7 @@ table {
111 111
112 &.btn-primary { 112 &.btn-primary {
113 background:$link_color; 113 background:$link_color;
  114 + border-color: #2A79A3;
114 &:hover { 115 &:hover {
115 background:$blue_link; 116 background:$blue_link;
116 } 117 }
app/assets/stylesheets/highlight.scss
@@ -64,12 +64,8 @@ table.highlighttable pre{ @@ -64,12 +64,8 @@ table.highlighttable pre{
64 } 64 }
65 65
66 .git-empty .highlight { 66 .git-empty .highlight {
67 - @include round-borders-all(4px);  
68 - background:#eee;  
69 - padding:5px;  
70 - //overflow-x:scroll;  
71 pre{ 67 pre{
72 - padding:0; 68 + padding:15px;
73 line-height:2.0; 69 line-height:2.0;
74 margin:0; 70 margin:0;
75 font-family: 'Menlo', 'Courier New', 'andale mono','lucida console',monospace; 71 font-family: 'Menlo', 'Courier New', 'andale mono','lucida console',monospace;
app/assets/stylesheets/sections/projects.scss
@@ -13,3 +13,28 @@ @@ -13,3 +13,28 @@
13 } 13 }
14 } 14 }
15 } 15 }
  16 +
  17 +.new_project,
  18 +.edit_project {
  19 + .project_name_holder {
  20 + input,
  21 + label {
  22 + font-size:16px;
  23 + line-height:20px;
  24 + padding:8px;
  25 + }
  26 + label {
  27 + color:#888;
  28 + }
  29 + .btn {
  30 + padding:6px;
  31 + margin-left:10px;
  32 + }
  33 + }
  34 +}
  35 +
  36 +.new_project {
  37 + .field_with_errors {
  38 + display:inline;
  39 + }
  40 +}
app/assets/stylesheets/ui_basic.scss
@@ -81,11 +81,11 @@ @@ -81,11 +81,11 @@
81 } 81 }
82 } 82 }
83 83
84 - .admin_link { 84 + .top_panel_ico {
85 width: 16px; 85 width: 16px;
86 height: 16px; 86 height: 16px;
87 padding: 5px; 87 padding: 5px;
88 - margin-right: 15px; 88 + margin-right:10px;
89 float:right; 89 float:right;
90 } 90 }
91 91
app/assets/stylesheets/ui_mars.scss
@@ -94,11 +94,11 @@ @@ -94,11 +94,11 @@
94 } 94 }
95 } 95 }
96 96
97 - .admin_link { 97 + .top_panel_ico {
98 width: 16px; 98 width: 16px;
99 height: 16px; 99 height: 16px;
100 padding: 5px; 100 padding: 5px;
101 - margin-right: 15px; 101 + margin-right:10px;
102 float:right; 102 float:right;
103 } 103 }
104 } 104 }
app/controllers/milestones_controller.rb
@@ -36,6 +36,9 @@ class MilestonesController < ApplicationController @@ -36,6 +36,9 @@ class MilestonesController < ApplicationController
36 end 36 end
37 37
38 def show 38 def show
  39 + @issues = @milestone.issues.opened.page(params[:page]).per(40)
  40 + @users = @milestone.participants
  41 +
39 respond_to do |format| 42 respond_to do |format|
40 format.html 43 format.html
41 format.js 44 format.js
app/models/milestone.rb
@@ -9,6 +9,10 @@ class Milestone < ActiveRecord::Base @@ -9,6 +9,10 @@ class Milestone < ActiveRecord::Base
9 where("due_date > ? OR due_date IS NULL", Date.today) 9 where("due_date > ? OR due_date IS NULL", Date.today)
10 end 10 end
11 11
  12 + def participants
  13 + User.where(:id => issues.map(&:assignee_id))
  14 + end
  15 +
12 def percent_complete 16 def percent_complete
13 @percent_complete ||= begin 17 @percent_complete ||= begin
14 total_i = self.issues.count 18 total_i = self.issues.count
app/models/user.rb
@@ -131,6 +131,11 @@ class User < ActiveRecord::Base @@ -131,6 +131,11 @@ class User < ActiveRecord::Base
131 self.blocked = true 131 self.blocked = true
132 save 132 save
133 end 133 end
  134 +
  135 + def projects_limit_percent
  136 + return 100 if projects_limit.zero?
  137 + (my_own_projects.count.to_f / projects_limit) * 100
  138 + end
134 end 139 end
135 # == Schema Information 140 # == Schema Information
136 # 141 #
app/views/dashboard/issues.html.haml
1 %h3 1 %h3
2 Issues 2 Issues
3 %small (assigned to you) 3 %small (assigned to you)
  4 + %small.right #{@issues.total_count} issues
4 5
5 %br 6 %br
6 -%div#issues-table-holder.ui-box  
7 - %title  
8 - %ul#issues-table.unstyled  
9 - - if @issues.any?  
10 - - @issues.group_by(&:project).each do |group|  
11 - %li.wll.smoke  
12 - - project = group[0]  
13 - = project.name 7 +- if @issues.any?
  8 + - @issues.group_by(&:project).each do |group|
  9 + %div.ui-box
  10 + - project = group[0]
  11 + %h5= project.name
  12 + %ul.unstyled
14 - group[1].each do |issue| 13 - group[1].each do |issue|
15 = render(:partial => 'issues/show', :locals => {:issue => issue}) 14 = render(:partial => 'issues/show', :locals => {:issue => issue})
16 - %li.bottom  
17 - .row  
18 - .span7= paginate @issues, :theme => "gitlab"  
19 - .span4.right  
20 - %span.cgray.right #{@issues.total_count} issues  
21 -  
22 - - else  
23 - %li  
24 - %p.padded Nothing to show here 15 + %hr
  16 + = paginate @issues, :theme => "gitlab"
  17 +- else
  18 + %h4.padded
  19 + %center Nothing to show here
app/views/dashboard/merge_requests.html.haml
1 %h3 1 %h3
2 Merge Requests 2 Merge Requests
3 %small (authored or assigned to you) 3 %small (authored or assigned to you)
  4 + %small.right #{@merge_requests.total_count} merge requests
4 5
5 %br 6 %br
6 -%div#merge_requests-table-holder.ui-box  
7 - %title  
8 - %ul#merge_requests-table.unstyled  
9 - - if @merge_requests.any?  
10 - - @merge_requests.group_by(&:project).each do |group|  
11 - %li.wll.smoke  
12 - - project = group[0]  
13 - = project.name  
14 - - group[1].each do |merge_request|  
15 - = render(:partial => 'merge_requests/merge_request', :locals => {:merge_request => merge_request})  
16 - %li.bottom  
17 - .row  
18 - .span7= paginate @merge_requests, :theme => "gitlab"  
19 - .span4.right  
20 - %span.cgray.right #{@merge_requests.total_count} merge requests 7 +- if @merge_requests.any?
  8 + - @merge_requests.group_by(&:project).each do |group|
  9 + %ul.unstyled.ui-box
  10 + - project = group[0]
  11 + %h5= project.name
  12 + - group[1].each do |merge_request|
  13 + = render(:partial => 'merge_requests/merge_request', :locals => {:merge_request => merge_request})
  14 + %hr
  15 + = paginate @merge_requests, :theme => "gitlab"
21 16
22 - - else  
23 - %li  
24 - %p.padded Nothing to show here 17 +- else
  18 + %li
  19 + %p.padded Nothing to show here
app/views/layouts/_head_panel.html.haml
@@ -11,8 +11,11 @@ @@ -11,8 +11,11 @@
11 .search 11 .search
12 = form_tag search_path, :method => :get do |f| 12 = form_tag search_path, :method => :get do |f|
13 = text_field_tag "search", nil, :placeholder => "Search", :class => "search-input" 13 = text_field_tag "search", nil, :placeholder => "Search", :class => "search-input"
  14 + - if current_user.can_create_project?
  15 + = link_to new_project_path, :class => "top_panel_ico", :title => "Create New Project" do
  16 + = image_tag "new_project.png", :width => 16
14 - if current_user.is_admin? 17 - if current_user.is_admin?
15 - = link_to admin_root_path, :class => "admin_link", :title => "Admin area" do 18 + = link_to admin_root_path, :class => "top_panel_ico", :title => "Admin area" do
16 = image_tag "admin.PNG", :width => 16 19 = image_tag "admin.PNG", :width => 16
17 .account-box 20 .account-box
18 = link_to profile_path, :class => "pic" do 21 = link_to profile_path, :class => "pic" do
app/views/milestones/show.html.haml
@@ -42,6 +42,30 @@ @@ -42,6 +42,30 @@
42 = preserve do 42 = preserve do
43 = markdown @milestone.description 43 = markdown @milestone.description
44 44
  45 +.row
  46 + .span6
  47 + %h4 Open Issues:
  48 + - @issues.each do |issue|
  49 + = link_to [@project, issue] do
  50 + %h5
  51 + = image_tag gravatar_icon(issue.assignee_email, 16), :width => "16"
  52 +  
  53 + Issue ##{issue.id}
  54 + –
  55 + = truncate issue.title, :length => 50
  56 + %small
  57 + updated at
  58 + = issue.updated_at.stamp("Aug 25, 2011")
  59 + %br
  60 + = paginate @issues, :theme => "gitlab"
  61 +
  62 + .span6
  63 + %h4 Participants:
  64 + - @users.each do |user|
  65 + %h5
  66 + = image_tag gravatar_icon(user.email, 16), :width => "16"
  67 +  
  68 + = user.name
45 69
46 :javascript 70 :javascript
47 $(function() { 71 $(function() {
app/views/profile/password.html.haml
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 %hr 6 %hr
7 = form_for @user, :url => profile_password_path, :method => :put do |f| 7 = form_for @user, :url => profile_password_path, :method => :put do |f|
8 .data 8 .data
9 - .alert-message.block-message.warning 9 + .alert.alert-info
10 %p After successfull password update you will be redirected to login page where you should login with new password 10 %p After successfull password update you will be redirected to login page where you should login with new password
11 -if @user.errors.any? 11 -if @user.errors.any?
12 .alert-message.block-message.error 12 .alert-message.block-message.error
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 %hr 33 %hr
34 = form_for @user, :url => profile_reset_private_token_path, :method => :put do |f| 34 = form_for @user, :url => profile_reset_private_token_path, :method => :put do |f|
35 .data 35 .data
36 - .alert-message.block-message.warning 36 + .alert.alert-info
37 %p Private token used to access application resources without authentication. 37 %p Private token used to access application resources without authentication.
38 %hr 38 %hr
39 %p * required for rss feed 39 %p * required for rss feed
app/views/profile/show.html.haml
1 -.row  
2 - .span8  
3 - .profile_avatar_holder  
4 - = image_tag gravatar_icon(@user.email, 90), :class => "styled_image"  
5 - %h3  
6 - = @user.name  
7 - %br  
8 - %small  
9 - = @user.email  
10 -  
11 - .span4.right  
12 - %div  
13 - %div  
14 - %h5.cgray  
15 - Personal projects:  
16 - %span.right  
17 - %span= current_user.my_own_projects.count  
18 - of  
19 - %span= current_user.projects_limit  
20 - %h5.cgray  
21 - SSH public keys:  
22 - %span.right  
23 - %span= current_user.keys.count 1 +.profile_avatar_holder
  2 + = image_tag gravatar_icon(@user.email, 90), :class => "styled_image"
  3 +%h3
  4 + = @user.name
  5 + %br
  6 + %small
  7 + = @user.email
  8 +
  9 +
24 %hr 10 %hr
25 11
26 = form_for @user, :url => profile_update_path, :method => :put, :html => { :class => "edit_user form-horizontal" } do |f| 12 = form_for @user, :url => profile_update_path, :method => :put, :html => { :class => "edit_user form-horizontal" } do |f|
@@ -41,6 +27,8 @@ @@ -41,6 +27,8 @@
41 .controls 27 .controls
42 = f.text_field :email, :class => "input-xlarge" 28 = f.text_field :email, :class => "input-xlarge"
43 %span.help-block We also use email for avatar detection. 29 %span.help-block We also use email for avatar detection.
  30 +
  31 + %hr
44 .control-group 32 .control-group
45 = f.label :skype, :class => "control-label" 33 = f.label :skype, :class => "control-label"
46 .controls= f.text_field :skype, :class => "input-xlarge" 34 .controls= f.text_field :skype, :class => "input-xlarge"
@@ -56,12 +44,27 @@ @@ -56,12 +44,27 @@
56 = f.text_area :bio, :rows => 6, :class => "input-xlarge", :maxlength => 250 44 = f.text_area :bio, :rows => 6, :class => "input-xlarge", :maxlength => 250
57 %span.help-block Tell us about yourself in fewer than 250 characters. 45 %span.help-block Tell us about yourself in fewer than 250 characters.
58 .span5.right 46 .span5.right
59 - %p.alert-message.block-message 47 +
  48 + %p.alert.alert-info
60 %strong Tip: 49 %strong Tip:
61 You can change your avatar at gravatar.com 50 You can change your avatar at gravatar.com
62 51
  52 + %h4
  53 + Personal projects:
  54 + %small.right
  55 + %span= current_user.my_own_projects.count
  56 + of
  57 + %span= current_user.projects_limit
  58 + .progress
  59 + .bar{:style => "width: #{current_user.projects_limit_percent}%;"}
  60 +
  61 + %h4
  62 + SSH public keys:
  63 + %small.right
  64 + %span= current_user.keys.count
  65 +
  66 + = link_to "Add Public Key", new_key_path, :class => "btn small right"
  67 +
  68 +
63 .form-actions 69 .form-actions
64 = f.submit 'Save', :class => "btn-primary btn" 70 = f.submit 'Save', :class => "btn-primary btn"
65 -  
66 --#= link_to "New project", new_project_path, :class => "btn small padded"  
67 --#= link_to "New public key", new_key_path, :class => "btn small"  
app/views/projects/_form.html.haml
@@ -4,31 +4,39 @@ @@ -4,31 +4,39 @@
4 %ul 4 %ul
5 - @project.errors.full_messages.each do |msg| 5 - @project.errors.full_messages.each do |msg|
6 %li= msg 6 %li= msg
7 - .clearfix  
8 - = f.label :name  
9 - .input= f.text_field :name, :placeholder => "Example Project"  
10 - .clearfix  
11 - = f.label :path do  
12 - Path 7 + .clearfix.project_name_holder
  8 + = f.label :name do
  9 + Project name is
13 .input 10 .input
14 - .input-prepend  
15 - %span.add-on= "#{GIT_HOST["git_user"]}@#{GIT_HOST["host"]}:"  
16 - = f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record?  
17 - .clearfix  
18 - = f.label :code do  
19 - Code  
20 - .input  
21 - .input-prepend  
22 - %span.add-on= web_app_url  
23 - = f.text_field :code, :placeholder => "example" 11 + = f.text_field :name, :placeholder => "Example Project", :class => "xxlarge"
24 12
25 - - unless @project.new_record? || @project.heads.empty? 13 + %hr
  14 + .alert.alert-info
  15 + %h5 Advanced settings:
  16 + .clearfix
  17 + = f.label :path do
  18 + Git Clone
  19 + .input
  20 + .input-prepend
  21 + %span.add-on= "#{GIT_HOST["git_user"]}@#{GIT_HOST["host"]}:"
  22 + = f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record?
  23 + %span.add-on= ".git"
26 .clearfix 24 .clearfix
27 - = f.label :default_branch, "Default Branch"  
28 - .input= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:210px;") 25 + = f.label :code do
  26 + URL
  27 + .input
  28 + .input-prepend
  29 + %span.add-on= web_app_url
  30 + = f.text_field :code, :placeholder => "example"
  31 +
  32 + - unless @project.new_record? || @project.heads.empty?
  33 + .clearfix
  34 + = f.label :default_branch, "Default Branch"
  35 + .input= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:210px;")
29 36
30 - .alert-message.block-message.warning  
31 - %h5 Features 37 + - unless @project.new_record?
  38 + .alert.alert-info
  39 + %h5 Features:
32 40
33 .clearfix 41 .clearfix
34 = f.label :issues_enabled, "Issues" 42 = f.label :issues_enabled, "Issues"
@@ -46,12 +54,6 @@ @@ -46,12 +54,6 @@
46 = f.label :wiki_enabled, "Wiki" 54 = f.label :wiki_enabled, "Wiki"
47 .input= f.check_box :wiki_enabled 55 .input= f.check_box :wiki_enabled
48 56
49 - .clearfix  
50 - = f.label :description  
51 - .input  
52 - = f.text_area :description, :placeholder => "project description", :class => "xxlarge", :rows => 5  
53 - %p.hint Markdown is enabled.  
54 -  
55 %br 57 %br
56 58
57 .actions 59 .actions
app/views/projects/_new_form.html.haml 0 → 100644
@@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
  1 += form_for(@project, :remote => true) do |f|
  2 + - if @project.errors.any?
  3 + .alert-message.block-message.error
  4 + %span= @project.errors.full_messages.first
  5 + .clearfix.project_name_holder
  6 + = f.label :name do
  7 + Project name is
  8 + .input
  9 + = f.text_field :name, :placeholder => "Example Project", :class => "xxlarge"
  10 + = f.submit 'Create project', :class => "btn primary"
  11 +
  12 + %hr
  13 + .alert.alert-info
  14 + %h5 Advanced settings:
  15 + .clearfix
  16 + = f.label :path do
  17 + Git Clone
  18 + .input
  19 + .input-prepend
  20 + %span.add-on= "#{GIT_HOST["git_user"]}@#{GIT_HOST["host"]}:"
  21 + = f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record?
  22 + %span.add-on= ".git"
  23 + .clearfix
  24 + = f.label :code do
  25 + URL
  26 + .input
  27 + .input-prepend
  28 + %span.add-on= web_app_url
  29 + = f.text_field :code, :placeholder => "example"
app/views/projects/create.js.haml
@@ -4,5 +4,5 @@ @@ -4,5 +4,5 @@
4 - else 4 - else
5 :plain 5 :plain
6 $('.project_new_holder').show(); 6 $('.project_new_holder').show();
7 - $("#new_project").replaceWith("#{escape_javascript(render('form'))}"); 7 + $("#new_project").replaceWith("#{escape_javascript(render('new_form'))}");
8 $('.ajax_loader').hide(); 8 $('.ajax_loader').hide();
app/views/projects/new.html.haml
1 .project_new_holder 1 .project_new_holder
2 - %h3 New Project 2 + %h3
  3 + New Project
3 %hr 4 %hr
4 - = render 'form' 5 + = render 'new_form'
5 %div.ajax_loader.hide 6 %div.ajax_loader.hide
6 %center 7 %center
7 %div.padded= image_tag "ajax_loader.gif" 8 %div.padded= image_tag "ajax_loader.gif"
spec/requests/projects_spec.rb
@@ -34,19 +34,17 @@ describe "Projects" do @@ -34,19 +34,17 @@ describe "Projects" do
34 end 34 end
35 35
36 it "should have labels for new project" do 36 it "should have labels for new project" do
37 - page.should have_content("Name")  
38 - page.should have_content("Path")  
39 - page.should have_content("Description") 37 + page.should have_content("Project name is")
40 end 38 end
41 end 39 end
42 40
43 describe "POST /projects" do 41 describe "POST /projects" do
44 before do 42 before do
45 visit new_project_path 43 visit new_project_path
46 - fill_in 'Name', :with => 'NewProject'  
47 - fill_in 'Code', :with => 'NPR'  
48 - fill_in 'Path', :with => 'newproject'  
49 - expect { click_button "Save" }.to change { Project.count }.by(1) 44 + fill_in 'project_name', :with => 'NewProject'
  45 + fill_in 'project_code', :with => 'NPR'
  46 + fill_in 'project_path', :with => 'newproject'
  47 + expect { click_button "Create project" }.to change { Project.count }.by(1)
50 @project = Project.last 48 @project = Project.last
51 end 49 end
52 50
@@ -120,9 +118,9 @@ describe "Projects" do @@ -120,9 +118,9 @@ describe "Projects" do
120 end 118 end
121 119
122 it "should have labels for new project" do 120 it "should have labels for new project" do
123 - page.should have_content("Name")  
124 - page.should have_content("Path")  
125 - page.should have_content("Description") 121 + page.should have_content("Project name is")
  122 + page.should have_content("Advanced settings:")
  123 + page.should have_content("Features:")
126 end 124 end
127 end 125 end
128 126
@@ -133,9 +131,8 @@ describe "Projects" do @@ -133,9 +131,8 @@ describe "Projects" do
133 131
134 visit edit_project_path(@project) 132 visit edit_project_path(@project)
135 133
136 - fill_in 'Name', :with => 'Awesome'  
137 - fill_in 'Path', :with => 'gitlabhq'  
138 - fill_in 'Description', :with => 'Awesome project' 134 + fill_in 'project_name', :with => 'Awesome'
  135 + fill_in 'project_path', :with => 'gitlabhq'
139 click_button "Save" 136 click_button "Save"
140 @project = @project.reload 137 @project = @project.reload
141 end 138 end