Add cover image and content field for criteria. Fix css in email.

This commit is contained in:
rulingcom 2024-08-03 12:49:43 +08:00
parent 6c2a5caf30
commit a5f435c547
7 changed files with 97 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

View File

@ -5,6 +5,7 @@ class PaperCriteria
field :title,as: :slug_title, localize: true
field :description, localize: true
field :content, localize: true
field :start_date, type: DateTime
field :end_date, type: DateTime
field :sending_time, type: DateTime
@ -15,6 +16,9 @@ class PaperCriteria
field :other_emails
field :invalid_emails, type: Array, :default => []
field :send_failed_emails, type: Array, :default => []
mount_uploader :image, ImageUploader
def epaper_topics
tmp = EPaperTopic.where(:period.gte => self.start_date.in_time_zone(Time.zone.utc_offset / 3600), :period.lte => self.end_date.in_time_zone(Time.zone.utc_offset / 3600)).can_display
tmp = EPaperTopic.where(:period.gte => self.start_date.in_time_zone(Time.zone.utc_offset / 3600), :period.lte => self.end_date.in_time_zone(Time.zone.utc_offset / 3600)).limit(1) if tmp.first.nil?

View File

@ -19,7 +19,7 @@
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
<li><a href="#setting" data-toggle="tab"><%= t("e_paper.email_setting") %></a></li>
<li><a href="#record" data-toggle="tab"><%= t("e_paper.email_record") %></a></li>
<!-- <li><a href="#imageupload" data-toggle="tab"><%= t(:image) %></a></li> -->
<li><a href="#imageupload" data-toggle="tab"><%= t('e_paper.image') %></a></li>
</ul>
<div class="tab-content module-area">
@ -99,6 +99,37 @@
</div>
<div class="tab-pane fade" id="record">
</div>
<!-- Images Module -->
<div class="tab-pane fade" id="imageupload">
<!-- Images Upload -->
<div class="control-group">
<label class="control-label muted"><%= t(:image) %></label>
<div class="controls">
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @paper_criteria.image.file %>" data-provides="fileupload">
<div class="fileupload-new thumbnail pull-left">
<% if @paper_criteria.image.file %>
<%= image_tag @paper_criteria.image %>
<% else %>
<img src="/assets/e_paper/AAAAAA" />
<% end %>
</div>
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
<span class="btn btn-file">
<span class="fileupload-new"><%= t(:select_image) %></span>
<span class="fileupload-exists"><%= t(:change) %></span>
<%= f.file_field :image %>
</span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn btn-danger fileupload-remove">
<%= f.check_box :remove_image %><%= t(:remove) %>
</label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
@ -135,6 +166,17 @@
</div>
</div>
</div>
<!-- Content -->
<div class="control-group input-content">
<label class="control-label muted"><%= t(:content) + " (#{t(locale.to_s)})" %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :content_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => @paper_criteria.content_translations[locale] %>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
</div>
@ -142,3 +184,11 @@
<div class="form-actions">
<%= f.submit t('submit'), class: 'btn btn-primary' %>
</div>
<script type="text/javascript">
$(document).on('click', '.fileupload-remove', function(){
if($(this).find(".delete_image").length != 0){
$(this).parents('.image_group').remove();
}
});
</script>

View File

@ -17,8 +17,7 @@
.epaper-show .ep-info {
background: #fff;
border-radius: 3px;
padding: 10px;
margin: 0 0 15px;
margin: 10px 0 25px;
}
.epaper-show .ep-info-title {
border-bottom: 1px solid #eee;
@ -44,10 +43,14 @@
clear: both;
padding: 10px 0 0;
overflow: hidden;
width: 80%;
}
.epaper-show .field-head {
font-size: 18px;
margin-right: 2em;
}
.epaper-show .ep-info-description span {
float: right;
width: calc(100% - 90px);
float: left;
line-height: 1.5;
}
.epaper-show .ep-content-item {
@ -161,10 +164,30 @@
</head>
<body>
<div class="epaper-show">
<h3 class="epaper-show-title"><%= t('e_paper.intro') %></h3>
<% if paper.image.present? %>
<img src="<%= siteurl + "/" + paper.image.url %>" alt="<%= paper.title %>" />
<% end %>
<div class="ep-info">
<div class="ep-info-title"><%= t('e_paper.title') %><a class="ep-content-title" href="<%= page + "/" + paper.to_param + "?method=topics" %>" target="_blank"><span><%= paper.title %></span></a></div>
<div class="ep-info-description"><%= t('e_paper.description') %><span><%= paper.description %></span></div>
<div class="ep-info-title">
<span class="field-head">
<%= t('e_paper.title') %>
</span>
<h3 class="epaper-show-title">
<a class="ep-content-title" href="<%= page + "/" + paper.to_param + "?method=topics" %>" target="_blank"><span><%= paper.title %></span></a>
</h3>
</div>
<div class="ep-info-description">
<span class="field-head">
<%= t('e_paper.description') %>
</span>
<span>
<%= paper.description.html_safe %>
<% if papers_data.present? %>
<br>
<%= paper.content.html_safe %>
<% end %>
</span>
</div>
</div>
<div class="ep-content">
@ -178,7 +201,6 @@
<img src="<%= (siteurl + "/" + topic.image.thumb.url rescue nil) %>" style="width: 100%;">
</div>
<div class="ep-con" style="width: 58%; float: right;">
<% t = strip_tags(topic.content) %>
<%= topic.description %>
<a class="ep-content-more" href="<%= page + "/" + topic.to_param %>" target="_blank">more</a>
</div>

View File

@ -66,7 +66,7 @@
<% if @paper.image.file %>
<%= image_tag @paper.image %>
<% else %>
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
<img src="/assets/e_paper/AAAAAA" />
<% end %>
</div>
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
@ -145,5 +145,13 @@
<%= f.submit t('submit'), class: 'btn btn-primary' %>
</div>
<script type="text/javascript">
$(document).on('click', '.fileupload-remove', function(){
if($(this).find(".delete_image").length != 0){
$(this).parents('.image_group').remove();
}
});
</script>
</fieldset>

View File

@ -4,6 +4,7 @@ en:
restful_actions:
batch_delete_subscribers: "Batch Delete Subscribers"
e_paper:
image: Cover Image
all_criteria: All Issue
show_progress: "Show Progress"
delete_subscribers_hint2: "Delete Subscribers below forever."

View File

@ -4,6 +4,7 @@ zh_tw:
restful_actions:
batch_delete_subscribers: "批次刪除訂閱者"
e_paper:
image: 封面圖片
all_criteria: 所有電子報
show_progress: "顯示進度"
delete_subscribers_hint2: "永久刪除以下訂閱者"