" class="answer-form">
<%= render(partial: '/answers/new_edit', locals: { template: phase.template, question: question, answer: answer, readonly: readonly, locking: false, base_template_org: base_template_org }) %>
" class="mt-10">
diff --git a/app/views/phases/edit.html.erb b/app/views/phases/edit.html.erb
index 046de4a..f6decf0 100644
--- a/app/views/phases/edit.html.erb
+++ b/app/views/phases/edit.html.erb
@@ -1,8 +1,7 @@
-<%# locals: { plan, phase, readonly, question_guidance } %>
<% title "#{plan.title} - Write plan" %>
-
<%= plan.title %>
+ <%= plan.title %>
diff --git a/app/views/user_mailer/permissions_change_notification.html.erb b/app/views/user_mailer/permissions_change_notification.html.erb
index d9553fe..db036b4 100644
--- a/app/views/user_mailer/permissions_change_notification.html.erb
+++ b/app/views/user_mailer/permissions_change_notification.html.erb
@@ -4,14 +4,18 @@
plan_title = @role.plan.title
access = nil
access_level = @role.access_level()
- access_level_messages = Role.access_level_messages
%>
<% FastGettext.with_locale FastGettext.default_locale do %>
<%= _('Hello %{username}') %{ :username => username } %>
- <%= _('Your permissions relating to %{plan_title} have changed. You now have %{type} access. This means you can %{placeholder1} %{placeholder2}') %{ :plan_title => plan_title, :type => access_level_messages[access_level][:type], :placeholder1 => access_level_messages[access_level][:placeholder1], :placeholder2 => access_level_messages[access_level][:placeholder2] } %>
+ <%= _('Your permissions relating to %{plan_title} have changed. You now have %{type} access. This means you can %{placeholder1} %{placeholder2}') % {
+ plan_title: plan_title,
+ type: Role::ACCESS_LEVEL_MESSAGES[access_level][:type],
+ placeholder1: Role::ACCESS_LEVEL_MESSAGES[access_level][:placeholder1],
+ placeholder2: Role::ACCESS_LEVEL_MESSAGES[access_level][:placeholder2]
+ } %>
<%= render partial: 'email_signature' %>
<% end %>
diff --git a/app/views/user_mailer/plan_visibility.html.erb b/app/views/user_mailer/plan_visibility.html.erb
index 7c63eb1..8d0ac01 100644
--- a/app/views/user_mailer/plan_visibility.html.erb
+++ b/app/views/user_mailer/plan_visibility.html.erb
@@ -2,7 +2,7 @@
tool_name = Rails.configuration.branding[:application][:name]
username = @user.name
plan_title = @plan.title
- plan_visibility = Plan.visibility_message(@plan.visibility.to_sym)
+ plan_visibility = Plan::VISIBILITY_MESSAGE[@plan.visibility.to_sym]
%>
<% FastGettext.with_locale FastGettext.default_locale do %>
diff --git a/lib/cleanup.rb b/lib/cleanup.rb
new file mode 100644
index 0000000..5b71994
--- /dev/null
+++ b/lib/cleanup.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+# Private: Utility module providing tools to clean up the codebase over time.
+module Cleanup
+end
diff --git a/lib/cleanup/deprecators.rb b/lib/cleanup/deprecators.rb
new file mode 100644
index 0000000..fd59e57
--- /dev/null
+++ b/lib/cleanup/deprecators.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+module Cleanup
+ # Private: Custom deprecator classes to use while we refactor the code for
+ # better readability.
+ module Deprecators
+ end
+end
diff --git a/lib/cleanup/deprecators/get_deprecator.rb b/lib/cleanup/deprecators/get_deprecator.rb
new file mode 100644
index 0000000..cde5b4a
--- /dev/null
+++ b/lib/cleanup/deprecators/get_deprecator.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+module Cleanup
+ module Deprecators
+
+ # Used to deprecate methods with non-idiomatic getter names.
+ #
+ # There are methods in the code with non-idiomatic method names. Typically,
+ # Ruby getters are named as nouns for the attribute they are returning.
+ # Prefer User#status over User#get_status.
+ #
+ class GetDeprecator
+
+ ##
+ # Default message to display to developer when deprecated method called.
+ MESSAGE = "%s is deprecated. "\
+ "Instead, you should use: %s. "\
+ "Read #{__FILE__} for more information."
+
+ # Message printed to STDOUT when a deprecated method is called.
+ def deprecation_warning(deprecated_method, _message, _backtrace = nil)
+ new_method = deprecated_method.to_s.gsub(/^get\_/, '')
+ message = format(MESSAGE,
+ deprecated_method: deprecated_method,
+ new_method: new_method)
+ Kernel.warn(message)
+ end
+
+ end
+ end
+end
diff --git a/lib/cleanup/deprecators/predicate_deprecator.rb b/lib/cleanup/deprecators/predicate_deprecator.rb
new file mode 100644
index 0000000..19ca2a5
--- /dev/null
+++ b/lib/cleanup/deprecators/predicate_deprecator.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+module Cleanup
+ module Deprecators
+
+ # Used to deprecate methods that are predicate methods without question mks
+ #
+ # There are methods in the code with non-idiomatic method names. Typically,
+ # Ruby predicates are named as verbs in the infinitive with a question mark.
+ #
+ class PredicateDeprecator
+
+ ##
+ # Default message to display to developer when deprecated method called.
+ MESSAGE = "%s is deprecated. "\
+ "Instead, you should use: %s. "\
+ "Read #{__FILE__} for more information."
+
+ # Message printed to STDOUT when a deprecated method is called.
+ def deprecation_warning(deprecated_method, _message, _backtrace = nil)
+ new_method = "#{deprecated_method.to_s}?"
+ message = format(MESSAGE,
+ deprecated_method: deprecated_method,
+ new_method: new_method)
+ Kernel.warn(message)
+ end
+
+ end
+ end
+end
diff --git a/lib/cleanup/deprecators/set_deprecator.rb b/lib/cleanup/deprecators/set_deprecator.rb
new file mode 100644
index 0000000..cd5a4aa
--- /dev/null
+++ b/lib/cleanup/deprecators/set_deprecator.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+module Cleanup
+ module Deprecators
+
+ # Used to deprecate methods with non-idiomatic setter names.
+ #
+ # There are methods in the code with non-idiomatic method names. Typically,
+ # Ruby getters are named as nouns for the attribute they are returning.
+ # Prefer User#status= over User#set_status.
+ #
+ class SetDeprecator
+
+ ##
+ # Default message to display to developer when deprecated method called.
+ MESSAGE = "%s is deprecated. "\
+ "Instead, you should use: %s. "\
+ "Read #{__FILE__} for more information."
+
+ # Message printed to STDOUT when a deprecated method is called.
+ def deprecation_warning(deprecated_method, _message, _backtrace = nil)
+ new_method = deprecated_method.to_s.gsub(/^set\_/, '').gsub(/\Z/, '=')
+ message = format(MESSAGE,
+ deprecated_method: deprecated_method,
+ new_method: new_method)
+ Kernel.warn(message)
+ end
+
+ end
+ end
+end