diff --git a/.rubocop.yml b/.rubocop.yml index d53c4f660..a44b298cb 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -469,6 +469,9 @@ Style/MethodDefParentheses: Style/MutableConstant: Enabled: true +Style/NegatedIfElseCondition: + Enabled: true + Style/Not: Enabled: true diff --git a/app/models/document.rb b/app/models/document.rb index e6e21b526..da9bbfd08 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -50,18 +50,18 @@ class Document < ApplicationRecord end def prefix(attachment, _style) - if !attachment.instance.persisted? - "cached_attachments/user/#{attachment.instance.user_id}" - else + if attachment.instance.persisted? ":attachment/:id_partition" + else + "cached_attachments/user/#{attachment.instance.user_id}" end end def custom_hash_data(attachment) - original_filename = if !attachment.instance.persisted? - attachment.instance.attachment_file_name - else + original_filename = if attachment.instance.persisted? attachment.instance.title + else + attachment.instance.attachment_file_name end "#{attachment.instance.user_id}/#{original_filename}" end diff --git a/app/models/image.rb b/app/models/image.rb index 7bcac83f1..961307b23 100644 --- a/app/models/image.rb +++ b/app/models/image.rb @@ -52,10 +52,10 @@ class Image < ApplicationRecord end def prefix(attachment, _style) - if !attachment.instance.persisted? - "cached_attachments/user/#{attachment.instance.user_id}" - else + if attachment.instance.persisted? ":attachment/:id_partition" + else + "cached_attachments/user/#{attachment.instance.user_id}" end end diff --git a/app/views/budgets/results/_results_table.html.erb b/app/views/budgets/results/_results_table.html.erb index 0a2dca5e3..696ea2280 100644 --- a/app/views/budgets/results/_results_table.html.erb +++ b/app/views/budgets/results/_results_table.html.erb @@ -1,5 +1,5 @@
" - style="<%= results_type != :compatible ? "display: none" : "" %>" + style="<%= results_type == :compatible ? "" : "display: none" %>" id="<%= results_type %>-container">

<%= title %>

diff --git a/lib/consul_form_builder.rb b/lib/consul_form_builder.rb index 27124ccf7..e9d59dcd2 100644 --- a/lib/consul_form_builder.rb +++ b/lib/consul_form_builder.rb @@ -20,12 +20,12 @@ class ConsulFormBuilder < FoundationRailsHelper::FormBuilder end def check_box(attribute, options = {}) - if options[:label] != false + if options[:label] == false + super + else label = tag.span sanitize(label_text(attribute, options[:label])), class: "checkbox" super(attribute, options.merge(label: label, label_options: label_options_for(options))) - else - super end end