From 3af574f76eaaefa5ba06780bc4d0466526b3d710 Mon Sep 17 00:00:00 2001 From: lukemelia Date: Sat, 17 Feb 2007 06:01:54 +0000 Subject: [PATCH] Strip non-breaking space HTML entities from the text feeds. Fixes #443. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@441 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/app/helpers/application_helper.rb | 4 ++++ tracks/app/views/contexts/index_text.rhtml | 2 +- tracks/app/views/projects/index_text.rhtml | 2 +- tracks/test/functional/contexts_controller_test.rb | 2 +- tracks/test/functional/projects_controller_test.rb | 1 + 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tracks/app/helpers/application_helper.rb b/tracks/app/helpers/application_helper.rb index 83fe7258..2d974440 100644 --- a/tracks/app/helpers/application_helper.rb +++ b/tracks/app/helpers/application_helper.rb @@ -116,6 +116,10 @@ module ApplicationHelper def count_undone_todos(todos_parent, string="actions") @controller.count_undone_todos(todos_parent, string) end + + def count_undone_todos_text(todos_parent, string="actions") + count_undone_todos(todos_parent, string).gsub(" "," ") + end def link_to_context(context, descriptor = sanitize(context.name)) link_to( descriptor, context_path(context), :title => "View context: #{context.name}" ) diff --git a/tracks/app/views/contexts/index_text.rhtml b/tracks/app/views/contexts/index_text.rhtml index 329e8a15..2b875773 100644 --- a/tracks/app/views/contexts/index_text.rhtml +++ b/tracks/app/views/contexts/index_text.rhtml @@ -1,5 +1,5 @@ <% @contexts.each do |c| -%> <%= c.name.upcase %> -<%= count_undone_todos(c)%>. Context is <%= c.hidden? ? "Hidden" : "Active" %>. +<%= count_undone_todos_text(c)%>. Context is <%= c.hidden? ? "Hidden" : "Active" %>. <% end -%> \ No newline at end of file diff --git a/tracks/app/views/projects/index_text.rhtml b/tracks/app/views/projects/index_text.rhtml index e6caee2e..478ca227 100644 --- a/tracks/app/views/projects/index_text.rhtml +++ b/tracks/app/views/projects/index_text.rhtml @@ -2,6 +2,6 @@ <%= p.name.upcase %> <%= p.description + "\n" if p.description_present? -%> -<%= count_undone_todos(p)%>. Project is <%= p.state %>. +<%= count_undone_todos_text(p)%>. Project is <%= p.state %>. <%= p.linkurl + "\n" if p.linkurl_present? -%> <% end -%> \ No newline at end of file diff --git a/tracks/test/functional/contexts_controller_test.rb b/tracks/test/functional/contexts_controller_test.rb index cd033984..82a0ebba 100644 --- a/tracks/test/functional/contexts_controller_test.rb +++ b/tracks/test/functional/contexts_controller_test.rb @@ -121,7 +121,7 @@ class ContextsControllerTest < TodoContainerControllerTestBase @request.session['user_id'] = users(:admin_user).id get :index, { :format => "txt" } assert_equal 'text/plain; charset=utf-8', @response.headers["Content-Type"] - #puts @response.body + assert !(/ /.match(@response.body)) end def test_text_feed_not_accessible_to_anonymous_user_without_token diff --git a/tracks/test/functional/projects_controller_test.rb b/tracks/test/functional/projects_controller_test.rb index d926bbd1..d9934377 100644 --- a/tracks/test/functional/projects_controller_test.rb +++ b/tracks/test/functional/projects_controller_test.rb @@ -159,6 +159,7 @@ class ProjectsControllerTest < TodoContainerControllerTestBase @request.session['user_id'] = users(:admin_user).id get :index, { :format => "txt" } assert_equal 'text/plain; charset=utf-8', @response.headers["Content-Type"] + assert !(/ /.match(@response.body)) #puts @response.body end