Commit 17bb9ec5b2d8aca693e01fb4107712b90c9477ce
- Date: Mon Mar 03 21:27:05 +0000 2008
- Committer: Johan Sørensen (johan@johansorensen.com)
- Author: Johan Sørensen (johan@johansorensen.com)
- Commit SHA1: 17bb9ec5b2d8aca693e01fb4107712b90c9477ce
- Tree SHA1: ec3984795f78d727da88900333e5b40f5473d3bc
Project#strip_description => Project#stripped_description
Commit diff
| |   |
| 75 | 75 | super |
| 76 | 76 | end |
| 77 | 77 | |
| 78 | | def strip_description |
| 78 | def stripped_description |
| 79 | 79 | description.gsub(/<\/?[^>]*>/, "") |
| 80 | 80 | end |
| 81 | 81 | |
| toggle raw diff |
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -75,7 +75,7 @@ class Project < ActiveRecord::Base
super
end
- def strip_description
+ def stripped_description
description.gsub(/<\/?[^>]*>/, "")
end
|
| |   |
| 1 | 1 | <h3><%= link_to project.title, project_path(project) -%></h3> |
| 2 | | <p><%= truncate h(project.strip_description), 250 -%></p> |
| 2 | <p><%= truncate h(project.stripped_description), 250 -%></p> |
| 3 | 3 | <p class="hint"> |
| 4 | 4 | <strong>Categories:</strong> |
| 5 | 5 | <%= project.tag_list.blank? ? "none" : linked_tag_list_as_sentence(project.tags) -%> |
| toggle raw diff |
--- a/app/views/projects/_project.html.erb
+++ b/app/views/projects/_project.html.erb
@@ -1,5 +1,5 @@
<h3><%= link_to project.title, project_path(project) -%></h3>
-<p><%= truncate h(project.strip_description), 250 -%></p>
+<p><%= truncate h(project.stripped_description), 250 -%></p>
<p class="hint">
<strong>Categories:</strong>
<%= project.tag_list.blank? ? "none" : linked_tag_list_as_sentence(project.tags) -%> |
| |   |
| 22 | 22 | <% @projects.each do |project| -%> |
| 23 | 23 | <li> |
| 24 | 24 | <strong><%= link_to h(project.title), project -%></strong> |
| 25 | | <small class="hint"><%= truncate(h(project.strip_description), 100) -%></small> |
| 25 | <small class="hint"><%= truncate(h(project.stripped_description), 100) -%></small> |
| 26 | 26 | </li> |
| 27 | 27 | <% end -%> |
| 28 | 28 | </ul> |
| toggle raw diff |
--- a/app/views/site/index.html.erb
+++ b/app/views/site/index.html.erb
@@ -22,7 +22,7 @@
<% @projects.each do |project| -%>
<li>
<strong><%= link_to h(project.title), project -%></strong>
- <small class="hint"><%= truncate(h(project.strip_description), 100) -%></small>
+ <small class="hint"><%= truncate(h(project.stripped_description), 100) -%></small>
</li>
<% end -%>
</ul> |
| |   |
| 82 | 82 | |
| 83 | 83 | it "should strip html tags" do |
| 84 | 84 | project = create_project(:description => "<h1>Project A</h1>\n<b>Project A</b> is a....") |
| 85 | | project.strip_description.index(/<\/?[^>]*>/).should == nil |
| 85 | project.stripped_description.index(/<\/?[^>]*>/).should == nil |
| 86 | 86 | end |
| 87 | 87 | |
| 88 | 88 | end |
| toggle raw diff |
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -82,7 +82,7 @@ describe Project do
it "should strip html tags" do
project = create_project(:description => "<h1>Project A</h1>\n<b>Project A</b> is a....")
- project.strip_description.index(/<\/?[^>]*>/).should == nil
+ project.stripped_description.index(/<\/?[^>]*>/).should == nil
end
end |