Browse Source

Rubocop

pull/155/head
baarkerlounger 3 years ago
parent
commit
5e0cf43a30
  1. 16
      app/helpers/application_helper.rb
  2. 4
      app/models/bulk_upload.rb
  3. 2
      app/views/layouts/application.html.erb
  4. 2
      config/environments/production.rb
  5. 2
      config/environments/sandbox.rb
  6. 2
      config/initializers/active_admin.rb

16
app/helpers/application_helper.rb

@ -1,21 +1,9 @@
module ApplicationHelper
def browser_title(title)
if user_log_errors || case_log_errors || resource_errors
def browser_title(title, *resources)
if resources.any? { |r| r.present? && r.errors.present? }
"Error: #{[title, t('service_name'), 'GOV.UK'].select(&:present?).join(' - ')}"
else
[title, t("service_name"), "GOV.UK"].select(&:present?).join(" - ")
end
end
def user_log_errors
@user.present? && @user.errors.present?
end
def case_log_errors
@case_log.present? && @case_log.errors.present?
end
def resource_errors
@resource.present? && @resource.errors.present?
end
end

4
app/models/bulk_upload.rb

@ -27,8 +27,8 @@ class BulkUpload
data_range = FIRST_DATA_ROW..last_row
data_range.map do |row_num|
row = sheet.row(row_num)
owning_organisation = Organisation.find(row[111])
managing_organisation = Organisation.find(row[113])
# owning_organisation = Organisation.find(row[111])
# managing_organisation = Organisation.find(row[113])
case_log = CaseLog.create!(
owning_organisation: current_user.organisation,
managing_organisation: current_user.organisation,

2
app/views/layouts/application.html.erb

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en" class="govuk-template">
<head>
<title><%= browser_title(yield(:title)) %></title>
<title><%= browser_title(yield(:title), @user, @organisation, @case_log, @resource) %></title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= tag :meta, name: 'viewport', content: 'width=device-width, initial-scale=1' %>

2
config/environments/production.rb

@ -58,7 +58,7 @@ Rails.application.configure do
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { host: ENV['APP_HOST'], port: 3000 }
config.action_mailer.default_url_options = { host: ENV["APP_HOST"], port: 3000 }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",

2
config/environments/sandbox.rb

@ -58,7 +58,7 @@ Rails.application.configure do
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { host: ENV['APP_HOST'], port: 3000 }
config.action_mailer.default_url_options = { host: ENV["APP_HOST"], port: 3000 }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",

2
config/initializers/active_admin.rb

@ -338,5 +338,5 @@ end
# delete this when the next version bump is released but for now it prevents
# webpacker issues.
Rails.application.config.after_initialize do
ActiveAdmin.application.stylesheets.delete('active_admin/print.css')
ActiveAdmin.application.stylesheets.delete("active_admin/print.css")
end

Loading…
Cancel
Save