2026.3.0
This commit is contained in:
commit
fea86725ab
4 files changed
+115
No files matched your search
@@ -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.
|
||||
@@ -0,0 +1,40 @@
|
||||
$(function() {
|
||||
// Only run on issue show page
|
||||
const regex = /^\/issues\/\d+/;
|
||||
if (regex.test(window.location.pathname)) {
|
||||
|
||||
//search for the span element that contains the text "Mileage" and get its parent element's class name
|
||||
const allSpans = document.querySelectorAll('span');
|
||||
const wantedSpan = [...allSpans].find(el => el.textContent.includes('Mileage'));
|
||||
const element = wantedSpan.parentElement.parentElement.className;
|
||||
console.log(element);
|
||||
|
||||
// Get the first child element of the element with the class name and add a click event listener to it
|
||||
const firstElement = document.getElementsByClassName(element)[0].children[1];
|
||||
if (firstElement) {
|
||||
firstElement.addEventListener('click', function() {
|
||||
try {
|
||||
const text = firstElement.innerText;
|
||||
|
||||
// If the text is already "Copied!", don't do anything
|
||||
if (text == "Copied!") {
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -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.3.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
|
||||
@@ -0,0 +1,25 @@
|
||||
#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.
|
||||
|
||||
module RedmineMileageCp
|
||||
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