Merge branch 'issues_restyle' into dev

This commit is contained in:
Dmitriy Zaporozhets 2011-11-07 22:32:01 +02:00
commit 32abaa33f8
8 changed files with 82 additions and 69 deletions

View file

@ -679,6 +679,30 @@ body.project-page table .commit {
} }
} }
#notes-list .note .delete-note { display:none; }
#notes-list .note:hover .delete-note { display:block; }
#issues-table-holder .issue .action-links {
display:none;
a {
margin-left:10px;
}
}
.issue-number {
float: left;
border-radius: 5px;
text-shadow: none;
background: rgba(0, 0, 0, 0.12);
text-align: center;
padding: 14px 8px;
width: 40px;
margin-right: 10px;
color: #444;
}
#issues-table-holder .issue:hover .action-links { display:block; }
body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;} body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;}
body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;} body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;}
body.project-page #notes-list .note img{float: left; margin-right: 10px;} body.project-page #notes-list .note img{float: left; margin-right: 10px;}

View file

@ -47,6 +47,7 @@ class IssuesController < ApplicationController
def create def create
@issue = @project.issues.new(params[:issue]) @issue = @project.issues.new(params[:issue])
@issue.author = current_user @issue.author = current_user
if @issue.save && @issue.assignee != current_user if @issue.save && @issue.assignee != current_user
Notify.new_issue_email(@issue).deliver Notify.new_issue_email(@issue).deliver
end end

View file

@ -1,14 +1,5 @@
%table.round-borders#issues-table - @issues.critical.each do |issue|
%thead = render(:partial => 'show', :locals => {:issue => issue})
- if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0"
%th
%th Assignee
%th ID
%th Title
%th Closed?
- @issues.critical.each do |issue| - @issues.non_critical.each do |issue|
= render(:partial => 'show', :locals => {:issue => issue}) = render(:partial => 'show', :locals => {:issue => issue})
- @issues.non_critical.each do |issue|
= render(:partial => 'show', :locals => {:issue => issue})

View file

@ -1,37 +1,29 @@
%tr{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(@project, issue) } %tr{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(@project, issue) }
- if can?(current_user, :admin_issue, @project) && (!params[:f] || params[:f] == "0") -#- if can?(current_user, :admin_issue, @project) && (!params[:f] || params[:f] == "0")
%td %td
= image_tag "move.png" , :class => [:handle, :left] = image_tag "move.png" , :class => [:handle, :left]
%td %td
= image_tag gravatar_icon(issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;" %strong.issue-number= "##{issue.id}"
= issue.assignee.name %span
%td ##{issue.id} = truncate(html_escape(issue.title), :length => fixed_mode? ? 100 : 200)
%td
= truncate(html_escape(issue.title), :length => 200)
%br %br
%br %br
- if issue.critical %div.note-author
%span.tag.high critical %strong= issue.assignee.name
- if issue.today? %cite.cgray
%span.tag.today today = time_ago_in_words(issue.updated_at)
ago
.right - if issue.critical
- if can?(current_user, :admin_issue, @project) || issue.author == current_user %span.tag.high critical
= link_to 'Edit', edit_project_issue_path(@project, issue), :class => "cgray", :remote => true - if issue.today?
- if can?(current_user, :admin_issue, @project) || issue.author == current_user %span.tag.today today
&nbsp; .right.action-links
= link_to 'Destroy', [@project, issue], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "cred delete-issue negative", :id => "destroy_issue_#{issue.id}" - if can? current_user, :write_issue, issue
- if issue.closed
-#- if issue.author == current_user = link_to 'Reopen', project_issue_path(@project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "cgray", :remote => true
-#%span.tag.yours yours - else
-#- if issue.notes.count > 0 = link_to 'Resolve', project_issue_path(@project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "cgray", :remote => true
-#%span.tag.notes - if can? current_user, :write_issue, issue
-#= issue.notes.count = link_to 'Edit', edit_project_issue_path(@project, issue), :class => "cgray edit-issue-link", :remote => true
-#notes - if can?(current_user, :admin_issue, @project) || issue.author == current_user
%td = link_to 'Destroy', [@project, issue], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "cred delete-issue negative", :id => "destroy_issue_#{issue.id}"
- if can? current_user, :write_issue, @project
= form_for([@project, issue], :remote => true) do |f|
= f.check_box :closed, :onclick => "$(this).parent().submit();"
= hidden_field_tag :status_only, true
- else
= check_box_tag "closed", 1, issue.closed, :disabled => true

View file

@ -1,6 +1,7 @@
- if @issue.valid? - if @issue.valid?
:plain :plain
$("#new_issue_dialog").dialog("close"); $("#new_issue_dialog").dialog("close");
$("#issues-table").prepend("#{escape_javascript(render(:partial => 'show', :locals => {:issue => @issue} ))}");
$.ajax({type: "GET", url: location.href, dataType: "script"}); $.ajax({type: "GET", url: location.href, dataType: "script"});
- else - else
:plain :plain

View file

@ -1,28 +1,31 @@
%div %div#issues-table-holder
.top_panel_issues %table.round-borders#issues-table
- if can? current_user, :write_issue, @project %thead
%div{:class => "left", :style => "margin-right: 10px;" } %th
= link_to 'New Issue', new_project_issue_path(@project), :remote => true, :class => "lbutton vm" .top_panel_issues
= form_tag search_project_issues_path(@project), :method => :get, :remote => true, :class => :left, :id => "issue_search_form" do - if can? current_user, :write_issue, @project
= hidden_field_tag :project_id, @project.id, { :id => 'project_id' } %div{:class => "left", :style => "margin-right: 10px;" }
= search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search' } = link_to 'New Issue', new_project_issue_path(@project), :remote => true, :class => "lbutton vm"
= form_tag search_project_issues_path(@project), :method => :get, :remote => true, :class => :left, :id => "issue_search_form" do
= hidden_field_tag :project_id, @project.id, { :id => 'project_id' }
= search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search' }
.right.issues_filter .right.issues_filter
= form_tag project_issues_path(@project), :method => :get do = form_tag project_issues_path(@project), :method => :get do
.left .left
= radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "this.form.submit()", :id => "open_issues", :class => "status" = radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "this.form.submit()", :id => "open_issues", :class => "status"
= label_tag "open_issues","Open" = label_tag "open_issues","Open"
.left .left
= radio_button_tag :f, 2, params[:f] == "2", :onclick => "this.form.submit()", :id => "closed_issues", :class => "status" = radio_button_tag :f, 2, params[:f] == "2", :onclick => "this.form.submit()", :id => "closed_issues", :class => "status"
= label_tag "closed_issues","Closed" = label_tag "closed_issues","Closed"
.left .left
= radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues", :class => "status" = radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues", :class => "status"
= label_tag "my_issues","To Me" = label_tag "my_issues","To Me"
.left .left
= radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues", :class => "status" = radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues", :class => "status"
= label_tag "all_issues","All" = label_tag "all_issues","All"
#issues-table-holder= render "issues" = render "issues"
%br %br
:javascript :javascript
var href = $('.issue_search').parent().attr('action'); var href = $('.issue_search').parent().attr('action');
@ -37,7 +40,7 @@
if (terms.length >= 2 || terms.length == 0) { if (terms.length >= 2 || terms.length == 0) {
$.get(href, { 'status': status, 'terms': terms, project: project_id }, function(response) { $.get(href, { 'status': status, 'terms': terms, project: project_id }, function(response) {
$('#issues-table').html(response); $('#issues-table tbody').html(response);
setSortable(); setSortable();
}); });
} }

View file

@ -1,3 +1,3 @@
:plain :plain
$('#issues-table-holder').html("#{escape_javascript(render('issues'))}"); $('#issues-table tbody').html("#{escape_javascript(render('issues'))}");
setSortable(); setSortable();

View file

@ -169,6 +169,7 @@ describe "Issues" do
:assignee => @user, :assignee => @user,
:project => project :project => project
visit project_issues_path(project) visit project_issues_path(project)
page.execute_script("$('.action-links').css('display', 'block');")
click_link "Edit" click_link "Edit"
end end