From 0016397a89e3afa70b11376c1f2b5fa88be89867 Mon Sep 17 00:00:00 2001 From: Alinson Santos Date: Wed, 12 Mar 2008 18:54:13 -0300 Subject: [PATCH] Interface: algumas mudancas para comportar melhor textos grandes --- app/helpers/application_helper.rb | 4 ++++ app/views/events/index.html.haml | 2 +- app/views/layouts/news.html.haml | 1 - app/views/news/index.html.haml | 2 +- app/views/news/index.rss.builder | 2 +- app/views/users/dashboard.html.haml | 2 +- app/views/users/dashboard.rss.builder | 2 +- app/views/widgets/calendario.html.erb | 2 +- 8 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f4af114..5956880 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -53,6 +53,10 @@ module ApplicationHelper BlueCloth.new(text).to_html end + def formatted(text) + h(text).gsub("\n", "
") + end + def highlight(name) return {:class => 'highlight'} if (flash[:highlight] == name) end diff --git a/app/views/events/index.html.haml b/app/views/events/index.html.haml index f93f195..988fd8f 100644 --- a/app/views/events/index.html.haml +++ b/app/views/events/index.html.haml @@ -25,7 +25,7 @@ %div.cmd = action_icon 'edit', 'Editar', edit_course_event_url(@course, event) = action_icon 'trash', 'Excluir', course_event_url(@course, event), :confirm => 'Tem certeza que deseja excluir?', :method => :delete - = h(event.description) + = formatted(event.description) = "Sem descrição" if event.description.empty? - last_date = event.time diff --git a/app/views/layouts/news.html.haml b/app/views/layouts/news.html.haml index 9a17172..87a7760 100644 --- a/app/views/layouts/news.html.haml +++ b/app/views/layouts/news.html.haml @@ -6,7 +6,6 @@ = link_to("Noticias", course_news_index_url(@course)) - @left_panel = render 'courses/_left_panel' -- @right_panel = render 'courses/_right_panel' - @content = yield = render 'layouts/base' diff --git a/app/views/news/index.html.haml b/app/views/news/index.html.haml index e4e46e7..11822c3 100644 --- a/app/views/news/index.html.haml +++ b/app/views/news/index.html.haml @@ -23,7 +23,7 @@ .cmd = action_icon 'edit', 'Editar', edit_course_news_url(@course, n) = action_icon 'trash', 'Excluir', course_news_url(@course, n), :confirm => 'Tem certeza que deseja excluir?', :method => :delete - = h(n.body) + = formatted(n.body) = "Sem descrição" if n.body.empty? - else .box diff --git a/app/views/news/index.rss.builder b/app/views/news/index.rss.builder index 705674a..9f37a2a 100644 --- a/app/views/news/index.rss.builder +++ b/app/views/news/index.rss.builder @@ -8,7 +8,7 @@ xml.rss(:version=>"2.0") do for news_item in @news xml.item do xml.title(news_item.title) - xml.description(news_item.body) + xml.description(formatted(news_item.body)) xml.pubDate(news_item.timestamp.rfc2822) xml.link(course_news_url(@course, news_item)) xml.guid(course_news_url(@course, news_item)) diff --git a/app/views/users/dashboard.html.haml b/app/views/users/dashboard.html.haml index ccd183f..8e36941 100644 --- a/app/views/users/dashboard.html.haml +++ b/app/views/users/dashboard.html.haml @@ -22,7 +22,7 @@ = link_to(h(n.course.full_name), course_url(n.course)) + " ›" = link_to(h(n.title), course_news_url(n.course, n)) - unless n.body.empty? - %p= h(n.body) + %p= truncate(n.body, 300) .box .cmd diff --git a/app/views/users/dashboard.rss.builder b/app/views/users/dashboard.rss.builder index 9b5765f..bd577a4 100644 --- a/app/views/users/dashboard.rss.builder +++ b/app/views/users/dashboard.rss.builder @@ -8,7 +8,7 @@ xml.rss(:version=>"2.0") do for news_item in @news xml.item do xml.title(news_item.course.short_name + ": " + news_item.title) - xml.description(news_item.body) + xml.description(formatted(news_item.body)) xml.pubDate(news_item.timestamp.rfc2822) xml.link(course_news_url(news_item.course, news_item)) xml.guid(course_news_url(news_item.course, news_item)) diff --git a/app/views/widgets/calendario.html.erb b/app/views/widgets/calendario.html.erb index 53073d6..f6066fe 100644 --- a/app/views/widgets/calendario.html.erb +++ b/app/views/widgets/calendario.html.erb @@ -37,7 +37,7 @@ <% @events.each do |e| -%> <% end -%>