Commit 17bb9ec5b2d8aca693e01fb4107712b90c9477ce

Project#strip_description => Project#stripped_description

Commit diff

app/models/project.rb

 
7575 super
7676 end
7777
78 def strip_description
78 def stripped_description
7979 description.gsub(/<\/?[^>]*>/, "")
8080 end
8181
toggle raw diff

app/views/projects/_project.html.erb

 
11<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>
33<p class="hint">
44 <strong>Categories:</strong>
55 <%= project.tag_list.blank? ? "none" : linked_tag_list_as_sentence(project.tags) -%>
toggle raw diff

app/views/site/index.html.erb

 
2222 <% @projects.each do |project| -%>
2323 <li>
2424 <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>
2626 </li>
2727 <% end -%>
2828 </ul>
toggle raw diff

spec/models/project_spec.rb

 
8282
8383 it "should strip html tags" do
8484 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
8686 end
8787
8888end
toggle raw diff