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 114 margin-top:10px;
115 115 }
116 116  
  117 +.prepend-top-20 {
  118 + margin-top:20px;
  119 +}
  120 +
117 121 .padded {
118 122 padding:20px;
119 123 }
  124 +
  125 +.ipadded {
  126 + padding:20px !important;
  127 +}
120 128 .no-borders {
121 129 border:none;
122 130 }
... ... @@ -861,14 +869,7 @@ p.time {
861 869 border:none;
862 870 &:hover {
863 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 875 h4 {
... ...
app/controllers/dashboard_controller.rb
... ... @@ -13,6 +13,7 @@ class DashboardController < ApplicationController
13 13 @issues = @issues.includes(:author, :project)
14 14  
15 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 17 end
17 18  
18 19 # Get authored or assigned open merge requests
... ...
app/models/event.rb
... ... @@ -15,6 +15,7 @@ class Event < ActiveRecord::Base
15 15 serialize :data
16 16  
17 17 scope :recent, order("created_at DESC")
  18 + scope :code_push, where(:action => Pushed)
18 19  
19 20 def self.determine_action(record)
20 21 if [Issue, MergeRequest].include? record.class
... ...
app/views/dashboard/_projects_feed.html.haml
... ... @@ -3,7 +3,7 @@
3 3 = link_to project do
4 4 %h4
5 5 %span.ico.project
6   - = project.name
  6 + = truncate project.name, :length => 30
7 7 %small
8 8 last activity at
9 9 = project.last_activity_date.stamp("Aug 25, 2011")
... ...
app/views/dashboard/index.html.haml
... ... @@ -20,17 +20,26 @@
20 20 .row
21 21 .dashboard_block
22 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 44 - if @merge_requests.any?
36 45 %div.dashboard_category
... ...
app/views/issues/_show.html.haml
1 1 %li.wll{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(issue.project, issue) }
2 2 .right
  3 + - if issue.notes.any?
  4 + %span.btn.small.disabled.padded= pluralize issue.notes.count, 'note'
3 5 - if can? current_user, :modify_issue, issue
4 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 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 10 = link_to 'Edit', edit_project_issue_path(issue.project, issue), :class => "btn small edit-issue-link", :remote => true
9 11 = image_tag gravatar_icon(issue.assignee_email), :class => "avatar"
10 12 %span.update-author
... ... @@ -14,8 +16,6 @@
14 16 %span.label.important critical
15 17 - if issue.today?
16 18 %span.label.success today
17   - - if issue.notes.any?
18   - %span.pretty_label= pluralize issue.notes.count, 'note'
19 19 - if issue.upvotes > 0
20 20 %span.label.success= "+#{issue.upvotes}"
21 21  
... ...
app/views/projects/empty.html.haml
... ... @@ -38,3 +38,7 @@
38 38 "git remote add origin #{@project.url_to_repo}",
39 39 "git push -u origin master"].join("\n")
40 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"
... ...