diff --git a/app/controllers/admin/e_papers_controller.rb b/app/controllers/admin/e_papers_controller.rb index 472527b..3fd3efc 100644 --- a/app/controllers/admin/e_papers_controller.rb +++ b/app/controllers/admin/e_papers_controller.rb @@ -52,7 +52,7 @@ class Admin::EPapersController < OrbitAdminController def show @paper = Paper.find(params[:id]) @table_fields = [t('e_paper.title'),t('e_paper.topic_name'),t('e_paper.publish_date')] - @topics = @paper.topics.all + @topics = @paper.topics.asc(:created_at) end def send_email_to_subscribers diff --git a/app/controllers/e_papers_controller.rb b/app/controllers/e_papers_controller.rb index 5c90ff6..237d589 100644 --- a/app/controllers/e_papers_controller.rb +++ b/app/controllers/e_papers_controller.rb @@ -52,14 +52,13 @@ class EPapersController < ApplicationController paper_thumb = !paper.image.nil? && !paper.image.url.nil? ? paper.image.thumb.url : "http://www.placehold.it/400x400/EFEFEF/AAAAAA" paper_full = !paper.image.nil? && !paper.image.url.nil? ? paper.image.url : "http://www.placehold.it/1000x1000/EFEFEF/AAAAAA" topics = paper.topics.asc(:created_at).collect do |topic| - desc = ActionView::Base.full_sanitizer.sanitize(topic.content) timg = !topic.image.nil? && !topic.image.url.nil? ? topic.image.thumb.url : "http://www.placehold.it/400x400/EFEFEF/AAAAAA" fimg = !topic.image.nil? && !topic.image.url.nil? ? topic.image.url : "http://www.placehold.it/1000x1000/EFEFEF/AAAAAA" { "link_to_show" => OrbitHelper.url_to_show(topic.to_param) + "?method=showtopic", "episode" => topic.episode, "content" => topic.content, - "description" => desc[0..100], + "description" => topic.description, "publish_date" => topic.created_at, "image_thumb" => timg, "image_full" => fimg diff --git a/app/models/topic.rb b/app/models/topic.rb index 2ca74ae..33bf058 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -7,6 +7,7 @@ class Topic field :episode,as: :slug_title, localize: true field :content, localize: true + field :description, localize: true belongs_to :paper diff --git a/app/views/admin/topics/_form.html.erb b/app/views/admin/topics/_form.html.erb index 60bec29..d1dd2ea 100644 --- a/app/views/admin/topics/_form.html.erb +++ b/app/views/admin/topics/_form.html.erb @@ -76,7 +76,19 @@ <%= f.text_field locale, :class=>'input-block-level', :value => (@topic.episode_translations[locale.to_s] rescue nil) %> <% end %> - + + + +
+ +
+
+ <%= f.fields_for :subtitle_translations do |f| %> + <%= f.text_area locale, rows: 2, class: "input-block-level", value: (@topic.subtitle_translations[locale] rescue nil) %> + <% end %> +
+
+