Commit 3fa770dd authored by gitlabhq's avatar gitlabhq

Merge branch 'new_issue' into dev

parents 89fa800e a0171813
...@@ -662,6 +662,10 @@ tbody tr:nth-child(2n) td, tbody tr.even td { ...@@ -662,6 +662,10 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
background: #4466cc; background: #4466cc;
color:white; color:white;
} }
&.normal {
background: #2c5ca6;
color:white;
}
&.notes { &.notes {
background: #2c5c66; background: #2c5c66;
color:white; color:white;
......
...@@ -34,7 +34,7 @@ class IssuesController < ApplicationController ...@@ -34,7 +34,7 @@ class IssuesController < ApplicationController
end end
def show def show
@notes = @issue.notes @notes = @issue.notes.order("created_at ASC")
@note = @project.notes.new(:noteable => @issue) @note = @project.notes.new(:noteable => @issue)
end end
......
...@@ -14,9 +14,9 @@ class Issue < ActiveRecord::Base ...@@ -14,9 +14,9 @@ class Issue < ActiveRecord::Base
:presence => true, :presence => true,
:length => { :within => 0..255 } :length => { :within => 0..255 }
validates :content, #validates :content,
:presence => true, #:presence => true,
:length => { :within => 0..2000 } #:length => { :within => 0..2000 }
scope :critical, where(:critical => true) scope :critical, where(:critical => true)
scope :non_critical, where(:critical => false) scope :non_critical, where(:critical => false)
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
.span-8 .span-8
= f.label :title = f.label :title
= f.text_field :title, :style => "width:450px" = f.text_area :title, :style => "width:450px; height:100px", :maxlength => 255
.span-8 -#.span-8
= f.label :content -#= f.label :content
= f.text_area :content, :style => "width:450px; height:130px" -#= f.text_area :content, :style => "width:450px; height:130px"
.span-8.append-bottom .span-8.append-bottom
= f.label :assignee_id = f.label :assignee_id
= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }) = f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" })
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
= truncate issue.assignee.name, :lenght => 20 = truncate issue.assignee.name, :lenght => 20
%td ##{issue.id} %td ##{issue.id}
%td %td
= html_escape issue.title = truncate(html_escape(issue.title), :length => 60)
%br %br
- if issue.critical - if issue.critical
%span.tag.high critical %span.tag.high critical
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
}); });
$('.delete-issue').live('ajax:success', function() { $('.delete-issue').live('ajax:success', function() {
$(this).closest('tr').fadeOut(); }); $(this).closest('tr').fadeOut(); updatePage();});
function setSortable(){ function setSortable(){
$('#issues-table>tbody').sortable({ $('#issues-table>tbody').sortable({
......
%h2 %h2
= "Issue ##{@issue.id} - #{@issue.title}" = "Issue ##{@issue.id} - #{html_escape(@issue.title)}"
.span-15 .span-15
= simple_format html_escape(@issue.content) -#= simple_format html_escape(@issue.content)
.issue_notes= render "notes/notes" .issue_notes= render "notes/notes"
.span-8.right .span-8.right
.span-8 .span-8
...@@ -29,6 +28,16 @@ ...@@ -29,6 +28,16 @@
%td %td
= image_tag gravatar_icon(@issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;" = image_tag gravatar_icon(@issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;"
= @issue.assignee.name = @issue.assignee.name
%tr
%td Tags
%td
- if @issue.critical
%span.tag.high critical
- else
%span.tag.normal normal
- if @issue.today?
%span.tag.today today
%tr %tr
%td Closed? %td Closed?
%td %td
...@@ -39,5 +48,10 @@ ...@@ -39,5 +48,10 @@
- else - else
= check_box_tag "closed", 1, @issue.closed, :disabled => true = check_box_tag "closed", 1, @issue.closed, :disabled => true
- if can?(current_user, :admin_issue, @issue)
.clear
= link_to 'Edit', edit_project_issue_path(@project, @issue), :class => "lbutton positive", :remote => true
.right= link_to 'Destroy', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-issue negative", :id => "destroy_issue_#{@issue.id}"
.clear .clear
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
- if @issue.valid? - if @issue.valid?
:plain :plain
$("#edit_issue_dialog").dialog("close"); $("#edit_issue_dialog").dialog("close");
$.ajax({type: "GET", url: location.href, dataType: "script"}); updatePage();
- else - else
:plain :plain
$("#edit_issue_dialog").empty(); $("#edit_issue_dialog").empty();
......
class IssueContenToNote < ActiveRecord::Migration
def up
puts "Issue content is deprecated -> move to notes"
Issue.find_each(:batch_size => 100) do |issue|
next if issue.content.blank?
note = Note.new(
:note => issue.content,
:project_id => issue.project_id,
:noteable => issue,
:created_at => issue.created_at,
:updated_at => issue.created_at
)
note.author_id = issue.author_id
if note.save
issue.update_attributes(:content => nil)
print "."
else
print "F"
end
end
total = Issue.where("content is not null").count
if total > 0
puts "content of #{total} issues were not migrated"
else
puts "Done"
end
end
def down
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20111027142641) do ActiveRecord::Schema.define(:version => 20111027152724) do
create_table "issues", :force => true do |t| create_table "issues", :force => true do |t|
t.string "title" t.string "title"
......
...@@ -32,7 +32,6 @@ end ...@@ -32,7 +32,6 @@ end
Factory.add(:issue, Issue) do |obj| Factory.add(:issue, Issue) do |obj|
obj.title = Faker::Lorem.sentence obj.title = Faker::Lorem.sentence
obj.content = Faker::Lorem.sentences
end end
Factory.add(:snippet, Snippet) do |obj| Factory.add(:snippet, Snippet) do |obj|
......
...@@ -80,7 +80,6 @@ describe "Issues" do ...@@ -80,7 +80,6 @@ describe "Issues" do
describe "fill in" do describe "fill in" do
before do before do
fill_in "issue_title", :with => "bug 345" fill_in "issue_title", :with => "bug 345"
fill_in "issue_content", :with => "app bug 345"
click_link "Select user" click_link "Select user"
click_link @user.name click_link @user.name
end end
...@@ -112,6 +111,23 @@ describe "Issues" do ...@@ -112,6 +111,23 @@ describe "Issues" do
end end
end end
describe "Show issue" do
before do
@issue = Factory :issue,
:author => @user,
:assignee => @user,
:project => project
visit project_issue_path(project, @issue)
end
it "should have valid show page for issue" do
page.should have_content @issue.title
page.should have_content @user.name
page.should have_content "today"
end
end
describe "Edit issue", :js => true do describe "Edit issue", :js => true do
before do before do
@issue = Factory :issue, @issue = Factory :issue,
...@@ -129,7 +145,6 @@ describe "Issues" do ...@@ -129,7 +145,6 @@ describe "Issues" do
describe "fill in" do describe "fill in" do
before do before do
fill_in "issue_title", :with => "bug 345" fill_in "issue_title", :with => "bug 345"
fill_in "issue_content", :with => "app bug 345"
end end
it { expect { click_button "Save" }.to_not change {Issue.count} } it { expect { click_button "Save" }.to_not change {Issue.count} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment