From 637cfa89b4be30d9bb46715480adcfd59c344c34 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 3 Feb 2026 22:52:34 -0500 Subject: [PATCH] Refactored view hooks --- app/views/qbo/_footer.html.erb | 3 +++ lib/hooks/header_footer_hook_listener.rb | 19 ------------------ lib/hooks/view_hook_listener.rb | 10 +++++++++- lib/hooks/view_layouts_hook_listener.rb | 25 ------------------------ 4 files changed, 12 insertions(+), 45 deletions(-) create mode 100644 app/views/qbo/_footer.html.erb delete mode 100644 lib/hooks/header_footer_hook_listener.rb delete mode 100644 lib/hooks/view_layouts_hook_listener.rb diff --git a/app/views/qbo/_footer.html.erb b/app/views/qbo/_footer.html.erb new file mode 100644 index 0000000..d70545b --- /dev/null +++ b/app/views/qbo/_footer.html.erb @@ -0,0 +1,3 @@ +"" \ No newline at end of file diff --git a/lib/hooks/header_footer_hook_listener.rb b/lib/hooks/header_footer_hook_listener.rb deleted file mode 100644 index 10d0853..0000000 --- a/lib/hooks/header_footer_hook_listener.rb +++ /dev/null @@ -1,19 +0,0 @@ -#The MIT License (MIT) -# -#Copyright (c) 2016 - 2026 rick barrette -# -#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -# -#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -# -#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -module Hooks - - class HeaderFooterHookListener < Redmine::Hook::ViewListener - def view_layouts_base_body_bottom(context = {}) - return "" - end - end - -end \ No newline at end of file diff --git a/lib/hooks/view_hook_listener.rb b/lib/hooks/view_hook_listener.rb index e204d9f..8adf95d 100644 --- a/lib/hooks/view_hook_listener.rb +++ b/lib/hooks/view_hook_listener.rb @@ -12,8 +12,16 @@ module Hooks class ViewHookListener < Redmine::Hook::ViewListener + # Load the javascript to support the autocomplete forms + def view_layouts_base_html_head(context = {}) + js = javascript_include_tag 'application.js', plugin: :redmine_qbo + js += javascript_include_tag 'autocomplete-rails.js', plugin: :redmine_qbo + js += javascript_include_tag 'checkbox_controller.js', plugin: :redmine_qbo + return js + end + render_on :view_layouts_base_sidebar, partial: "qbo/sidebar" - + render_on :view_layouts_base_body_bottom, partial: "qbo/footer" end end \ No newline at end of file diff --git a/lib/hooks/view_layouts_hook_listener.rb b/lib/hooks/view_layouts_hook_listener.rb deleted file mode 100644 index 68f54bb..0000000 --- a/lib/hooks/view_layouts_hook_listener.rb +++ /dev/null @@ -1,25 +0,0 @@ -#The MIT License (MIT) -# -#Copyright (c) 2016 - 2026 rick barrette -# -#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -# -#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -# -#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -module Hooks - - class ViewLayoutsHookListener < Redmine::Hook::ViewListener - - # Load the javascript to support the autocomplete forms - def view_layouts_base_html_head(context = {}) - js = javascript_include_tag 'application.js', plugin: :redmine_qbo - js += javascript_include_tag 'autocomplete-rails.js', plugin: :redmine_qbo - js += javascript_include_tag 'checkbox_controller.js', plugin: :redmine_qbo - return js - end - - end - -end \ No newline at end of file