added subtitle to toics

This commit is contained in:
Harry Bomrah 2017-08-07 17:53:17 +08:00
parent 81870c9412
commit 02bd07d62b
4 changed files with 16 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -7,6 +7,7 @@ class Topic
field :episode,as: :slug_title, localize: true
field :content, localize: true
field :description, localize: true
belongs_to :paper

View File

@ -78,6 +78,18 @@
</div>
</div>
<!-- Sub Title -->
<div class="control-group input-subtitle">
<label class="control-label muted"><%= t(:subtitle) %></label>
<div class="controls">
<div class="textarea">
<%= 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 %>
</div>
</div>
</div>
<!-- Content -->
<div class="control-group input-content">
<label class="control-label muted"><%= t('e_paper.content') %> (<%= t(locale.to_s) %>)</label>