From a308171f318c9c3829c6c72207170741d953e450 Mon Sep 17 00:00:00 2001 From: spen Date: Fri, 7 Mar 2014 15:15:52 +0800 Subject: [PATCH] added email cron and email log --- app/assets/javascripts/member-selection.js | 10 +- app/assets/stylesheets/basic/global.css | 19 ++ app/assets/stylesheets/member_select.css | 237 ++++++++++++++++++ .../admin/mail_cron_logs_controller.rb | 43 ++++ .../admin/mail_crons_controller.rb | 130 ++++++++++ .../admin/member_selects_controller.rb | 30 +++ app/controllers/admin/sites_controller.rb | 12 + app/jobs/email_cron.rb | 42 ++++ app/mailer/mail_cron_mailer.rb | 86 +++++++ app/models/mail_cron.rb | 94 +++++++ app/models/mail_cron_file.rb | 13 + app/models/mail_cron_log.rb | 14 ++ .../mail_cron_logs/_clear_filters.html.erb | 3 + .../admin/mail_cron_logs/_filter.html.erb | 11 + .../mail_cron_logs/_mail_cron_log.html.erb | 29 +++ .../mail_cron_logs/_sort_headers.html.erb | 6 + app/views/admin/mail_cron_logs/delete.js.erb | 5 + app/views/admin/mail_cron_logs/destroy.js.erb | 1 + app/views/admin/mail_cron_logs/index.html.erb | 28 +++ app/views/admin/mail_cron_logs/index.js.erb | 4 + .../admin/mail_crons/_clear_filters.html.erb | 3 + app/views/admin/mail_crons/_filter.html.erb | 11 + app/views/admin/mail_crons/_form.html.erb | 122 +++++++++ .../admin/mail_crons/_form_file.html.erb | 35 +++ .../admin/mail_crons/_mail_cron.html.erb | 26 ++ .../admin/mail_crons/_sort_headers.html.erb | 5 + app/views/admin/mail_crons/delete.js.erb | 5 + app/views/admin/mail_crons/destroy.js.erb | 1 + app/views/admin/mail_crons/edit.html.erb | 9 + app/views/admin/mail_crons/index.html.erb | 27 ++ app/views/admin/mail_crons/index.js.erb | 4 + app/views/admin/mail_crons/new.html.erb | 12 + .../_email_selection_box.html.erb | 15 ++ .../admin/member_selects/_email_user.html.erb | 5 + .../member_selects/_modal_select.html.erb | 2 + .../_modal_select_email.html.erb | 80 ++++++ .../member_selects/_selection_box.html.erb | 15 ++ app/views/admin/member_selects/_user.html.erb | 4 +- .../select_email_members.js.erb | 2 + .../update_selected_email_users.js.erb | 2 + app/views/admin/sites/_mail_cron.html.erb | 21 ++ app/views/admin/sites/_mail_cron_log.html.erb | 20 ++ app/views/admin/sites/_user_action.html.erb | 6 + app/views/admin/sites/preference.html.erb | 12 + app/views/admin/sites/system_info.html.erb | 68 ++++- app/views/admin/sites/system_info.js.erb | 8 + app/views/front/show_banner.html.erb | 2 +- app/views/layouts/_left_menu.html.erb | 6 +- app/views/layouts/_right_menu.html.erb | 4 +- config/locales/en.yml | 2 + config/locales/zh_tw.yml | 2 + config/resque_schedule.yml | 8 +- config/routes.rb | 16 ++ 53 files changed, 1359 insertions(+), 18 deletions(-) create mode 100644 app/assets/stylesheets/member_select.css create mode 100644 app/controllers/admin/mail_cron_logs_controller.rb create mode 100644 app/controllers/admin/mail_crons_controller.rb create mode 100644 app/jobs/email_cron.rb create mode 100644 app/mailer/mail_cron_mailer.rb create mode 100644 app/models/mail_cron.rb create mode 100644 app/models/mail_cron_file.rb create mode 100644 app/models/mail_cron_log.rb create mode 100644 app/views/admin/mail_cron_logs/_clear_filters.html.erb create mode 100644 app/views/admin/mail_cron_logs/_filter.html.erb create mode 100644 app/views/admin/mail_cron_logs/_mail_cron_log.html.erb create mode 100644 app/views/admin/mail_cron_logs/_sort_headers.html.erb create mode 100644 app/views/admin/mail_cron_logs/delete.js.erb create mode 100644 app/views/admin/mail_cron_logs/destroy.js.erb create mode 100644 app/views/admin/mail_cron_logs/index.html.erb create mode 100644 app/views/admin/mail_cron_logs/index.js.erb create mode 100644 app/views/admin/mail_crons/_clear_filters.html.erb create mode 100644 app/views/admin/mail_crons/_filter.html.erb create mode 100644 app/views/admin/mail_crons/_form.html.erb create mode 100644 app/views/admin/mail_crons/_form_file.html.erb create mode 100644 app/views/admin/mail_crons/_mail_cron.html.erb create mode 100644 app/views/admin/mail_crons/_sort_headers.html.erb create mode 100644 app/views/admin/mail_crons/delete.js.erb create mode 100644 app/views/admin/mail_crons/destroy.js.erb create mode 100644 app/views/admin/mail_crons/edit.html.erb create mode 100644 app/views/admin/mail_crons/index.html.erb create mode 100644 app/views/admin/mail_crons/index.js.erb create mode 100644 app/views/admin/mail_crons/new.html.erb create mode 100644 app/views/admin/member_selects/_email_selection_box.html.erb create mode 100644 app/views/admin/member_selects/_email_user.html.erb create mode 100644 app/views/admin/member_selects/_modal_select_email.html.erb create mode 100644 app/views/admin/member_selects/_selection_box.html.erb create mode 100644 app/views/admin/member_selects/select_email_members.js.erb create mode 100644 app/views/admin/member_selects/update_selected_email_users.js.erb create mode 100644 app/views/admin/sites/_mail_cron.html.erb create mode 100644 app/views/admin/sites/_mail_cron_log.html.erb create mode 100644 app/views/admin/sites/_user_action.html.erb create mode 100644 app/views/admin/sites/system_info.js.erb diff --git a/app/assets/javascripts/member-selection.js b/app/assets/javascripts/member-selection.js index 276b48b..700f8d5 100644 --- a/app/assets/javascripts/member-selection.js +++ b/app/assets/javascripts/member-selection.js @@ -1,7 +1,7 @@ $(document).ready(function() { $(".select_user_modal").on('click', function(){ var ids = []; - var users = $('.selected_user'); + var users = $(this).siblings('.selected_users').children('span.selected_user'); users.each(function(i) { ids.push(users.eq(i).attr('id')); }); @@ -10,16 +10,20 @@ $(document).ready(function() { type: 'GET', url: $(this).attr("rel"), dataType: 'script', - data: {ids: ids}, + data: {field: $(this).attr("field"), ids: ids}, success: function (msg) { $("#member-filter").modal('show'); }, error: function(){ - // TODO: i18n in javascript alert("ERROR"); } }); return false; }); + + $(document).on('click', ".remove_user", function(){ + $(this).parent().remove(); + }); + $("#remove_users").on('click', function(){ var ids = []; var users = $('.selected_user input[type="checkbox"]:checked'); diff --git a/app/assets/stylesheets/basic/global.css b/app/assets/stylesheets/basic/global.css index 1880808..4f92e52 100644 --- a/app/assets/stylesheets/basic/global.css +++ b/app/assets/stylesheets/basic/global.css @@ -549,11 +549,30 @@ legend { margin-left: -45%; } #show_preview .modal-body { + background-color: #fff; padding: 0; max-height: none; height: 100%; overflow: hidden; } +#show_preview .modal-body > div { + height: 100%; +} +#show_preview .modal-body .modal-left { + overflow: auto; + float: left; + width: 19.8%; + border-right: 1px solid #DFDFDF; +} +#show_preview .modal-body .modal-left > * { + padding: 1em; + margin: 0; + list-style: none; +} +#show_preview .modal-body .modal-right { + float: right; + width: 80%; +} #show_preview iframe { border: 0; outline: none; diff --git a/app/assets/stylesheets/member_select.css b/app/assets/stylesheets/member_select.css new file mode 100644 index 0000000..0d4e9df --- /dev/null +++ b/app/assets/stylesheets/member_select.css @@ -0,0 +1,237 @@ +/* Member Filter */ +#select_user #select_user_modal.modal { + width: 80%; + margin-left: -40%; +} +#select_user #select_user_modal .modal-body { + max-height: 425px; +} +#select_user #select_user_modal .modal-body form { + margin-bottom: 0px; +} +#select_user #select_user_modal .modal-body form fieldset { + min-height: 360px; +} +#select_user #select_user_modal .modal-body .radio.inline, +#select_user #select_user_modal .modal-body .checkbox.inline { + display: inline-block; + padding-top: 5px; + margin-bottom: 0; + vertical-align: middle; + min-width: 100px; + margin-left: 0; +} +#select_user #select_user_modal .modal-body .form-actions { + margin: 20px 0 0; + padding: 10px 0 0; + background-color: transparent; + text-align: right; +} +#select_user #select_user_modal .modal-body .tabs-left > .nano { + width: 160px; + min-height: 425px; + float: left; +} +#select_user #select_user_modal .modal-body .tabs-left > .nano .pane { + right: 6px; +} +#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs { + width: 140px; + float: left; + margin-bottom: 0; + margin-right: 0; + border-right: 1px solid #ddd; + border-bottom: none; +} +#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs > li { + float: none; +} +#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs > li > a { + min-width: 74px; + margin-right: 0; + margin-bottom: 3px; +} +#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs > li > a { + margin-right: -1px; + -webkit-border-radius: 4px 0 0 4px; + -moz-border-radius: 4px 0 0 4px; + border-radius: 4px 0 0 4px; +} +#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs > li > a:hover { + border-color: #eeeeee #dddddd #eeeeee #eeeeee; +} +#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs .active > a, +#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs .active > a:hover { + border-color: #ddd transparent #ddd #ddd; + *border-right-color: #ffffff; +} +#select_user #select_user_modal .member-filter-options { + float: left; + display: inline-block; + width: 175px; + min-height: 425px; + margin-right: 10px; + padding: 0 10px 0 0; +} +#select_user #select_user_modal .member-filter-options select { + width: 165px; +} +#select_user #select_user_modal .member-filter-options .btn { + display: block; +} +#select_user #select_user_modal .member-filter-result { + padding-left: 15px; + min-height: 360px; + width: auto; +} + + +/* Check Box Card */ +.checkbox-card { + margin: 0; +} +.checkbox-card li { + position: relative; + list-style: none; + color: #FFFFFF; + width: 180px; + height: 40px; + margin: 0 10px 10px 0; + float: left; + display: inline-block; + background-color: #cccccc; + overflow: hidden; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-transition: all .2s linear; + -moz-transition: all .2s linear; + -o-transition: all .2s linear; + transition: all .2s linear; +} +.checkbox-card li.mark { + width: 0; + height: 0; + padding: 0; + margin: 0; + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: alpha(opacity=0); + opacity: 0; + visibility: hidden; +} +.checkbox-card li:hover { + background-color: #0088cc; +} +.checkbox-card li:after { + content: ""; + display: block; + clear: both; + height: 0; + visibility: hidden; +} +.checkbox-card li.active:before { + -webkit-text-size-adjust : none; + font-family: FontAwesome; + font-weight: normal; + font-style: normal; + color: #FFF; + text-decoration: inherit; + content: "\f00c"; + position: absolute; + right: 0px; + top: 0px; + line-height: 14px; + text-indent: 10px; + font-size: 10px; + width: 0px; + height: 0px; + border-style: solid; + border-width: 0 22px 22px 0; + border-color: transparent #51a351 transparent transparent; +} +.checkbox-card li.active label { +} +.checkbox-card li label { + margin-bottom: 0px; + overflow: hidden; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +.checkbox-card li input { + opacity: 0; + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + margin: 0; + z-index: 10; +} +.checkbox-card li label span { + -webkit-text-size-adjust : none; + font-size: 10px; + display: block; + width: 130px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + color: #666666; + margin-top: -3px; +} +.checkbox-card li:hover label span, +.checkbox-card li:hover label span.user-name { + color: #FFFFFF; +} +.checkbox-card li label span.user-name { + font-size: 12px; + color: #363636; + padding: 2px 0 0; + margin-top: 0; +} +.checkbox-card li .user-pic { + float: left; + margin-right: 5px; + width: 40px; + height: 40px; +} +#selected_users .selected_user { + display: inline-block; + margin-bottom: 5px; +} +#selected_users .selected_user .remove_user { + font-size: 15px; +} +#selected_email_users .selected_user { + display: inline-block; + margin-bottom: 5px; +} +#selected_email_users .selected_user .remove_user { + font-size: 15px; +} +/* +.promoter { + border-color: #CCCCCC; + border-style: solid; + border-width: 0 1px; + padding: 0 10px 5px 10px; +} +.promoter > div { + border-bottom: 1px solid #CCCCCC; +} +.promoter > div:after { + content: ""; + clear: both; + display: block; + visibility: hidden; +} +.promoter > div > span { + display: block; + margin-left: 70px; + padding-bottom: 5px; +} +.promoter p { + width: 70px; + float: left; + text-align:right; +}*/ \ No newline at end of file diff --git a/app/controllers/admin/mail_cron_logs_controller.rb b/app/controllers/admin/mail_cron_logs_controller.rb new file mode 100644 index 0000000..7909427 --- /dev/null +++ b/app/controllers/admin/mail_cron_logs_controller.rb @@ -0,0 +1,43 @@ +class Admin::MailCronLogsController < OrbitBackendController + + # layout "new_admin" + before_filter :authenticate_user! + before_filter :is_admin? + + def index + + # @mail_cron_logs = MailCronLog.all.desc(:created_at).page(params[:page_main] ).per('20') + @mail_cron_logs = (params[:sort]) ? get_sorted_and_filtered("mail_cron_log") : get_viewable("mail_cron_log") + + respond_to do |format| + format.html # index.html.erb + format.xml { render :xml => @mail_crons } + format.js + end + + end + + def destroy + @mail_cron_log = MailCronLog.find(params[:id]) + @mail_cron_log.destroy + + respond_to do |format| + # format.html { redirect_to(admin_mail_cron_logs_url) } + # format.xml { head :ok } + format.js { render :layout => false } + end + end + + def delete + if params[:ids] + # @mail_cron_logs = MailCronLog.any_in(:_id => params[:ids]).destroy_all + @mail_cron_logs = MailCronLog.any_in(:_id => params[:ids]) + end + + respond_to do |format| + format.js { render :layout => false } + end + # redirect_to admin_mail_cron_logs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) + end + +end diff --git a/app/controllers/admin/mail_crons_controller.rb b/app/controllers/admin/mail_crons_controller.rb new file mode 100644 index 0000000..d0ff698 --- /dev/null +++ b/app/controllers/admin/mail_crons_controller.rb @@ -0,0 +1,130 @@ +class Admin::MailCronsController < OrbitBackendController + + # layout "new_admin" + before_filter :authenticate_user! + before_filter :is_admin? + + def index + + # @mail_crons = MailCron.all.asc(:mail_sentdate).page(params[:page_main] ).per('20') + @mail_crons = (params[:sort]) ? get_sorted_and_filtered("mail_cron") : get_viewable("mail_cron") + + respond_to do |format| + format.html # index.html.erb + format.xml { render :xml => @mail_crons } + format.js + end + + end + + def show + end + + def new + @mail_cron = MailCron.new + + respond_to do |format| + format.html # new.html.erb + format.xml { render :xml => @mail_cron } + end + end + + def create + @mail_cron = MailCron.new(params[:mail_cron]) + + @mail_cron.create_user_id = current_user.id + @mail_cron.update_user_id = current_user.id + + respond_to do |format| + if @mail_cron.save + format.html { redirect_to(admin_mail_crons_url) } + format.xml { render :xml => @mail_cron, :status => :created, :location => @mail_cron } + else + format.html { render :action => "new" } + format.xml { render :xml => @mail_cron.errors, :status => :unprocessable_entity } + end + end + end + + def edit + @mail_cron = MailCron.find(params[:id]) + end + + def update + + + + @datas = MailCron.where(:mail_sentdate.lte => Time.now, :mail_sent => false) + + @datas.each do |mail_data| + + @mail_j = 0 + @read_mails = Array.new + + @mails = mail_data.mail_to.split(",") + + @mails.each do |send_mail| + + @read_mails << send_mail + + @mail_j += 1 + + if 0 == @mail_j % 30 + MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver + @read_mails = Array.new + + sleep 10 + end + + end + + if !@read_mails.join(',').blank? + MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver + @read_mails = Array.new + + sleep 10 + end + + end + + @mail_cron = MailCron.find(params[:id]) + + @mail_cron.update_user_id = current_user.id + + respond_to do |format| + if @mail_cron.update_attributes(params[:mail_cron]) + format.html { redirect_to(admin_mail_crons_url) } + format.js { render 'toggle_enable' } + format.xml { head :ok } + else + format.html { render :action => "edit" } + format.xml { render :xml => @mail_cron.errors, :status => :unprocessable_entity } + end + end + end + + def destroy + @mail_cron = MailCron.find(params[:id]) + @mail_cron.destroy + + respond_to do |format| + # format.html { redirect_to(admin_mail_crons_url) } + # format.xml { head :ok } + format.js { render :layout => false } + end + end + + def delete + if params[:ids] + # mail_crons = MailCron.any_in(:_id => params[:ids]).destroy_all + @mail_crons = MailCron.any_in(:_id => params[:ids]) + end + respond_to do |format| + format.js { render :layout => false } + end + # redirect_to admin_mail_crons_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) + end + + protected + +end diff --git a/app/controllers/admin/member_selects_controller.rb b/app/controllers/admin/member_selects_controller.rb index 64c8b72..e612b5b 100644 --- a/app/controllers/admin/member_selects_controller.rb +++ b/app/controllers/admin/member_selects_controller.rb @@ -1,4 +1,6 @@ class Admin::MemberSelectsController < OrbitBackendController + + open_for_visitor :only => [:select_members, :set_roles, :set_users, :select_email_members, :set_email_roles, :set_email_users] def index @@ -96,4 +98,32 @@ class Admin::MemberSelectsController < OrbitBackendController render 'admin/member_selects/update_selected_users' end + def select_email_members + selected_users = User.find(params[:ids]) rescue [] + @field = params[:field] + roles = Role.all + @sorted_users = roles.inject({}) do |users, role| + # users[role] = role.users.where(:email.not => /guest|rulingcom/) - selected_users + users[role] = role.users.where(:email.not => /guest/) - selected_users + users + end + end + + def set_email_roles + roles = Role.find(params[:email_role_ids]) rescue [] + @field = params[:field] + @users = roles.inject([]) do |users, role| + # users += role.users.where(:email.not => /guest|rulingcom/).entries + users += role.users.where(:email.not => /guest/).entries + users + end + render 'admin/member_selects/update_selected_email_users' + end + + def set_email_users + @users = User.find(params[:email_user_ids]) rescue [] + @field = params[:field] + render 'admin/member_selects/update_selected_email_users' + end + end diff --git a/app/controllers/admin/sites_controller.rb b/app/controllers/admin/sites_controller.rb index 5e355b0..503769f 100644 --- a/app/controllers/admin/sites_controller.rb +++ b/app/controllers/admin/sites_controller.rb @@ -76,6 +76,18 @@ class Admin::SitesController < OrbitBackendController @nginx_version = %x[/opt/nginx/sbin/nginx -v 2>&1].gsub("\n","
").html_safe @mongo_version = `mongod --version`.split("\n")[0].html_safe @linux_version = `lsb_release -d`.split(":")[1].html_safe + + @user_actions = UserAction.all.desc(:created_at).page(params[:page]).per(100) + + @mail_crons = MailCron.desc(:created_at) + + @mail_cron_logs = MailCronLog.desc(:created_at).page(params[:page]).per(100) + + respond_to do |format| + format.html # index.html.erb + format.js + end + end def search_engine diff --git a/app/jobs/email_cron.rb b/app/jobs/email_cron.rb new file mode 100644 index 0000000..51dec11 --- /dev/null +++ b/app/jobs/email_cron.rb @@ -0,0 +1,42 @@ +class EmailCron + @queue = :mail + + def self.perform + + @datas = MailCron.where(:mail_sentdate.lte => Time.now) + + @datas.each do |mail_data| + + @mail_j = 0 + @read_mails = Array.new + + @mails = mail_data.mail_to.split(",") + + @mails.each do |send_mail| + + @read_mails << send_mail + + @mail_j += 1 + + if 0 == @mail_j % 30 + MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver + @read_mails = Array.new + + sleep 10 + end + + end + + if !@read_mails.join(',').blank? + MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver + @read_mails = Array.new + + sleep 10 + end + + end + + end + + +end \ No newline at end of file diff --git a/app/mailer/mail_cron_mailer.rb b/app/mailer/mail_cron_mailer.rb new file mode 100644 index 0000000..3de6e63 --- /dev/null +++ b/app/mailer/mail_cron_mailer.rb @@ -0,0 +1,86 @@ +# encoding: utf-8 + +class MailCronMailer < ActionMailer::Base + default :from => "orbit_test@rulingcom.com" + + def get_settings + + @site = Site.first + + @smtp_settings = { + :address => @site['site_settings']['address'], + :port => @site['site_settings']['port'], + :domain => @site['site_settings']['domain'], + :authentication => @site['site_settings']['authentication'], + :enable_starttls_auto => @site['site_settings']['enable_starttls_auto'] + } + + if !@site['site_settings']['user_name'].blank? + @smtp_settings[:user_name] = @site['site_settings']['user_name'] + end + + if !@site['site_settings']['password'].blank? + @smtp_settings[:password] = @site['site_settings']['password'] + end + + + ActionMailer::Base.smtp_settings = @smtp_settings + + end + + + def cron_mail( data_id, group_mail ) + + get_settings + + @data = MailCron.find(data_id) + + if @data + + I18n.locale = @data.mail_content["lang"] if !@data.mail_content["lang"].blank? + + @mail_from = !@data.mail_from.blank? ? @data.mail_from : @site['site_settings']['service_email'] + + @mail_reply_to = !@data.mail_reply_to.blank? ? @data.mail_reply_to : @site['site_settings']['reply_email'] + + @user = User.find(@data.create_user_id) + + if !@data.mail_cron_files.blank? + @data.mail_cron_files.each_with_index do |mail_cron_file, i| + file_type = File.extname(mail_cron_file.file.to_s) + file_content = Mongo::GridFileSystem.new(Mongoid.database).open(mail_cron_file.file.url.gsub("/gridfs/", "").force_encoding("UTF-8"), 'r') + attachments["#{mail_cron_file.title}#{file_type}"] = file_content.read + end + end + + if !@data.mail_content["text"].blank? + mail( :from => "\"#{@site.title}\" <#{@mail_from}>", :reply_to => @mail_reply_to, :bcc => group_mail, :subject => @data.mail_subject ) do |format| + format.html { render :text => @data.mail_content["text"] } + end + elsif !@data.mail_content["template"].blank? + mail( :from => "\"#{@site.title}\" <#{@mail_from}>", :reply_to => @mail_reply_to, :bcc => group_mail, :subject => @data.mail_subject ) do |format| + format.html { render :template => @data.mail_content["template"], :collection => @data.mail_content } + end + end + + + @mail_cron_log = { + :mail_subject => @data.mail_subject, + :mail_to => group_mail, + :mail_user => "#{@user.name} <#{@user.email}>", + :mailer_count => group_mail.split(",").size, + :mail_from_app => @data.mail_from_app + } + + @mail_cron_log = MailCronLog.new(@mail_cron_log) + + + @mail_cron_log.save + + @data.destroy + + end + + end + +end \ No newline at end of file diff --git a/app/models/mail_cron.rb b/app/models/mail_cron.rb new file mode 100644 index 0000000..d68bca4 --- /dev/null +++ b/app/models/mail_cron.rb @@ -0,0 +1,94 @@ +class MailCron + + include Mongoid::Document + include Mongoid::Timestamps + + + field :mail_from_app + field :mail_from + field :mail_to + field :mail_reply_to + field :mail_subject + field :mail_content, :type => Hash + field :mail_sentdate , :type => DateTime + + field :create_user_id + field :update_user_id + + has_many :mail_cron_files, :autosave => true, :dependent => :destroy + + accepts_nested_attributes_for :mail_cron_files, :allow_destroy => true + + after_save :save_mail_cron_files + + + def save_mail_cron_files + self.mail_cron_files.each do |t| + if t.should_destroy + t.destroy + end + end + end + + def self.get_send_group_mail(send_mails, other_send_mails = '') + + @group_mail = Array.new + + send_mails.each do |email_user_id| + + if !email_user_id.blank? + + @user = User.find(email_user_id) + + @group_mail << @user.email if !@user.blank? + + end + + end if !send_mails.blank? + + other_send_mails.split(",").collect do |oa| + @group_mail << oa + end if !other_send_mails.blank? + + @group_mail.uniq + + end + + def self.send_mail_now(mail_cron_id) + + mail_data = MailCron.find(mail_cron_id) + + if !mail_data.blank? + + @mail_j = 0 + @read_mails = Array.new + + @mails = mail_data.mail_to.split(",") + + @mails.each do |send_mail| + + @read_mails << send_mail + + @mail_j += 1 + + if 0 == @mail_j % 30 + MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver + @read_mails = Array.new + + sleep 10 + end + + end + + if !@read_mails.join(',').blank? + MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver + @read_mails = Array.new + + sleep 10 + end + + end + + end + +end \ No newline at end of file diff --git a/app/models/mail_cron_file.rb b/app/models/mail_cron_file.rb new file mode 100644 index 0000000..ceaa2d0 --- /dev/null +++ b/app/models/mail_cron_file.rb @@ -0,0 +1,13 @@ +class MailCronFile + + include Mongoid::Document + include Mongoid::Timestamps + + mount_uploader :file, AssetUploader + + field :should_destroy, :type => Boolean + field :title + + belongs_to :mail_cron + +end diff --git a/app/models/mail_cron_log.rb b/app/models/mail_cron_log.rb new file mode 100644 index 0000000..8aed7e2 --- /dev/null +++ b/app/models/mail_cron_log.rb @@ -0,0 +1,14 @@ +class MailCronLog + + include Mongoid::Document + include Mongoid::Timestamps + + + field :mail_subject + field :mail_to + field :mail_user + field :mailer_count + field :mail_from_app + + +end \ No newline at end of file diff --git a/app/views/admin/mail_cron_logs/_clear_filters.html.erb b/app/views/admin/mail_cron_logs/_clear_filters.html.erb new file mode 100644 index 0000000..3b9cc61 --- /dev/null +++ b/app/views/admin/mail_cron_logs/_clear_filters.html.erb @@ -0,0 +1,3 @@ +
+ <%= link_to content_tag(:i, nil, :class => 'icons-cycle') + t(:clear), admin_mail_crons_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn btn-small js_history" %> +
\ No newline at end of file diff --git a/app/views/admin/mail_cron_logs/_filter.html.erb b/app/views/admin/mail_cron_logs/_filter.html.erb new file mode 100644 index 0000000..63882b8 --- /dev/null +++ b/app/views/admin/mail_cron_logs/_filter.html.erb @@ -0,0 +1,11 @@ + + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "sort_header" %> +<% end %> \ No newline at end of file diff --git a/app/views/admin/mail_cron_logs/_mail_cron_log.html.erb b/app/views/admin/mail_cron_logs/_mail_cron_log.html.erb new file mode 100644 index 0000000..35c59b3 --- /dev/null +++ b/app/views/admin/mail_cron_logs/_mail_cron_log.html.erb @@ -0,0 +1,29 @@ + + + <% if is_manager? %> + <%= check_box_tag 'to_delete[]', mail_cron_log.id, false, :class => "checkbox_in_list" %> + <% end -%> + + + <%= mail_cron_log.mail_subject %> +
+ +
+ + + <%= mail_cron_log.mail_to.gsub(/,/, "
").html_safe %> + + + <%= mail_cron_log.mail_user %> + + + <%= mail_cron_log.mail_from_app %> + + + <%= display_date_time(mail_cron_log.created_at) %> + + \ No newline at end of file diff --git a/app/views/admin/mail_cron_logs/_sort_headers.html.erb b/app/views/admin/mail_cron_logs/_sort_headers.html.erb new file mode 100644 index 0000000..e8a7d33 --- /dev/null +++ b/app/views/admin/mail_cron_logs/_sort_headers.html.erb @@ -0,0 +1,6 @@ +<%= render_sort_bar(true, delete_admin_mail_cron_logs_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]), + ['subject', 'mail_subject','span2', :subject] , + ['mail_to', 'mail_to','span2', :mail_to] , + ['mail_user', 'mail_user','span2', :mail_user] , + ['mail_from_app', 'mail_from_app','span2', :mail_from_app] , + ['sentdate', 'created_at','span2', :sentdate] ).html_safe %> \ No newline at end of file diff --git a/app/views/admin/mail_cron_logs/delete.js.erb b/app/views/admin/mail_cron_logs/delete.js.erb new file mode 100644 index 0000000..1aefe25 --- /dev/null +++ b/app/views/admin/mail_cron_logs/delete.js.erb @@ -0,0 +1,5 @@ +<% @mail_cron_logs.collect do |mail_cron_log| %> +$("#<%= dom_id mail_cron_log %>").remove(); +<% end %> + +<% MailCronLog.any_in(:_id => params[:ids]).destroy_all %> \ No newline at end of file diff --git a/app/views/admin/mail_cron_logs/destroy.js.erb b/app/views/admin/mail_cron_logs/destroy.js.erb new file mode 100644 index 0000000..9e65f17 --- /dev/null +++ b/app/views/admin/mail_cron_logs/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @mail_cron_log %>").remove(); \ No newline at end of file diff --git a/app/views/admin/mail_cron_logs/index.html.erb b/app/views/admin/mail_cron_logs/index.html.erb new file mode 100644 index 0000000..07d13f2 --- /dev/null +++ b/app/views/admin/mail_cron_logs/index.html.erb @@ -0,0 +1,28 @@ +<% content_for :side_bar do %> + <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %> +<% end %> + + <%= render 'filter' %> + + + + + + + + + + + + + <%= render :partial => "mail_cron_log",:collection=> @mail_cron_logs%> + +
+ + +
+ +
+ \ No newline at end of file diff --git a/app/views/admin/mail_cron_logs/index.js.erb b/app/views/admin/mail_cron_logs/index.js.erb new file mode 100644 index 0000000..504d3ab --- /dev/null +++ b/app/views/admin/mail_cron_logs/index.js.erb @@ -0,0 +1,4 @@ +$("#delete_all").attr("action", "<%= delete_admin_mail_cron_logs_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]) %>"); +$("#sort_headers").html("<%= j render 'sort_headers' %>"); +$("#tbody_mail_cron_logs").html("<%= j render :partial => 'mail_cron_log', :collection => @mail_cron_logs %>"); +$("#mail_cron_log_pagination").html("<%= j paginate @mail_cron_logs, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>"); \ No newline at end of file diff --git a/app/views/admin/mail_crons/_clear_filters.html.erb b/app/views/admin/mail_crons/_clear_filters.html.erb new file mode 100644 index 0000000..3b9cc61 --- /dev/null +++ b/app/views/admin/mail_crons/_clear_filters.html.erb @@ -0,0 +1,3 @@ +
+ <%= link_to content_tag(:i, nil, :class => 'icons-cycle') + t(:clear), admin_mail_crons_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn btn-small js_history" %> +
\ No newline at end of file diff --git a/app/views/admin/mail_crons/_filter.html.erb b/app/views/admin/mail_crons/_filter.html.erb new file mode 100644 index 0000000..63882b8 --- /dev/null +++ b/app/views/admin/mail_crons/_filter.html.erb @@ -0,0 +1,11 @@ + + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "sort_header" %> +<% end %> \ No newline at end of file diff --git a/app/views/admin/mail_crons/_form.html.erb b/app/views/admin/mail_crons/_form.html.erb new file mode 100644 index 0000000..40d7bde --- /dev/null +++ b/app/views/admin/mail_crons/_form.html.erb @@ -0,0 +1,122 @@ +
+<% # encoding: utf-8 %> + + <%= f.error_messages %> + + + +
+ +
+

<%= t(:date_) %>

+
+
+ <%= f.datetime_picker :mail_sentdate, :picker_type => 'separated', :label => t(:start) %> +
+
+
+ +
+ + + + + +
+
+ + <%= f.label :mail_subject ,t(:mail_subject)%> + <%= f.text_field :mail_subject %> + + <%= f.label :mail_from ,t(:mail_from)%> + <%= f.text_field :mail_from %> + + <%= f.label :mail_reply_to ,t(:mail_reply_to)%> + <%= f.text_field :mail_reply_to %> + + <%= f.label :mail_to ,t(:mail_to)%> + <%= f.text_field :mail_to %> + + <%= f.label :mail_content ,t(:mail_content)%> + <%= f.text_area :mail_content, :class=>"span12", :cols=>"25", :rows=>"10" %> + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + + <% @mail_cron.mail_cron_files.each_with_index do |mail_cron_file, i| %> + <%= f.fields_for :mail_cron_files, mail_cron_file do |f| %> + <%= render :partial => 'form_file', :object => mail_cron_file, :locals => {:f => f, :i => i} %> + <% end %> + <% end %> + +
FileFile Name
+
+ <%= hidden_field_tag 'plugin_file_field_count', @mail_cron.mail_cron_files.count %> + ADD/新增 +
+
+ +
+ +
+ + + +
+ + +
+ <%= f.submit t('submit'), :class=>'btn btn-primary' %> + <%= link_to t('cancel'), get_go_back, :class=>"btn" %> +
+ + + + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "archive_plugin_form" %> + +<% end %> + + +
\ No newline at end of file diff --git a/app/views/admin/mail_crons/_form_file.html.erb b/app/views/admin/mail_crons/_form_file.html.erb new file mode 100644 index 0000000..e7fe526 --- /dev/null +++ b/app/views/admin/mail_crons/_form_file.html.erb @@ -0,0 +1,35 @@ +<% # encoding: utf-8 %> + + " class='list_item'> + +
+
+ <%= f.file_field :file %> + <%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %> +
+
+ + + +
+ + <%= f.text_field :title %> + +
+ + + + + + <% if form_file.new_record? %> + + <% else %> + <%= f.hidden_field :id %> + + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> + <% end %> + + + + + diff --git a/app/views/admin/mail_crons/_mail_cron.html.erb b/app/views/admin/mail_crons/_mail_cron.html.erb new file mode 100644 index 0000000..be7cf80 --- /dev/null +++ b/app/views/admin/mail_crons/_mail_cron.html.erb @@ -0,0 +1,26 @@ + + + <% if is_manager? %> + <%= check_box_tag 'to_delete[]', mail_cron.id, false, :class => "checkbox_in_list" %> + <% end -%> + + + <%= mail_cron.mail_subject %> +
+ +
+ + + <%= mail_cron.mail_to.gsub(/,/, "
").html_safe %> + + + <%= mail_cron.mail_from_app %> + + + <%= display_date_time(mail_cron.mail_sentdate) %> + + \ No newline at end of file diff --git a/app/views/admin/mail_crons/_sort_headers.html.erb b/app/views/admin/mail_crons/_sort_headers.html.erb new file mode 100644 index 0000000..2d1e6ca --- /dev/null +++ b/app/views/admin/mail_crons/_sort_headers.html.erb @@ -0,0 +1,5 @@ +<%= render_sort_bar(true, delete_admin_mail_crons_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]), + ['subject', 'mail_subject','span2', :mail_subject] , + ['mail_to', 'mail_to','span2', :mail_to] , + ['mail_from_app', 'mail_from_app','span2', :mail_from_app] , + ['sentdate', 'mail_sentdate','span2', :mail_sentdate] ).html_safe %> \ No newline at end of file diff --git a/app/views/admin/mail_crons/delete.js.erb b/app/views/admin/mail_crons/delete.js.erb new file mode 100644 index 0000000..1869e51 --- /dev/null +++ b/app/views/admin/mail_crons/delete.js.erb @@ -0,0 +1,5 @@ +<% @mail_crons.collect do |mail_cron| %> +$("#<%= dom_id mail_cron %>").remove(); +<% end %> + +<% MailCron.any_in(:_id => params[:ids]).destroy_all %> \ No newline at end of file diff --git a/app/views/admin/mail_crons/destroy.js.erb b/app/views/admin/mail_crons/destroy.js.erb new file mode 100644 index 0000000..7c22134 --- /dev/null +++ b/app/views/admin/mail_crons/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @mail_cron %>").remove(); \ No newline at end of file diff --git a/app/views/admin/mail_crons/edit.html.erb b/app/views/admin/mail_crons/edit.html.erb new file mode 100644 index 0000000..e3d8b2d --- /dev/null +++ b/app/views/admin/mail_crons/edit.html.erb @@ -0,0 +1,9 @@ +<% content_for :side_bar do %> + <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %> +<% end %> + +

<%= t('mail_cron.editing_mail_cron') %>

+ +<%= form_for @mail_cron, :url => admin_mail_cron_path(@mail_cron), :html => {:class => 'clear'} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> diff --git a/app/views/admin/mail_crons/index.html.erb b/app/views/admin/mail_crons/index.html.erb new file mode 100644 index 0000000..04bd455 --- /dev/null +++ b/app/views/admin/mail_crons/index.html.erb @@ -0,0 +1,27 @@ +<% content_for :side_bar do %> + <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %> +<% end %> + + <%= render 'filter' %> + + + + + + + + + + + + <%= render :partial => "mail_cron",:collection=> @mail_crons%> + +
+ + +
+ +
+ \ No newline at end of file diff --git a/app/views/admin/mail_crons/index.js.erb b/app/views/admin/mail_crons/index.js.erb new file mode 100644 index 0000000..7a90902 --- /dev/null +++ b/app/views/admin/mail_crons/index.js.erb @@ -0,0 +1,4 @@ +$("#delete_all").attr("action", "<%= delete_admin_mail_crons_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]) %>"); +$("#sort_headers").html("<%= j render 'sort_headers' %>"); +$("#tbody_mail_crons").html("<%= j render :partial => 'mail_cron', :collection => @mail_crons %>"); +$("#mail_cron_pagination").html("<%= j paginate @mail_crons, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>"); \ No newline at end of file diff --git a/app/views/admin/mail_crons/new.html.erb b/app/views/admin/mail_crons/new.html.erb new file mode 100644 index 0000000..06d3c78 --- /dev/null +++ b/app/views/admin/mail_crons/new.html.erb @@ -0,0 +1,12 @@ + +<% content_for :side_bar do %> + <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %> +<% end %> + +
+

<%= t('mail_cron.new_mail_cron') %>

+<%= form_for @mail_cron, :url => admin_mail_crons_path, :html => {:class => 'clear'} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> +
+ diff --git a/app/views/admin/member_selects/_email_selection_box.html.erb b/app/views/admin/member_selects/_email_selection_box.html.erb new file mode 100644 index 0000000..8be70a6 --- /dev/null +++ b/app/views/admin/member_selects/_email_selection_box.html.erb @@ -0,0 +1,15 @@ +<% content_for :page_specific_javascript do -%> + <%= javascript_include_tag "lib/jquery.nanoscroller" %> + <%= javascript_include_tag "lib/checkbox.card" %> +<% end -%> +<% content_for :page_specific_css do -%> + <%= stylesheet_link_tag "member_select" %> +<% end %> + +
+
+ <%= render partial: 'admin/member_selects/email_user', collection: users, locals: {field: field} %> + <%= hidden_field_tag field %> +
+ <%= link_to t(:add), '#', class: 'btn btn-primary btn-small select_user_modal', rel: select_email_members_admin_member_selects_path, field: field %> +
\ No newline at end of file diff --git a/app/views/admin/member_selects/_email_user.html.erb b/app/views/admin/member_selects/_email_user.html.erb new file mode 100644 index 0000000..5c91bbb --- /dev/null +++ b/app/views/admin/member_selects/_email_user.html.erb @@ -0,0 +1,5 @@ + + <%= content_tag :span, '×', class: 'close remove_user' %> + <%= email_user.name %> + <%= hidden_field_tag field, email_user.id %> + \ No newline at end of file diff --git a/app/views/admin/member_selects/_modal_select.html.erb b/app/views/admin/member_selects/_modal_select.html.erb index becc199..e8d14e7 100644 --- a/app/views/admin/member_selects/_modal_select.html.erb +++ b/app/views/admin/member_selects/_modal_select.html.erb @@ -28,6 +28,7 @@
<%= submit_tag t(:submit), class: "btn btn-primary" %> + <%= hidden_field_tag field, @field %>
<% end %> @@ -53,6 +54,7 @@
<%= submit_tag t(:submit), class: "btn btn-primary" %> + <%= hidden_field_tag field, @field %>
<% end %> diff --git a/app/views/admin/member_selects/_modal_select_email.html.erb b/app/views/admin/member_selects/_modal_select_email.html.erb new file mode 100644 index 0000000..c02502b --- /dev/null +++ b/app/views/admin/member_selects/_modal_select_email.html.erb @@ -0,0 +1,80 @@ + + + + \ No newline at end of file diff --git a/app/views/admin/member_selects/_selection_box.html.erb b/app/views/admin/member_selects/_selection_box.html.erb new file mode 100644 index 0000000..428cc04 --- /dev/null +++ b/app/views/admin/member_selects/_selection_box.html.erb @@ -0,0 +1,15 @@ +<% content_for :page_specific_javascript do -%> + <%= javascript_include_tag "lib/jquery.nanoscroller" %> + <%= javascript_include_tag "lib/checkbox.card" %> +<% end -%> +<% content_for :page_specific_css do -%> + <%= stylesheet_link_tag "member_select" %> +<% end %> + +
+
+ <%= render partial: 'admin/member_selects/user', collection: users, locals: {field: field} %> + <%= hidden_field_tag field %> +
+ <%= link_to t(:add), '#', class: 'btn btn-primary btn-small select_user_modal', rel: select_members_admin_member_selects_path, field: field %> +
\ No newline at end of file diff --git a/app/views/admin/member_selects/_user.html.erb b/app/views/admin/member_selects/_user.html.erb index 827c5c7..2b10998 100644 --- a/app/views/admin/member_selects/_user.html.erb +++ b/app/views/admin/member_selects/_user.html.erb @@ -1,5 +1,5 @@ - + + <%= content_tag :span, '×', class: 'close remove_user' %> <%= user.name %> <%= hidden_field_tag field, user.id %> - <%= content_tag :span, '×', class: 'close remove_user' %> \ No newline at end of file diff --git a/app/views/admin/member_selects/select_email_members.js.erb b/app/views/admin/member_selects/select_email_members.js.erb new file mode 100644 index 0000000..907b471 --- /dev/null +++ b/app/views/admin/member_selects/select_email_members.js.erb @@ -0,0 +1,2 @@ +$("#select_user").html("<%= j render partial: 'admin/member_selects/modal_select_email', locals: {role_form_url: set_email_roles_admin_member_selects_path(field: @field), user_form_url: set_email_users_admin_member_selects_path(field: @field)} %>"); +$("#member-filter").modal(); \ No newline at end of file diff --git a/app/views/admin/member_selects/update_selected_email_users.js.erb b/app/views/admin/member_selects/update_selected_email_users.js.erb new file mode 100644 index 0000000..fc92c21 --- /dev/null +++ b/app/views/admin/member_selects/update_selected_email_users.js.erb @@ -0,0 +1,2 @@ +$("#selected_email_users").append("<%= j render partial: 'email_user', collection: @users, locals: {field: @field} %>"); +$("#member-filter").modal('hide'); \ No newline at end of file diff --git a/app/views/admin/sites/_mail_cron.html.erb b/app/views/admin/sites/_mail_cron.html.erb new file mode 100644 index 0000000..fb38b01 --- /dev/null +++ b/app/views/admin/sites/_mail_cron.html.erb @@ -0,0 +1,21 @@ + + + + <% if is_manager? %> + <%= check_box_tag 'to_delete[]', mail_cron.id, false, :class => "list-check" %> + <% end -%> + + <%= display_date_time(mail_cron.mail_sentdate) %> + <%= mail_cron.mail_subject %> +
+ +
+ +

<%= mail_cron.mail_to.gsub(/,/, ", ").html_safe %>

+ <%= mail_cron.mail_from_app %> + \ No newline at end of file diff --git a/app/views/admin/sites/_mail_cron_log.html.erb b/app/views/admin/sites/_mail_cron_log.html.erb new file mode 100644 index 0000000..47571e0 --- /dev/null +++ b/app/views/admin/sites/_mail_cron_log.html.erb @@ -0,0 +1,20 @@ + + + + <% if is_manager? %> + <%= check_box_tag 'to_delete[]', mail_cron_log.id, false, :class => "list-check" %> + <% end -%> + + <%= display_date_time(mail_cron_log.created_at) %> + <%= mail_cron_log.mail_subject %> +
+ +
+ +

<%= mail_cron_log.mail_to.gsub(/,/, ", ").html_safe %>

+ <%= mail_cron_log.mail_user %> + <%= mail_cron_log.mail_from_app %> + \ No newline at end of file diff --git a/app/views/admin/sites/_user_action.html.erb b/app/views/admin/sites/_user_action.html.erb new file mode 100644 index 0000000..7cd27a4 --- /dev/null +++ b/app/views/admin/sites/_user_action.html.erb @@ -0,0 +1,6 @@ + + + <%= user_action.created_at %> + <%= user_action.user.name %> + <%= user_action.page %> + \ No newline at end of file diff --git a/app/views/admin/sites/preference.html.erb b/app/views/admin/sites/preference.html.erb index 8407bcd..80e7219 100644 --- a/app/views/admin/sites/preference.html.erb +++ b/app/views/admin/sites/preference.html.erb @@ -56,6 +56,18 @@
+
+ +
+ <%= f.text_field :service_email, :value => (@site['site_settings']['service_email'] rescue nil), :class=>"input-large", :placeholder=>"Administrator Mail" %> +
+
+
+ +
+ <%= f.text_field :reply_email, :value => (@site['site_settings']['reply_email'] rescue nil), :class=>"input-large", :placeholder=>"Reply Mail" %> +
+
diff --git a/app/views/admin/sites/system_info.html.erb b/app/views/admin/sites/system_info.html.erb index 7dce7b3..0376bb0 100644 --- a/app/views/admin/sites/system_info.html.erb +++ b/app/views/admin/sites/system_info.html.erb @@ -18,6 +18,7 @@ @@ -52,6 +53,23 @@
+ +
+

<%= t("user_actions") %>

+ + + + + + + <%= render :partial => "user_action", :collection=> @user_actions%> +
<%= I18n.t 'user_action.time' %><%= I18n.t 'user_action.name' %><%= I18n.t 'user_action.page' %>
+ + +
+
\ No newline at end of file +
+ + + diff --git a/app/views/admin/sites/system_info.js.erb b/app/views/admin/sites/system_info.js.erb new file mode 100644 index 0000000..6e7a88c --- /dev/null +++ b/app/views/admin/sites/system_info.js.erb @@ -0,0 +1,8 @@ +$("<%= j(render :partial => 'user_action', :collection => @user_actions) %>").appendTo($("#user_actions")); +$(".user-paginate").html("<%= j(paginate @user_actions, :remote => true) %>"); + +$("<%= j(render :partial => 'mail_cron_log', :collection => @mail_cron_logs) %>").appendTo($("#mail_cron_logs")); +$(".paginate").html("<%= j(paginate @mail_cron_logs, :remote => true) %>"); + +checkScroll(); +$('.list-check').listCheck(); \ No newline at end of file diff --git a/app/views/front/show_banner.html.erb b/app/views/front/show_banner.html.erb index 37cb4e9..c425d17 100644 --- a/app/views/front/show_banner.html.erb +++ b/app/views/front/show_banner.html.erb @@ -2,7 +2,7 @@
<% @ad_banner.ad_images.can_display.each do |ad_image| %> <% link = ad_image_link(ad_image) %> - <%= image_tag ad_image.file, width: @ad_banner.width, height: @ad_banner.height, link_open: ad_image.link_open, link_url: link, style: "display:none; #{'cursor:pointer;' if link.present?}" %> + <%= image_tag ad_image.file, alt: ad_image.title, title: ad_image.title, width: @ad_banner.width, height: @ad_banner.height, link_open: ad_image.link_open, link_url: link, style: "display:none; #{'cursor:pointer;' if link.present?}" %> <% end %>
diff --git a/app/views/layouts/_left_menu.html.erb b/app/views/layouts/_left_menu.html.erb index 6e61844..dea704c 100644 --- a/app/views/layouts/_left_menu.html.erb +++ b/app/views/layouts/_left_menu.html.erb @@ -2,7 +2,7 @@