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

@ -355,5 +355,17 @@ namespace :migrate do
p 'End Site' p 'End Site'
end 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 end

View File

@ -163,7 +163,7 @@
<%= f.label :subtitle, t('news.news_bulletin.subtitle') %> <%= f.label :subtitle, t('news.news_bulletin.subtitle') %>
<%= f.fields_for :subtitle_translations do |f| %> <%= f.fields_for :subtitle_translations do |f| %>
<%= I18nVariable.from_locale(locale) %> <%= 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 %> <% end %>
</div> </div>

View File

@ -21,7 +21,7 @@
<li> <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> <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> <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> </li>
<% end %> <% end %>
</ul> </ul>