Created
October 21, 2010 19:46
-
-
Save meineerde/639180 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: app/models/project.rb | |
| =================================================================== | |
| --- app/models/project.rb (revision 4265) | |
| +++ app/models/project.rb (working copy) | |
| @@ -411,7 +411,14 @@ | |
| # Returns a short description of the projects (first lines) | |
| def short_description(length = 255) | |
| - description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description | |
| + case | |
| + when summary.present? | |
| + summary | |
| + when description.present? | |
| + description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip | |
| + else | |
| + "" | |
| + end | |
| end | |
| def css_classes | |
| Index: app/views/projects/_form.rhtml | |
| =================================================================== | |
| --- app/views/projects/_form.rhtml (revision 4265) | |
| +++ app/views/projects/_form.rhtml (working copy) | |
| @@ -8,6 +8,7 @@ | |
| <p><%= label(:project, :parent_id, l(:field_parent)) %><%= parent_project_select_tag(@project) %></p> | |
| <% end %> | |
| +<p><%= f.text_area :summary, :rows => 2, :class => 'wiki-edit' %></p> | |
| <p><%= f.text_area :description, :rows => 5, :class => 'wiki-edit' %></p> | |
| <p><%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen?, :maxlength => 20 %> | |
| <% unless @project.identifier_frozen? %> | |
| Index: db/migrate/20101021153830_add_summary_to_projects.rb | |
| =================================================================== | |
| --- db/migrate/20101021153830_add_summary_to_projects.rb (revision 0) | |
| +++ db/migrate/20101021153830_add_summary_to_projects.rb (revision 0) | |
| @@ -0,0 +1,9 @@ | |
| +class AddSummaryToProjects < ActiveRecord::Migration | |
| + def self.up | |
| + add_column :projects, :summary, :string, :limit => 255, :default => '' | |
| + end | |
| + | |
| + def self.down | |
| + remove_column :projects, :summary | |
| + end | |
| +end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment