summary_to_projects.diff

Holger Just, 2010-10-21 21:47

Download (1.71 KB)

View differences:

app/models/project.rb (working copy)
411 411
  
412 412
  # Returns a short description of the projects (first lines)
413 413
  def short_description(length = 255)
414
    description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
414
    case
415
    when summary.present?
416
      summary
417
    when description.present?
418
      description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip
419
    else
420
      ""
421
    end
415 422
  end
416 423

  
417 424
  def css_classes
app/views/projects/_form.rhtml (working copy)
8 8
    <p><%= label(:project, :parent_id, l(:field_parent)) %><%= parent_project_select_tag(@project) %></p>
9 9
<% end %>
10 10

  
11
<p><%= f.text_area :summary, :rows => 2, :class => 'wiki-edit' %></p>
11 12
<p><%= f.text_area :description, :rows => 5, :class => 'wiki-edit' %></p>
12 13
<p><%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen?, :maxlength => 20 %>
13 14
<% unless @project.identifier_frozen? %>
db/migrate/20101021153830_add_summary_to_projects.rb (revision 0)
1
class AddSummaryToProjects < ActiveRecord::Migration
2
  def self.up
3
    add_column :projects, :summary, :string, :limit => 255, :default => ''
4
  end
5

  
6
  def self.down
7
    remove_column :projects, :summary
8
  end
9
end