From a5f435c547473ca3e81947c60863a3a2cea8c45f Mon Sep 17 00:00:00 2001 From: rulingcom Date: Sat, 3 Aug 2024 12:49:43 +0800 Subject: [PATCH] Add cover image and content field for criteria. Fix css in email. --- app/assets/images/e_paper/AAAAAA.png | Bin 0 -> 182 bytes app/models/paper_criteria.rb | 4 ++ .../admin/e_paper_criterias/_form.html.erb | 54 +++++++++++++++++- .../admin/e_paper_criterias/emailer.html.erb | 38 +++++++++--- app/views/admin/e_papers/_form.html.erb | 10 +++- config/locales/en.yml | 1 + config/locales/zh_tw.yml | 1 + 7 files changed, 97 insertions(+), 11 deletions(-) create mode 100755 app/assets/images/e_paper/AAAAAA.png diff --git a/app/assets/images/e_paper/AAAAAA.png b/app/assets/images/e_paper/AAAAAA.png new file mode 100755 index 0000000000000000000000000000000000000000..772a39b4e7ef6135c9c9edfe34d876f16eac7026 GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_>3?$zOPHh5G(g8jpuJ7N!U$tu0;lqcoUcGwe z%$ZG_Hr>5@clYky&z?PdNOuZqb%w(bDpwecm^^DC&S7B0Bo;>Se apb<}hbENYsC8hxlWAJqKb6Mw<&;$U1c0M2g literal 0 HcmV?d00001 diff --git a/app/models/paper_criteria.rb b/app/models/paper_criteria.rb index cb83668..283f131 100644 --- a/app/models/paper_criteria.rb +++ b/app/models/paper_criteria.rb @@ -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? diff --git a/app/views/admin/e_paper_criterias/_form.html.erb b/app/views/admin/e_paper_criterias/_form.html.erb index 79cf65a..42ca732 100644 --- a/app/views/admin/e_paper_criterias/_form.html.erb +++ b/app/views/admin/e_paper_criterias/_form.html.erb @@ -19,7 +19,7 @@
  • <%= t(:basic) %>
  • <%= t("e_paper.email_setting") %>
  • <%= t("e_paper.email_record") %>
  • - +
  • <%= t('e_paper.image') %>
  • @@ -99,6 +99,37 @@
    + +
    + + +
    + +
    +
    +
    + <% if @paper_criteria.image.file %> + <%= image_tag @paper_criteria.image %> + <% else %> + + <% end %> +
    +
    + + <%= t(:select_image) %> + <%= t(:change) %> + <%= f.file_field :image %> + + <%= t(:cancel) %> +
    + +
    +
    +
    +
    +