Add cover image and content field for criteria. Fix css in email.
This commit is contained in:
parent
6c2a5caf30
commit
a5f435c547
Binary file not shown.
After Width: | Height: | Size: 182 B |
|
@ -5,6 +5,7 @@ class PaperCriteria
|
||||||
|
|
||||||
field :title,as: :slug_title, localize: true
|
field :title,as: :slug_title, localize: true
|
||||||
field :description, localize: true
|
field :description, localize: true
|
||||||
|
field :content, localize: true
|
||||||
field :start_date, type: DateTime
|
field :start_date, type: DateTime
|
||||||
field :end_date, type: DateTime
|
field :end_date, type: DateTime
|
||||||
field :sending_time, type: DateTime
|
field :sending_time, type: DateTime
|
||||||
|
@ -15,6 +16,9 @@ class PaperCriteria
|
||||||
field :other_emails
|
field :other_emails
|
||||||
field :invalid_emails, type: Array, :default => []
|
field :invalid_emails, type: Array, :default => []
|
||||||
field :send_failed_emails, type: Array, :default => []
|
field :send_failed_emails, type: Array, :default => []
|
||||||
|
|
||||||
|
mount_uploader :image, ImageUploader
|
||||||
|
|
||||||
def epaper_topics
|
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)).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?
|
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?
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
|
<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="#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="#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>
|
</ul>
|
||||||
<div class="tab-content module-area">
|
<div class="tab-content module-area">
|
||||||
|
|
||||||
|
@ -99,6 +99,37 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="record">
|
<div class="tab-pane fade" id="record">
|
||||||
</div>
|
</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>
|
||||||
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
||||||
<ul class="nav nav-pills language-nav">
|
<ul class="nav nav-pills language-nav">
|
||||||
|
@ -135,6 +166,17 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -142,3 +184,11 @@
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).on('click', '.fileupload-remove', function(){
|
||||||
|
if($(this).find(".delete_image").length != 0){
|
||||||
|
$(this).parents('.image_group').remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -17,8 +17,7 @@
|
||||||
.epaper-show .ep-info {
|
.epaper-show .ep-info {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
padding: 10px;
|
margin: 10px 0 25px;
|
||||||
margin: 0 0 15px;
|
|
||||||
}
|
}
|
||||||
.epaper-show .ep-info-title {
|
.epaper-show .ep-info-title {
|
||||||
border-bottom: 1px solid #eee;
|
border-bottom: 1px solid #eee;
|
||||||
|
@ -44,10 +43,14 @@
|
||||||
clear: both;
|
clear: both;
|
||||||
padding: 10px 0 0;
|
padding: 10px 0 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
.epaper-show .field-head {
|
||||||
|
font-size: 18px;
|
||||||
|
margin-right: 2em;
|
||||||
}
|
}
|
||||||
.epaper-show .ep-info-description span {
|
.epaper-show .ep-info-description span {
|
||||||
float: right;
|
float: left;
|
||||||
width: calc(100% - 90px);
|
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
.epaper-show .ep-content-item {
|
.epaper-show .ep-content-item {
|
||||||
|
@ -161,10 +164,30 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="epaper-show">
|
<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">
|
||||||
<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-title">
|
||||||
<div class="ep-info-description"><%= t('e_paper.description') %><span><%= paper.description %></span></div>
|
<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>
|
||||||
|
|
||||||
<div class="ep-content">
|
<div class="ep-content">
|
||||||
|
@ -178,7 +201,6 @@
|
||||||
<img src="<%= (siteurl + "/" + topic.image.thumb.url rescue nil) %>" style="width: 100%;">
|
<img src="<%= (siteurl + "/" + topic.image.thumb.url rescue nil) %>" style="width: 100%;">
|
||||||
</div>
|
</div>
|
||||||
<div class="ep-con" style="width: 58%; float: right;">
|
<div class="ep-con" style="width: 58%; float: right;">
|
||||||
<% t = strip_tags(topic.content) %>
|
|
||||||
<%= topic.description %>
|
<%= topic.description %>
|
||||||
<a class="ep-content-more" href="<%= page + "/" + topic.to_param %>" target="_blank">more</a>
|
<a class="ep-content-more" href="<%= page + "/" + topic.to_param %>" target="_blank">more</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
<% if @paper.image.file %>
|
<% if @paper.image.file %>
|
||||||
<%= image_tag @paper.image %>
|
<%= image_tag @paper.image %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
|
<img src="/assets/e_paper/AAAAAA" />
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
||||||
|
@ -145,5 +145,13 @@
|
||||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||||
</div>
|
</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>
|
</fieldset>
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ en:
|
||||||
restful_actions:
|
restful_actions:
|
||||||
batch_delete_subscribers: "Batch Delete Subscribers"
|
batch_delete_subscribers: "Batch Delete Subscribers"
|
||||||
e_paper:
|
e_paper:
|
||||||
|
image: Cover Image
|
||||||
all_criteria: All Issue
|
all_criteria: All Issue
|
||||||
show_progress: "Show Progress"
|
show_progress: "Show Progress"
|
||||||
delete_subscribers_hint2: "Delete Subscribers below forever."
|
delete_subscribers_hint2: "Delete Subscribers below forever."
|
||||||
|
|
|
@ -4,6 +4,7 @@ zh_tw:
|
||||||
restful_actions:
|
restful_actions:
|
||||||
batch_delete_subscribers: "批次刪除訂閱者"
|
batch_delete_subscribers: "批次刪除訂閱者"
|
||||||
e_paper:
|
e_paper:
|
||||||
|
image: 封面圖片
|
||||||
all_criteria: 所有電子報
|
all_criteria: 所有電子報
|
||||||
show_progress: "顯示進度"
|
show_progress: "顯示進度"
|
||||||
delete_subscribers_hint2: "永久刪除以下訂閱者"
|
delete_subscribers_hint2: "永久刪除以下訂閱者"
|
||||||
|
|
Loading…
Reference in New Issue