Commit 81da8e46f24913ccf42d3e2644962cbcbc0f9c2e

Authored by Dmitriy Zaporozhets
1 parent 6f2c1932

Remove button for empty repo. Last push on dashboard. Better notes count indicator for issues

app/assets/stylesheets/common.scss
@@ -114,9 +114,17 @@ a:focus { @@ -114,9 +114,17 @@ a:focus {
114 margin-top:10px; 114 margin-top:10px;
115 } 115 }
116 116
  117 +.prepend-top-20 {
  118 + margin-top:20px;
  119 +}
  120 +
117 .padded { 121 .padded {
118 padding:20px; 122 padding:20px;
119 } 123 }
  124 +
  125 +.ipadded {
  126 + padding:20px !important;
  127 +}
120 .no-borders { 128 .no-borders {
121 border:none; 129 border:none;
122 } 130 }
@@ -861,14 +869,7 @@ p.time { @@ -861,14 +869,7 @@ p.time {
861 border:none; 869 border:none;
862 &:hover { 870 &:hover {
863 background:none; 871 background:none;
864 -  
865 - h4 {  
866 - color:#2FA0BB;  
867 - .arrow {  
868 - background:#2FA0BB;  
869 - color:#fff;  
870 - }  
871 - } 872 + h4 { color:#2FA0BB; }
872 } 873 }
873 874
874 h4 { 875 h4 {
app/controllers/dashboard_controller.rb
@@ -13,6 +13,7 @@ class DashboardController < ApplicationController @@ -13,6 +13,7 @@ class DashboardController < ApplicationController
13 @issues = @issues.includes(:author, :project) 13 @issues = @issues.includes(:author, :project)
14 14
15 @events = Event.where(:project_id => @projects.map(&:id)).recent.limit(20) 15 @events = Event.where(:project_id => @projects.map(&:id)).recent.limit(20)
  16 + @last_push = Event.where(:project_id => @projects.map(&:id)).recent.code_push.limit(1).first
16 end 17 end
17 18
18 # Get authored or assigned open merge requests 19 # Get authored or assigned open merge requests
app/models/event.rb
@@ -15,6 +15,7 @@ class Event < ActiveRecord::Base @@ -15,6 +15,7 @@ class Event < ActiveRecord::Base
15 serialize :data 15 serialize :data
16 16
17 scope :recent, order("created_at DESC") 17 scope :recent, order("created_at DESC")
  18 + scope :code_push, where(:action => Pushed)
18 19
19 def self.determine_action(record) 20 def self.determine_action(record)
20 if [Issue, MergeRequest].include? record.class 21 if [Issue, MergeRequest].include? record.class
app/views/dashboard/_projects_feed.html.haml
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 = link_to project do 3 = link_to project do
4 %h4 4 %h4
5 %span.ico.project 5 %span.ico.project
6 - = project.name 6 + = truncate project.name, :length => 30
7 %small 7 %small
8 last activity at 8 last activity at
9 = project.last_activity_date.stamp("Aug 25, 2011") 9 = project.last_activity_date.stamp("Aug 25, 2011")
app/views/dashboard/index.html.haml
@@ -20,17 +20,26 @@ @@ -20,17 +20,26 @@
20 .row 20 .row
21 .dashboard_block 21 .dashboard_block
22 .row 22 .row
23 - .span10= render "dashboard/projects_feed", :projects => @active_projects  
24 - .span4.right  
25 - - if current_user.can_create_project?  
26 - .alert-message.block-message.warning  
27 - You can create up to  
28 - = current_user.projects_limit  
29 - projects. Click on link below to add a new one  
30 - .link_holder  
31 - = link_to new_project_path, :class => "" do  
32 - New Project »  
33 - 23 + .span4
  24 + %div.prettyprint.ipadded
  25 + %h1
  26 + = pluralize current_user.projects.count, "project", "projects"
  27 + - if current_user.can_create_project?
  28 + %hr
  29 + %div
  30 + You can create up to
  31 + = current_user.projects_limit
  32 + projects. Click on button below to add a new one
  33 + .link_holder
  34 + %br
  35 + = link_to new_project_path, :class => "btn" do
  36 + New Project »
  37 + .span10.right= render "dashboard/projects_feed", :projects => @active_projects
  38 + - if @last_push
  39 + .ui-box.padded.prepend-top-20
  40 + %h5
  41 + %small Latest push was to the #{@last_push.branch_name} branch of #{@last_push.project.name}:
  42 + %ul.unstyled= render @last_push
34 43
35 - if @merge_requests.any? 44 - if @merge_requests.any?
36 %div.dashboard_category 45 %div.dashboard_category
app/views/issues/_show.html.haml
1 %li.wll{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(issue.project, issue) } 1 %li.wll{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(issue.project, issue) }
2 .right 2 .right
  3 + - if issue.notes.any?
  4 + %span.btn.small.disabled.padded= pluralize issue.notes.count, 'note'
3 - if can? current_user, :modify_issue, issue 5 - if can? current_user, :modify_issue, issue
4 - if issue.closed 6 - if issue.closed
5 - = link_to 'Reopen', project_issue_path(issue.project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "btn small", :remote => true 7 + = link_to 'Reopen', project_issue_path(issue.project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "btn small padded", :remote => true
6 - else 8 - else
7 - = link_to 'Resolve', project_issue_path(issue.project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "success btn small", :remote => true 9 + = link_to 'Resolve', project_issue_path(issue.project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "success btn small padded", :remote => true
8 = link_to 'Edit', edit_project_issue_path(issue.project, issue), :class => "btn small edit-issue-link", :remote => true 10 = link_to 'Edit', edit_project_issue_path(issue.project, issue), :class => "btn small edit-issue-link", :remote => true
9 = image_tag gravatar_icon(issue.assignee_email), :class => "avatar" 11 = image_tag gravatar_icon(issue.assignee_email), :class => "avatar"
10 %span.update-author 12 %span.update-author
@@ -14,8 +16,6 @@ @@ -14,8 +16,6 @@
14 %span.label.important critical 16 %span.label.important critical
15 - if issue.today? 17 - if issue.today?
16 %span.label.success today 18 %span.label.success today
17 - - if issue.notes.any?  
18 - %span.pretty_label= pluralize issue.notes.count, 'note'  
19 - if issue.upvotes > 0 19 - if issue.upvotes > 0
20 %span.label.success= "+#{issue.upvotes}" 20 %span.label.success= "+#{issue.upvotes}"
21 21
app/views/projects/empty.html.haml
@@ -38,3 +38,7 @@ @@ -38,3 +38,7 @@
38 "git remote add origin #{@project.url_to_repo}", 38 "git remote add origin #{@project.url_to_repo}",
39 "git push -u origin master"].join("\n") 39 "git push -u origin master"].join("\n")
40 = raw bash_lexer.highlight(exist_repo_setup_str) 40 = raw bash_lexer.highlight(exist_repo_setup_str)
  41 +
  42 + - if can? current_user, :admin_project, @project
  43 + .alert-message.block-message.error.prepend-top-20
  44 + = link_to 'Remove project', @project, :confirm => 'Are you sure?', :method => :delete, :class => "btn danger"