Commit f512418b27dbfa54839bd4deb9ea271316cdd665
1 parent
2552a877
Exists in
master
and in
4 other branches
Added "Issues" dashboard
This shows issues assigned to you, across all your projects, in one place. References #173
Showing
14 changed files
with
165 additions
and
20 deletions
Show diff stats
app/assets/stylesheets/style.scss
@@ -351,7 +351,7 @@ header h1.logo a{ | @@ -351,7 +351,7 @@ header h1.logo a{ | ||
351 | text-indent: -1000em; | 351 | text-indent: -1000em; |
352 | } | 352 | } |
353 | 353 | ||
354 | -header nav{border-radius: 4px; box-shadow: 0 1px 2px black; width: 294px; margin: auto; | 354 | +header nav{border-radius: 4px; box-shadow: 0 1px 2px black; width: 392px; margin: auto; |
355 | background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #595d63), to(#31363e)); | 355 | background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #595d63), to(#31363e)); |
356 | background-image: -webkit-linear-gradient(#595d63 6.6%, #31363e); | 356 | background-image: -webkit-linear-gradient(#595d63 6.6%, #31363e); |
357 | background-image: -moz-linear-gradient(#595d63 6.6%, #31363e); | 357 | background-image: -moz-linear-gradient(#595d63 6.6%, #31363e); |
@@ -398,6 +398,7 @@ header nav a span{width: 20px; height: 20px; display: inline-block; background: | @@ -398,6 +398,7 @@ header nav a span{width: 20px; height: 20px; display: inline-block; background: | ||
398 | header nav a.dashboard span{background: url('images.png') no-repeat -161px 0;} | 398 | header nav a.dashboard span{background: url('images.png') no-repeat -161px 0;} |
399 | header nav a.admin span{background: url('images.png') no-repeat -184px 0;} | 399 | header nav a.admin span{background: url('images.png') no-repeat -184px 0;} |
400 | header nav a.project span{background: url('images.png') no-repeat -209px -1px; top: 7px} | 400 | header nav a.project span{background: url('images.png') no-repeat -209px -1px; top: 7px} |
401 | +header nav a.issues span{background: url('images.png') no-repeat -209px -1px; top: 7px} | ||
401 | 402 | ||
402 | header .login-top{float: right; width: 180px; | 403 | header .login-top{float: right; width: 180px; |
403 | background-image: -webkit-gradient(linear, 0 0, 0 62, color-stop(0.032, #464c56), to(#363c45)); | 404 | background-image: -webkit-gradient(linear, 0 0, 0 62, color-stop(0.032, #464c56), to(#363c45)); |
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | +class UserIssuesController < ApplicationController | ||
2 | + before_filter :authenticate_user! | ||
3 | + | ||
4 | + layout "user" | ||
5 | + | ||
6 | + respond_to :js, :html | ||
7 | + | ||
8 | + def index | ||
9 | + @user = current_user | ||
10 | + @issues = current_user.assigned_issues.opened | ||
11 | + | ||
12 | + @issues = @issues.includes(:author, :project) | ||
13 | + | ||
14 | + respond_to do |format| | ||
15 | + format.html | ||
16 | + format.js | ||
17 | + format.atom { render :layout => false } | ||
18 | + end | ||
19 | + end | ||
20 | + | ||
21 | + def search | ||
22 | + | ||
23 | + end | ||
24 | + | ||
25 | +end |
app/views/issues/_issues.html.haml
1 | - @issues.critical.each do |issue| | 1 | - @issues.critical.each do |issue| |
2 | - = render(:partial => 'show', :locals => {:issue => issue}) | 2 | + = render(:partial => 'issues/show', :locals => {:issue => issue}) |
3 | 3 | ||
4 | - @issues.non_critical.each do |issue| | 4 | - @issues.non_critical.each do |issue| |
5 | - = render(:partial => 'show', :locals => {:issue => issue}) | 5 | + = render(:partial => 'issues/show', :locals => {:issue => issue}) |
app/views/issues/_show.html.haml
1 | -%tr{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(@project, issue) } | 1 | +%tr{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(issue.project, issue) } |
2 | %td | 2 | %td |
3 | %strong.issue-number{:class => sort_class}= "##{issue.id}" | 3 | %strong.issue-number{:class => sort_class}= "##{issue.id}" |
4 | %span | 4 | %span |
@@ -6,6 +6,9 @@ | @@ -6,6 +6,9 @@ | ||
6 | %br | 6 | %br |
7 | %br | 7 | %br |
8 | %div.note-author | 8 | %div.note-author |
9 | + - if not @project.present? | ||
10 | + %strong= issue.project.name | ||
11 | + = '-' | ||
9 | %strong= issue.assignee.name | 12 | %strong= issue.assignee.name |
10 | %cite.cgray | 13 | %cite.cgray |
11 | = time_ago_in_words(issue.created_at) | 14 | = time_ago_in_words(issue.created_at) |
@@ -17,10 +20,10 @@ | @@ -17,10 +20,10 @@ | ||
17 | .right.action-links | 20 | .right.action-links |
18 | - if can? current_user, :write_issue, issue | 21 | - if can? current_user, :write_issue, issue |
19 | - if issue.closed | 22 | - if issue.closed |
20 | - = link_to 'Reopen', project_issue_path(@project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "cgray", :remote => true | 23 | + = link_to 'Reopen', project_issue_path(issue.project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "cgray", :remote => true |
21 | - else | 24 | - else |
22 | - = link_to 'Resolve', project_issue_path(@project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "cgray", :remote => true | 25 | + = link_to 'Resolve', project_issue_path(issue.project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "cgray", :remote => true |
23 | - if can? current_user, :write_issue, issue | 26 | - if can? current_user, :write_issue, issue |
24 | - = link_to 'Edit', edit_project_issue_path(@project, issue), :class => "cgray edit-issue-link", :remote => true | 27 | + = link_to 'Edit', edit_project_issue_path(issue.project, issue), :class => "cgray edit-issue-link", :remote => true |
25 | - if can?(current_user, :admin_issue, @project) || issue.author == current_user | 28 | - if can?(current_user, :admin_issue, @project) || issue.author == current_user |
26 | - = link_to 'Remove', [@project, issue], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "cred delete-issue negative", :id => "destroy_issue_#{issue.id}" | 29 | + = link_to 'Remove', [issue.project, issue], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "cred delete-issue negative", :id => "destroy_issue_#{issue.id}" |
app/views/layouts/_head_panel.html.erb
@@ -25,6 +25,9 @@ | @@ -25,6 +25,9 @@ | ||
25 | <%= link_to dashboard_path, :class => current_page?(root_path) ? "current dashboard" : "dashboard" do %> | 25 | <%= link_to dashboard_path, :class => current_page?(root_path) ? "current dashboard" : "dashboard" do %> |
26 | <span></span>Dashboard | 26 | <span></span>Dashboard |
27 | <% end %> | 27 | <% end %> |
28 | + <%= link_to issues_path, :class => current_page?(issues_path) ? "current issues" : "issues" do %> | ||
29 | + <span></span>Issues | ||
30 | + <% end %> | ||
28 | <%= link_to projects_path, :class => current_page?(projects_path) ? "current project" : "project" do %> | 31 | <%= link_to projects_path, :class => current_page?(projects_path) ? "current project" : "project" do %> |
29 | <span></span>Projects | 32 | <span></span>Projects |
30 | <% end %> | 33 | <% end %> |
@@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
1 | +!!! | ||
2 | +%html | ||
3 | + %head | ||
4 | + %title | ||
5 | + GitLab #{" - #{current_user.name}"} | ||
6 | + = stylesheet_link_tag "application" | ||
7 | + = javascript_include_tag "application" | ||
8 | + = csrf_meta_tags | ||
9 | + = javascript_tag do | ||
10 | + REQ_URI = "#{request.env["REQUEST_URI"]}"; | ||
11 | + REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; | ||
12 | + %body{ :class => body_class('project-page'), :id => yield(:boyd_id)} | ||
13 | + = render :partial => "layouts/flash" | ||
14 | + #container | ||
15 | + = render :partial => "layouts/head_panel" | ||
16 | + .project-container | ||
17 | + .project-sidebar | ||
18 | + .fixed | ||
19 | + %aside | ||
20 | + = link_to issues_path, :class => current_page?(:controller => "user_issues", :action => "index") ? "current" : nil do | ||
21 | + Issues | ||
22 | + - unless current_user.assigned_issues.empty? | ||
23 | + %span{ :class => "number" }= current_user.assigned_issues.count | ||
24 | + | ||
25 | + .project-content | ||
26 | + = yield | ||
27 | + |
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +xml.instruct! | ||
2 | +xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do | ||
3 | + xml.title "#{@user.name} issues" | ||
4 | + xml.link :href => issues_url(:atom, :private_token => @user.private_token), :rel => "self", :type => "application/atom+xml" | ||
5 | + xml.link :href => issues_url(:private_token => @user.private_token), :rel => "alternate", :type => "text/html" | ||
6 | + xml.id issues_url(:private_token => @user.private_token) | ||
7 | + xml.updated @issues.first.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") if @issues.any? | ||
8 | + | ||
9 | + @issues.each do |issue| | ||
10 | + xml.entry do | ||
11 | + xml.id project_issue_url(issue.project, issue) | ||
12 | + xml.link :href => project_issue_url(issue.project, issue) | ||
13 | + xml.title truncate(issue.title, :length => 80) | ||
14 | + xml.updated issue.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") | ||
15 | + xml.media :thumbnail, :width => "40", :height => "40", :url => gravatar_icon(issue.author_email) | ||
16 | + xml.author do |author| | ||
17 | + xml.name issue.author_name | ||
18 | + xml.email issue.author_email | ||
19 | + end | ||
20 | + xml.summary issue.title | ||
21 | + end | ||
22 | + end | ||
23 | +end | ||
24 | + |
config/routes.rb
1 | Gitlab::Application.routes.draw do | 1 | Gitlab::Application.routes.draw do |
2 | 2 | ||
3 | + get "user_issues/index" | ||
4 | + | ||
3 | get 'tags'=> 'tags#index' | 5 | get 'tags'=> 'tags#index' |
4 | get 'tags/:tag' => 'projects#index' | 6 | get 'tags/:tag' => 'projects#index' |
5 | 7 | ||
@@ -21,6 +23,8 @@ Gitlab::Application.routes.draw do | @@ -21,6 +23,8 @@ Gitlab::Application.routes.draw do | ||
21 | put "profile/edit", :to => "profile#social_update" | 23 | put "profile/edit", :to => "profile#social_update" |
22 | get "profile", :to => "profile#show" | 24 | get "profile", :to => "profile#show" |
23 | get "dashboard", :to => "dashboard#index" | 25 | get "dashboard", :to => "dashboard#index" |
26 | + get "issues", :to => "user_issues#index", :as => "issues" | ||
27 | + | ||
24 | #get "profile/:id", :to => "profile#show" | 28 | #get "profile/:id", :to => "profile#show" |
25 | 29 | ||
26 | resources :projects, :only => [:new, :create, :index] | 30 | resources :projects, :only => [:new, :create, :index] |
db/schema.rb
@@ -13,18 +13,6 @@ | @@ -13,18 +13,6 @@ | ||
13 | 13 | ||
14 | ActiveRecord::Schema.define(:version => 20111206222316) do | 14 | ActiveRecord::Schema.define(:version => 20111206222316) do |
15 | 15 | ||
16 | - create_table "features", :force => true do |t| | ||
17 | - t.string "name" | ||
18 | - t.string "branch_name" | ||
19 | - t.integer "assignee_id" | ||
20 | - t.integer "author_id" | ||
21 | - t.integer "project_id" | ||
22 | - t.datetime "created_at" | ||
23 | - t.datetime "updated_at" | ||
24 | - t.string "version" | ||
25 | - t.integer "status", :default => 0, :null => false | ||
26 | - end | ||
27 | - | ||
28 | create_table "issues", :force => true do |t| | 16 | create_table "issues", :force => true do |t| |
29 | t.string "title" | 17 | t.string "title" |
30 | t.integer "assignee_id" | 18 | t.integer "assignee_id" |
@@ -0,0 +1,53 @@ | @@ -0,0 +1,53 @@ | ||
1 | +require 'spec_helper' | ||
2 | + | ||
3 | +describe "User Issues Dashboard" do | ||
4 | + describe "GET /issues" do | ||
5 | + before do | ||
6 | + | ||
7 | + login_as :user | ||
8 | + | ||
9 | + @project1 = Factory :project, | ||
10 | + :path => "project1", | ||
11 | + :code => "TEST1" | ||
12 | + | ||
13 | + @project2 = Factory :project, | ||
14 | + :path => "project2", | ||
15 | + :code => "TEST2" | ||
16 | + | ||
17 | + @project1.add_access(@user, :read, :write) | ||
18 | + @project2.add_access(@user, :read, :write) | ||
19 | + | ||
20 | + @issue1 = Factory :issue, | ||
21 | + :author => @user, | ||
22 | + :assignee => @user, | ||
23 | + :project => @project1 | ||
24 | + | ||
25 | + @issue2 = Factory :issue, | ||
26 | + :author => @user, | ||
27 | + :assignee => @user, | ||
28 | + :project => @project2 | ||
29 | + | ||
30 | + visit issues_path | ||
31 | + end | ||
32 | + | ||
33 | + subject { page } | ||
34 | + | ||
35 | + it { should have_content(@issue1.title) } | ||
36 | + it { should have_content(@issue1.project.name) } | ||
37 | + it { should have_content(@issue1.assignee.name) } | ||
38 | + | ||
39 | + it { should have_content(@issue2.title) } | ||
40 | + it { should have_content(@issue2.project.name) } | ||
41 | + it { should have_content(@issue2.assignee.name) } | ||
42 | + | ||
43 | + it "should render atom feed via private token" do | ||
44 | + logout | ||
45 | + visit issues_path(:atom, :private_token => @user.private_token) | ||
46 | + | ||
47 | + page.response_headers['Content-Type'].should have_content("application/atom+xml") | ||
48 | + page.body.should have_selector("title", :text => "#{@user.name} issues") | ||
49 | + page.body.should have_selector("author email", :text => @issue1.author_email) | ||
50 | + page.body.should have_selector("entry summary", :text => @issue1.title) | ||
51 | + end | ||
52 | + end | ||
53 | +end |