From 73e48aebc6a1be7e5fb4074866edc96c1983587a Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Tue, 11 Sep 2012 15:40:27 +0800 Subject: [PATCH] Change news subtitle to textarea, no tinymce --- lib/tasks/migrate.rake | 12 ++++++++++++ .../news/back_end/news_bulletins/_form.html.erb | 2 +- .../news/widget/news_bulletins/home_banner.html.erb | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/tasks/migrate.rake b/lib/tasks/migrate.rake index 8b92ea9e..77a200b8 100644 --- a/lib/tasks/migrate.rake +++ b/lib/tasks/migrate.rake @@ -355,5 +355,17 @@ namespace :migrate do p 'End Site' end + + + task :news_p => :environment do + news_bulletins = NewsBulletin.admin_manager_all rescue nil + i = 1 + news_bulletins.each do |news| + p "#{i}/#{news_bulletins.size} - #{news.id}" + news.subtitle.gsub!(/^\/, '').gsub!(/\<\/p\>$/, '') rescue nil + p news.save(:validate => false) if news.changed? + i += 1 + end if news_bulletins + end end diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb index d62b4e87..c7db4c64 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb @@ -163,7 +163,7 @@ <%= f.label :subtitle, t('news.news_bulletin.subtitle') %> <%= f.fields_for :subtitle_translations do |f| %> <%= I18nVariable.from_locale(locale) %> - <%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea', :value => (@news_bulletin.subtitle_translations[locale] rescue nil) %> + <%= f.text_area locale, :style=>"width:100%", :value => (@news_bulletin.subtitle_translations[locale] rescue nil) %> <% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb index c61b60ff..31844d11 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb @@ -21,7 +21,7 @@
  • <%= link_to image_tag(post.image.url, :size => "290x130"), panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %>

    <%= link_to post.title, panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %>

    -

    <%= truncate((post.subtitle rescue '') ,:length => 200).html_safe %>

    +

    <%= truncate((post.subtitle rescue '') ,:length => 200) %>

  • <% end %>