Browse Source

Another attempt at fxing the mailer

development
Godwin 9 years ago
parent
commit
433afaffe6
  1. 22
      app/assets/stylesheets/_application.scss
  2. 12
      app/controllers/application_controller.rb
  3. 8
      app/controllers/conferences_controller.rb
  4. 9
      app/views/conferences/admin/_schedule.html.haml

22
app/assets/stylesheets/_application.scss

@ -1136,14 +1136,16 @@ ul.warnings li,
margin: 1em 0 0; margin: 1em 0 0;
padding: 0; padding: 0;
list-style: none; list-style: none;
border: 0.1em solid #EEE; // border: 0.1em solid #EEE;
background-color: #F8F8F8; // background-color: #F8F8F8;
a { a {
display: block; display: block;
padding: 0.5em 0.75em; padding: 0.5em 0.75em;
@include font-family(secondary); //@include font-family(secondary);
border-bottom: 0.1em solid #CCC; border: 0.1rem solid #EEE;
border-top: 0;
border-right: 0;
@include after { @include after {
display: none; display: none;
@ -1370,6 +1372,18 @@ ul.warnings li,
vertical-align: top; vertical-align: top;
} }
} }
.table-tr.new {
.table-th {
background-color: transparent;
border: 0;
}
.table-td {
background-color: transparent;
border: 0;
}
}
} }
#main { #main {

12
app/controllers/application_controller.rb

@ -130,7 +130,7 @@ class ApplicationController < LinguaFrancaApplicationController
logger.info exception.to_s logger.info exception.to_s
logger.info exception.backtrace.join("\n") logger.info exception.backtrace.join("\n")
UserMailer.error_report( UserMailer.delay.error_report(
"A JavaScript error has occurred", "A JavaScript error has occurred",
report, report,
params[:message], params[:message],
@ -138,7 +138,7 @@ class ApplicationController < LinguaFrancaApplicationController
request, request,
params, params,
current_user, current_user,
).deliver_now! if Rails.env.preview? || Rails.env.production? ) if Rails.env.preview? || Rails.env.production?
end end
render json: {} render json: {}
end end
@ -185,7 +185,7 @@ class ApplicationController < LinguaFrancaApplicationController
# send and email if this is production # send and email if this is production
suppress(Exception) do suppress(Exception) do
UserMailer.error_report( UserMailer.delay.error_report(
"An error has occurred in #{Rails.env}", "An error has occurred in #{Rails.env}",
nil, nil,
exception.to_s, exception.to_s,
@ -193,7 +193,7 @@ class ApplicationController < LinguaFrancaApplicationController
request, request,
params, params,
current_user, current_user,
).deliver_now! if Rails.env.preview? || Rails.env.production? ) if Rails.env.preview? || Rails.env.production?
end end
# raise the error if we are in development so that we can debug it # raise the error if we are in development so that we can debug it
@ -335,7 +335,7 @@ class ApplicationController < LinguaFrancaApplicationController
def i18n_exception(str, exception, locale, key) def i18n_exception(str, exception, locale, key)
# send and email if this is production # send and email if this is production
suppress(Exception) do suppress(Exception) do
UserMailer.error_report( UserMailer.delay.error_report(
"A missing translation found in #{Rails.env}", "A missing translation found in #{Rails.env}",
"<p>A translation for <code>#{key}</code> in <code>#{locale.to_s}</code> was found. The text that was rendered to the user was:</p><blockquote>#{str || 'nil'}</blockquote>", "<p>A translation for <code>#{key}</code> in <code>#{locale.to_s}</code> was found. The text that was rendered to the user was:</p><blockquote>#{str || 'nil'}</blockquote>",
exception.to_s, exception.to_s,
@ -343,7 +343,7 @@ class ApplicationController < LinguaFrancaApplicationController
request, request,
params, params,
current_user, current_user,
).deliver_now! if Rails.env.preview? || Rails.env.production? ) if Rails.env.preview? || Rails.env.production?
logger.info "Missing translation found for: #{key}" logger.info "Missing translation found for: #{key}"
end end
end end

8
app/controllers/conferences_controller.rb

@ -387,12 +387,12 @@ class ConferencesController < ApplicationController
@email_sent = :edit @email_sent = :edit
elsif params[:button] == 'test' elsif params[:button] == 'test'
@email_sent = :test @email_sent = :test
UserMailer.broadcast( UserMailer.delay.broadcast(
"#{request.protocol}#{request.host_with_port}", "#{request.protocol}#{request.host_with_port}",
@subject, @subject,
@content, @content,
current_user, current_user,
@this_conference).deliver_now! @this_conference)
elsif params[:button] == 'preview' elsif params[:button] == 'preview'
@email_sent = :preview @email_sent = :preview
elsif params[:button] == 'send' elsif params[:button] == 'send'
@ -1001,12 +1001,12 @@ class ConferencesController < ApplicationController
@broadcast_step = :preview @broadcast_step = :preview
elsif params[:button] == 'test' elsif params[:button] == 'test'
@broadcast_step = :test @broadcast_step = :test
UserMailer.broadcast( UserMailer.delay.broadcast(
"#{request.protocol}#{request.host_with_port}", "#{request.protocol}#{request.host_with_port}",
@subject, @subject,
@body, @body,
current_user, current_user,
@this_conference).deliver_now! @this_conference)
end end
return render 'conferences/register' return render 'conferences/register'
when 'locations' when 'locations'

9
app/views/conferences/admin/_schedule.html.haml

@ -1,17 +1,18 @@
.table.workshop-blocks .table.workshop-blocks
.table-tr .table-tr.header
.table-th=_'forms.labels.generic.block_number' .table-th=_'forms.labels.generic.block_number'
.table-th=_'forms.labels.generic.time' .table-th=_'forms.labels.generic.time'
.table-th=_'forms.labels.generic.length' .table-th=_'forms.labels.generic.length'
.table-th=_'forms.labels.generic.days' .table-th=_'forms.labels.generic.days'
.table-th.form .table-th.form
- @workshop_blocks.each_with_index do | info, block | - @workshop_blocks.each_with_index do | info, block |
= form_tag administration_update_path(@this_conference.slug, :schedule), class: 'table-tr' do - is_new = info['time'].blank?
.table-th.center.big=(block + 1) = form_tag administration_update_path(@this_conference.slug, :schedule), class: ['table-tr', is_new ? 'new' : 'saved'] do
.table-th.center.big= is_new ? '' : (block + 1)
.table-td=time_select info['time'], small: true, label: false .table-td=time_select info['time'], small: true, label: false
.table-td=length_select info['length'], {small: true, label: false}, 0.5, 2 .table-td=length_select info['length'], {small: true, label: false}, 0.5, 2
.table-td=checkboxes :days, @block_days, info['days'].map(&:to_i), 'date.day_names', vertical: true, small: true .table-td=checkboxes :days, @block_days, info['days'].map(&:to_i), 'date.day_names', vertical: true, small: true
.table-td.form .table-td.form
= hidden_field_tag :workshop_block, block = hidden_field_tag :workshop_block, block
= button_tag :delete_block, value: :delete_block, class: [:small, :delete] if block == @workshop_blocks.length - 2 = button_tag :delete_block, value: :delete_block, class: [:small, :delete] if block == @workshop_blocks.length - 2
= button_tag (info['time'].present? ? :update_block : :add_block), value: :save_block, class: [:small, :add] = button_tag (is_new ? :add_block : :update_block), value: :save_block, class: [:small, :add]

Loading…
Cancel
Save