ntue announcement email reminder fix and gemfile tinymce fix
This commit is contained in:
parent
77c0fdffd2
commit
1cc1c6856e
2
Gemfile
2
Gemfile
|
@ -48,7 +48,7 @@ gem 'sinatra'
|
|||
gem 'sprockets'
|
||||
gem 'social-share-button'
|
||||
|
||||
gem 'tinymce-rails'
|
||||
gem 'tinymce-rails', "~> 3.5.8"
|
||||
gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux")
|
||||
gem 'libv8', '~> 3.11.8' if RUBY_PLATFORM.downcase.include?("linux")
|
||||
gem 'mongoid-encryptor', :require => 'mongoid/encryptor'
|
||||
|
|
|
@ -34,15 +34,15 @@ Orbit::Application.configure do
|
|||
# :sender_address => %{"notifier" <redmine@rulingcom.com>},
|
||||
# :exception_recipients => %w{chris@rulingcom.com}
|
||||
|
||||
config.action_mailer.delivery_method = :smtp
|
||||
config.action_mailer.smtp_settings = {
|
||||
:enable_starttls_auto => true,
|
||||
:address => "smtp.gmail.com",
|
||||
:port => '587',
|
||||
:domain => "smtp.gmail.com",
|
||||
:authentication => "plain",
|
||||
:user_name => "redmine@rulingcom.com",
|
||||
:password => "rulingredmine" }
|
||||
# config.action_mailer.delivery_method = :smtp
|
||||
# config.action_mailer.smtp_settings = {
|
||||
# :enable_starttls_auto => true,
|
||||
# :address => "smtp.gmail.com",
|
||||
# :port => '587',
|
||||
# :domain => "smtp.gmail.com",
|
||||
# :authentication => "plain",
|
||||
# :user_name => "redmine@rulingcom.com",
|
||||
# :password => "rulingredmine" }
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# encoding: utf-8
|
||||
class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendController
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
|
@ -15,6 +16,14 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
|
|||
@bulletin.proc_check(params[:bulletin][:is_checked],params[:bulletin][:not_checked_reason])
|
||||
@bulletin.de_pending
|
||||
if @bulletin.save
|
||||
|
||||
if @bulletin.email_sent == true && @bulletin.is_checked == true && !@bulletin.is_rejected
|
||||
send_email_data(@bulletin)
|
||||
|
||||
@bulletin.email_sent = false
|
||||
@bulletin.save
|
||||
end
|
||||
|
||||
notice = t('announcement.approve_bulletin_success')
|
||||
else
|
||||
notice = t('announcement.approve_bulletin_fail')
|
||||
|
@ -61,6 +70,66 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
|
|||
object_auth.privilege_users = privilege_users
|
||||
object_auth
|
||||
end
|
||||
|
||||
def send_email_data(bulletin)
|
||||
|
||||
@site = Site.first
|
||||
@user = User.find(bulletin.create_user_id)
|
||||
@host = request.host_with_port
|
||||
|
||||
email_group_data
|
||||
|
||||
@group_mail = Array.new
|
||||
|
||||
bulletin.email_group.each do |egroup|
|
||||
|
||||
if @email_group_data.include?(egroup) and (egroup == '0' or egroup == '1' or egroup == '2' or egroup == '3')
|
||||
|
||||
@group_mail << @email_group_data[egroup]["email"]
|
||||
|
||||
elsif @email_group_data.include?(egroup) and egroup == '4'
|
||||
|
||||
@group_mail << bulletin.other_mailaddress
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if !@group_mail.join.blank?
|
||||
|
||||
@mail_content = {
|
||||
"host" => @host,
|
||||
"site_title" => @site.title,
|
||||
"title" => bulletin.title,
|
||||
"template" => 'announcement_mailer/cron_mail',
|
||||
"url" => "http://#{@host}#{panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id)}"
|
||||
}
|
||||
|
||||
@mail_cron = {
|
||||
:mail_from_app => 'announcement',
|
||||
:mail_from => @user.email,
|
||||
:mail_reply_to => @user.email,
|
||||
:mail_subject => "#{t("announcement.mail_subject",:site_title => @site.title)}:#{bulletin.title}",
|
||||
:mail_to => @group_mail.join(','),
|
||||
:mail_content => @mail_content ,
|
||||
:mail_sentdate => bulletin.email_sentdate,
|
||||
:create_user_id => bulletin.create_user_id,
|
||||
:update_user_id => bulletin.create_user_id
|
||||
}
|
||||
|
||||
@mail_cron = MailCron.new(@mail_cron)
|
||||
|
||||
@mail_cron.save
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def email_group_data
|
||||
|
||||
@email_group_data = Bulletin.email_group_data
|
||||
|
||||
end
|
||||
|
||||
# def get_categorys(id = nil)
|
||||
# @bulletin_categorys = []
|
||||
|
|
|
@ -153,7 +153,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||
respond_to do |format|
|
||||
if @bulletin.save
|
||||
|
||||
if @bulletin.email_sent == true && @bulletin.is_checked == true
|
||||
if @bulletin.email_sent == true && @bulletin.is_checked == true && !@bulletin.is_rejected
|
||||
send_email_data(@bulletin)
|
||||
|
||||
@bulletin.email_sent = false
|
||||
|
@ -241,7 +241,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||
@bulletin.de_pending!
|
||||
end
|
||||
|
||||
if @bulletin.email_sent == true && @bulletin.is_checked == true
|
||||
if @bulletin.email_sent == true && @bulletin.is_checked == true && !@bulletin.is_rejected
|
||||
send_email_data(@bulletin)
|
||||
|
||||
@bulletin.email_sent = false
|
||||
|
|
|
@ -287,7 +287,7 @@
|
|||
<ul class="nav nav-pills">
|
||||
<% @email_group_data.collect do |k,v| %>
|
||||
<li class="pull-left">
|
||||
<%= check_box_tag 'bulletin[email_group][]', k, @bulletin.email_group.include?(k), :id => "field-#{k}" %>
|
||||
<%= check_box_tag 'bulletin[email_group][]', k, (@bulletin.email_group.nil? ? false : @bulletin.email_group.include?(k)), :id => "field-#{k}" %>
|
||||
<label for="field-<%= k %>"><%= v["name"] %></label>
|
||||
<%= hidden_field_tag 'bulletin[email_group][]', '' %>
|
||||
</li>
|
||||
|
|
Loading…
Reference in New Issue