@@ -171,24 +171,56 @@ export function moveLycheeHelp() {
171171 * フィードバック用リンクの追加
172172 */
173173export function addFeedbackLink ( ) {
174+ // フィードバック先に渡すためのプラグイン一覧を定義
175+ const PLUGINS = [
176+ 'dashboard' ,
177+ 'kanban' ,
178+ 'backlog' ,
179+ 'lychee_gantt' ,
180+ 'project_evms' ,
181+ 'root_fever_charts' ,
182+ 'fever_charts' ,
183+ 'lychee_cost_expenses' ,
184+ 'project_report' ,
185+ 'project_reports' ,
186+ 'resource_management' ,
187+ 'lychee_work_plan' ,
188+ 'time_management' ,
189+ 'lychee_message_box_my_box' ,
190+ 'lychee_message_box_information' ,
191+ 'lychee_message_box_system_error' ,
192+ ]
193+
194+ // ベースとなるURL
195+ const BASE_URL = 'https://community.lychee-redmine.jp/projects/lychee-redmine/issues/new'
196+
174197 const topMenuNav = document . querySelector ( '#top-menu #account ul' )
198+
199+ // フィードバックリンクの要素を生成
175200 const li = document . createElement ( 'li' )
176201 const a = document . createElement ( 'a' )
177202 li . classList . add ( 'aw_fbLink_li' )
178203 a . classList . add ( 'aw_fbLink' )
179- a . setAttribute ( 'href' , 'https://support.lychee-redmine.jp/feedback/' )
204+
205+ // URLのパスにPLUGINSの値が含まれているかチェック(どのプラグインからかを特定する)
206+ const path = location . pathname
207+ const currentPlugin = PLUGINS . find ( plugin => path . includes ( plugin ) )
208+
209+ // プラグイン名が判明している場合は、クエリパラメータとしてセット
210+ const url = new URL ( BASE_URL )
211+ url . searchParams . set ( 'from' , 'feedback' )
212+ url . searchParams . set ( 'plugin' , currentPlugin === undefined ? 'other' : currentPlugin )
213+ a . setAttribute ( 'href' , url . toString ( ) )
214+
215+ // aタグに情報をセット
180216 a . setAttribute ( 'target' , '_blank' )
181217 a . textContent = t ( 'sendFeedback' )
182218
183219 // ちらつき防止のため、ちらつきが発生するスタイルはあらかじめjsで指定
184- li . style . cssText = `
185- order: 4;
186- `
187-
188- a . style . cssText = `
189- padding-left: 1.75rem;
190- `
220+ li . style . cssText = `order: 4;`
221+ a . style . cssText = `padding-left: 1.75rem;`
191222
223+ // フィードバックリンクの追加
192224 li . appendChild ( a )
193225 topMenuNav . insertBefore ( li , topMenuNav . firstElementChild )
194226}
0 commit comments