diff options
| -rw-r--r-- | app/assets/stylesheets/projects.css.scss | 17 | ||||
| -rw-r--r-- | app/controllers/issues_controller.rb | 2 | ||||
| -rw-r--r-- | app/models/issue.rb | 6 | ||||
| -rw-r--r-- | app/views/commits/show.html.haml | 4 | ||||
| -rw-r--r-- | app/views/issues/_form.html.haml | 8 | ||||
| -rw-r--r-- | app/views/issues/_show.html.haml | 2 | ||||
| -rw-r--r-- | app/views/issues/index.html.haml | 2 | ||||
| -rw-r--r-- | app/views/issues/show.html.haml | 20 | ||||
| -rw-r--r-- | app/views/issues/update.js.haml | 2 | ||||
| -rw-r--r-- | db/migrate/20111027152724_issue_conten_to_note.rb | 34 | ||||
| -rw-r--r-- | db/schema.rb | 2 | ||||
| -rw-r--r-- | spec/factories.rb | 1 | ||||
| -rw-r--r-- | spec/requests/issues_spec.rb | 19 |
13 files changed, 95 insertions, 24 deletions
diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index f9c7592bd91..485a0888342 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -411,7 +411,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td { text-shadow: #555 1px 1px; } -/** FALSH **/ +/** FLASH **/ #flash_container { height:40px; @@ -662,6 +662,10 @@ tbody tr:nth-child(2n) td, tbody tr.even td { background: #4466cc; color:white; } + &.normal { + background: #2c5ca6; + color:white; + } &.notes { background: #2c5c66; color:white; @@ -678,9 +682,9 @@ tbody tr:nth-child(2n) td, tbody tr.even td { } .top_panel_issues{ - #issue_search_form { - margin:5px 0; - input { + #issue_search_form { + margin:5px 0; + input { border:1px solid #D3D3D3; padding: 3px; height: 28px; @@ -689,10 +693,13 @@ tbody tr:nth-child(2n) td, tbody tr.even td { box-sizing: border-box; -moz-box-sizing: border-box; - &:focus { + &:focus { border-color:#c2e1ef; } } } } +pre.commit_message { + white-space: pre-wrap; +} diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 3aefb523e1f..722a0df219c 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -34,7 +34,7 @@ class IssuesController < ApplicationController end def show - @notes = @issue.notes + @notes = @issue.notes.order("created_at ASC") @note = @project.notes.new(:noteable => @issue) end diff --git a/app/models/issue.rb b/app/models/issue.rb index ca1c5eaf52d..9fb7ef3060a 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -14,9 +14,9 @@ class Issue < ActiveRecord::Base :presence => true, :length => { :within => 0..255 } - validates :content, - :presence => true, - :length => { :within => 0..2000 } + #validates :content, + #:presence => true, + #:length => { :within => 0..2000 } scope :critical, where(:critical => true) scope :non_critical, where(:critical => false) diff --git a/app/views/commits/show.html.haml b/app/views/commits/show.html.haml index 3beeada8c8c..3227a447a60 100644 --- a/app/views/commits/show.html.haml +++ b/app/views/commits/show.html.haml @@ -16,7 +16,9 @@ %td= @commit.committed_date %tr %td Message - %td= @commit.safe_message + %td + %pre.commit_message + = preserve @commit.safe_message %tr %td Tree %td= link_to 'Browse Code', tree_project_path(@project, :commit_id => @commit.id) diff --git a/app/views/issues/_form.html.haml b/app/views/issues/_form.html.haml index eae0ee0f52c..80f19d627f4 100644 --- a/app/views/issues/_form.html.haml +++ b/app/views/issues/_form.html.haml @@ -7,10 +7,10 @@ .span-8 = f.label :title - = f.text_field :title, :style => "width:450px" - .span-8 - = f.label :content - = f.text_area :content, :style => "width:450px; height:130px" + = f.text_area :title, :style => "width:450px; height:100px", :maxlength => 255 + -#.span-8 + -#= f.label :content + -#= f.text_area :content, :style => "width:450px; height:130px" .span-8.append-bottom = f.label :assignee_id = f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }) diff --git a/app/views/issues/_show.html.haml b/app/views/issues/_show.html.haml index ebcaae29ef5..94cc03d17ae 100644 --- a/app/views/issues/_show.html.haml +++ b/app/views/issues/_show.html.haml @@ -7,7 +7,7 @@ = truncate issue.assignee.name, :lenght => 20 %td ##{issue.id} %td - = html_escape issue.title + = truncate(html_escape(issue.title), :length => 60) %br - if issue.critical %span.tag.high critical diff --git a/app/views/issues/index.html.haml b/app/views/issues/index.html.haml index 56042fa2446..a70c65d47c6 100644 --- a/app/views/issues/index.html.haml +++ b/app/views/issues/index.html.haml @@ -45,7 +45,7 @@ }); $('.delete-issue').live('ajax:success', function() { - $(this).closest('tr').fadeOut(); }); + $(this).closest('tr').fadeOut(); updatePage();}); function setSortable(){ $('#issues-table>tbody').sortable({ diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index 29b6f3f7b84..c61052839f9 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -1,8 +1,7 @@ %h2 - = "Issue ##{@issue.id} - #{@issue.title}" - + = "Issue ##{@issue.id} - #{html_escape(@issue.title)}" .span-15 - = simple_format html_escape(@issue.content) + -#= simple_format html_escape(@issue.content) .issue_notes= render "notes/notes" .span-8.right .span-8 @@ -29,6 +28,16 @@ %td = image_tag gravatar_icon(@issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;" = @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 %td Closed? %td @@ -39,5 +48,10 @@ - else = 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 diff --git a/app/views/issues/update.js.haml b/app/views/issues/update.js.haml index 30fca38c38e..137dba3cc71 100644 --- a/app/views/issues/update.js.haml +++ b/app/views/issues/update.js.haml @@ -6,7 +6,7 @@ - if @issue.valid? :plain $("#edit_issue_dialog").dialog("close"); - $.ajax({type: "GET", url: location.href, dataType: "script"}); + updatePage(); - else :plain $("#edit_issue_dialog").empty(); diff --git a/db/migrate/20111027152724_issue_conten_to_note.rb b/db/migrate/20111027152724_issue_conten_to_note.rb new file mode 100644 index 00000000000..c151a9317ff --- /dev/null +++ b/db/migrate/20111027152724_issue_conten_to_note.rb @@ -0,0 +1,34 @@ +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 diff --git a/db/schema.rb b/db/schema.rb index 1ac90a9b400..13c4db0cc49 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # 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| t.string "title" diff --git a/spec/factories.rb b/spec/factories.rb index cc0cd4e5e8f..36aa4fc9454 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -32,7 +32,6 @@ end Factory.add(:issue, Issue) do |obj| obj.title = Faker::Lorem.sentence - obj.content = Faker::Lorem.sentences end Factory.add(:snippet, Snippet) do |obj| diff --git a/spec/requests/issues_spec.rb b/spec/requests/issues_spec.rb index 184f82931b7..b13e43adc6c 100644 --- a/spec/requests/issues_spec.rb +++ b/spec/requests/issues_spec.rb @@ -80,7 +80,6 @@ describe "Issues" do describe "fill in" do before do fill_in "issue_title", :with => "bug 345" - fill_in "issue_content", :with => "app bug 345" click_link "Select user" click_link @user.name end @@ -112,6 +111,23 @@ describe "Issues" do 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 before do @issue = Factory :issue, @@ -129,7 +145,6 @@ describe "Issues" do describe "fill in" do before do fill_in "issue_title", :with => "bug 345" - fill_in "issue_content", :with => "app bug 345" end it { expect { click_button "Save" }.to_not change {Issue.count} } |
