inital commit
This commit is contained in:
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 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.
|
||||||
26
assets/javascripts/application.js
Normal file
26
assets/javascripts/application.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
$(function() {
|
||||||
|
|
||||||
|
const firstElement = document.getElementsByClassName('int_cf cf_4 attribute')[0].children[1];
|
||||||
|
console.log(firstElement);
|
||||||
|
if (firstElement) { // Check if the element exists
|
||||||
|
firstElement.addEventListener('click', function() {
|
||||||
|
console.log('The first element was clicked!');
|
||||||
|
try {
|
||||||
|
const text = firstElement.innerText;
|
||||||
|
console.log(text);
|
||||||
|
navigator.clipboard.writeText(text);
|
||||||
|
|
||||||
|
firstElement.innerHTML = "<b>Copied!</b>";
|
||||||
|
firstElement.style.color = "#4CAF50"; // Turn green
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
firstElement.innerText = text;
|
||||||
|
firstElement.style.color = "";
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Unable to copy', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
29
init.rb
Normal file
29
init.rb
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#The MIT License (MIT)
|
||||||
|
#
|
||||||
|
#Copyright (c) 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.
|
||||||
|
|
||||||
|
Redmine::Plugin.register :redmine_mileage_cp do
|
||||||
|
|
||||||
|
# About
|
||||||
|
name 'Redmine Mileage CP Plugin'
|
||||||
|
author 'Rick Barrette'
|
||||||
|
description 'A plugin for Redmine to load javascript to copy on click'
|
||||||
|
version '2026.2.0'
|
||||||
|
url 'https://github.com/rickbarrette'
|
||||||
|
author_url 'https://barrettefabrication.com'
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# Dynamically load all Hooks & Patches recursively
|
||||||
|
base_dir = File.join(File.dirname(__FILE__), 'lib')
|
||||||
|
|
||||||
|
# '**' looks inside subdirectories, '*.rb' matches Ruby files
|
||||||
|
Dir.glob(File.join(base_dir, '**', '*.rb')).sort.each do |file|
|
||||||
|
require file
|
||||||
|
end
|
||||||
25
lib/redmine_qbo/hooks/view_hook_listener.rb
Normal file
25
lib/redmine_qbo/hooks/view_hook_listener.rb
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#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 RedmineQbo
|
||||||
|
module Hooks
|
||||||
|
|
||||||
|
class ViewHookListener < Redmine::Hook::ViewListener
|
||||||
|
|
||||||
|
# Load the javascript to support the autocomplete forms
|
||||||
|
def view_layouts_base_html_head(context = {})
|
||||||
|
safe_join([
|
||||||
|
javascript_include_tag( 'application.js', plugin: :redmine_mileage_cp)
|
||||||
|
])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user