Change news subtitle to textarea, no tinymce

This commit is contained in:
Christophe Vilayphiou 2012-09-11 15:40:27 +08:00
parent 71021b8c69
commit 73e48aebc6
3 changed files with 14 additions and 2 deletions

View File

@ -356,4 +356,16 @@ namespace :migrate do
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!(/^\<p\>/, '').gsub!(/\<\/p\>$/, '') rescue nil
p news.save(:validate => false) if news.changed?
i += 1
end if news_bulletins
end
end

View File

@ -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 %>
</div>

View File

@ -21,7 +21,7 @@
<li>
<div class="news_img"><%= link_to image_tag(post.image.url, :size => "290x130"), panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %></div>
<h3 class="h3 news_title"><%= link_to post.title, panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %></h3>
<p class="news_wrap"><%= truncate((post.subtitle rescue '') ,:length => 200).html_safe %></p>
<p class="news_wrap"><%= truncate((post.subtitle rescue '') ,:length => 200) %></p>
</li>
<% end %>
</ul>