Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Move watcher helper inside the module

Henriette Dargea7c0b0accef0
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb
index 91264afaac7..ea26b5d966d 100644
--- a/app/helpers/watchers_helper.rb
+++ b/app/helpers/watchers_helper.rb
@@ -51,30 +51,30 @@ module WatchersHelper
link_to(content_tag(:i, "", class: watched ? "button--icon icon-watched" : " button--icon icon-unwatched") + " " +
content_tag(:span, label, class: "button--text"), path, html_options.merge(method:))
end
-end
-def watcher_button_arguments(object, user)
- return nil unless user&.logged? && object.respond_to?(:watched_by?)
+ def watcher_button_arguments(object, user)
+ return nil unless user&.logged? && object.respond_to?(:watched_by?)
- watched = object.watched_by?(user)
+ watched = object.watched_by?(user)
- path = send(:"#{(watched ? 'unwatch' : 'watch')}_path",
- object_type: object.class.to_s.underscore.pluralize,
- object_id: object.id)
+ path = send(:"#{(watched ? 'unwatch' : 'watch')}_path",
+ object_type: object.class.to_s.underscore.pluralize,
+ object_id: object.id)
- method = watched ? :delete : :post
+ method = watched ? :delete : :post
- label = watched ? I18n.t(:button_unwatch) : I18n.t(:button_watch)
+ label = watched ? I18n.t(:button_unwatch) : I18n.t(:button_watch)
- {
- tag: :a,
- href: path,
- scheme: :default,
- aria: { label: label },
- data: {
- method:
- },
- mobile_icon: watched ? "eye-closed" : "eye",
- mobile_label: label
- }
+ {
+ tag: :a,
+ href: path,
+ scheme: :default,
+ aria: { label: label },
+ data: {
+ method:
+ },
+ mobile_icon: watched ? "eye-closed" : "eye",
+ mobile_label: label
+ }
+ end
end