Find Mileage by its label precisely; inline script on issue pages

- Looks only in the issue's attributes for the field labelled exactly
  "Mileage" (any case): no settings and no field id needed, and menus,
  history, other plugins' text or fields like "Mileage Out" can't match;
  issues without the field no longer throw a JavaScript error
- Shows "Copied!" only when the copy succeeded ("Couldn't copy"
  otherwise), falls back when the Clipboard API isn't available, and
  restores the value's original HTML afterwards
- Pointer cursor, "Click to copy" tooltip, keyboard support (Enter/Space)
- The script is written into the issue page by the
  view_issues_show_details_bottom hook instead of being served as a
  compiled asset, so it only loads on issue pages and can't 404 when
  Redmine's asset manifest is stale; removes assets/javascripts and the
  leftover console.log
- init.rb: requires Redmine 6.1+, points to the Gitea repository

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-10-29 19:53:46 -04:00
1 parent fea86725ab
commit fa9010c063
4 files changed
+107 -49

No files matched your search

+4 -3
View File
@@ -13,11 +13,12 @@ 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'
description 'Click an issue\'s Mileage value to copy it to the clipboard'
version '2026.3.0'
url 'https://github.com/rickbarrette'
url 'https://gitea.rickbarrette.org/ricky/redmine_mileage_cp'
author_url 'https://barrettefabrication.com'
requires_redmine version_or_higher: '6.1.0'
end
# Dynamically load all Hooks & Patches recursively