Working on help items interface for other plugins

This commit is contained in:
Alexander Meindl 2018-09-14 16:25:07 +02:00
parent ec4770bf9d
commit 75bbeb1e26
8 changed files with 108 additions and 28 deletions

View File

@ -92,17 +92,55 @@ module AdditionalsMenuHelper
end
end
def addtionals_help_plugin_items
user_items = [{ title: 'Redmine Guide', url: Redmine::Info.help_url },
{ title: "Redmine #{l(:label_macro_plural)}", url: macros_path }]
admin_items = [{ title: 'Additionals', url: 'https://additionals.readthedocs.io/en/latest/manual/', manual: true },
{ title: 'Redmine Changelog', url: 'https://www.redmine.org/projects/redmine/wiki/Changelog_3_4' },
{ title: 'Redmine Upgrade', url: 'https://www.redmine.org/projects/redmine/wiki/RedmineUpgrade' },
{ title: 'Redmine Security Advisories', url: 'https://www.redmine.org/projects/redmine/wiki/Security_Advisories' }]
Redmine::Plugin.all.each do |plugin|
next if plugin.id == :additionals
begin
plugin_item = plugin.id.to_s.camelize.constantize.try(:additionals_help_items)
plugin_item = additionals_help_items_fallbacks(plugin.id) if plugin_item.nil?
unless plugin_item.nil?
plugin_item.each do |temp_item|
user_items << if !temp_item[:manual].nil? && temp_item[:manual]
{ title: "#{temp_item[:title]} #{l(:label_help_manual)}", url: temp_item[:url] }
else
{ title: temp_item[:title], url: temp_item[:url] }
end
end
end
rescue StandardError => e
raise e unless e.class.to_s == 'NameError'
end
next unless User.current.admin?
begin
plugin_item = plugin.id.to_s.camelize.constantize.try(:additionals_help_admin_items)
plugin_item = additionals_help_admin_items_fallbacks(plugin.id) if plugin_item.nil?
admin_items += plugin_item unless plugin_item.nil?
rescue StandardError => e
raise e unless e.class.to_s == 'NameError'
end
end
{ user: user_items, admin: admin_items }
end
def additionals_help_menu_items
pages = [{ title: 'Redmine Guide', url: Redmine::Info.help_url },
{ title: 'FontAwesome Icons', url: 'https://fontawesome.com/icons?d=gallery&m=free' },
{ title: 'Redmine macros', url: macros_path }]
plugin_items = addtionals_help_plugin_items
pages = plugin_items[:user].sort_by { |k| k[:title] }
if User.current.admin?
pages << { title: '-' }
pages << { title: 'Additionals manual', url: 'https://additionals.readthedocs.io/en/latest/manual/' }
pages << { title: 'Redmine Changelog', url: 'https://www.redmine.org/projects/redmine/wiki/Changelog_3_4' }
pages << { title: 'Redmine Upgrade', url: 'https://www.redmine.org/projects/redmine/wiki/RedmineUpgrade' }
pages << { title: 'Redmine Security Advisories', url: 'https://www.redmine.org/projects/redmine/wiki/Security_Advisories' }
pages += plugin_items[:admin].sort_by { |k| k[:title] }
end
s = []
@ -121,4 +159,32 @@ module AdditionalsMenuHelper
end
safe_join(s)
end
# Plugin help items definition for plugins,
# which do not have additionals_help_menu_items integration
def additionals_help_items_fallbacks(plugin_id)
plugins = { redmine_agile: [{ title: 'Redmine Agile',
url: 'https://www.redmineup.com/pages/help/agile' }],
redmine_wiki_lists: [{ title: 'Wiki Lists Marcos',
url: 'https://www.r-labs.org/projects/wiki_lists/wiki/Wiki_Lists_en' }],
redmine_wiki_extensions: [{ title: 'Wiki Extensions',
url: 'https://www.r-labs.org/projects/r-labs/wiki/Wiki_Extensions_en' }] }
plugins[plugin_id]
end
# Plugin help items definition for plugins,
# which do not have additionals_help_admin_menu_items integration
def additionals_help_admin_items_fallbacks(plugin_id)
plugins = { redmine_git_hosting: [{ title: 'Redmine Git Hosting',
url: 'http://redmine-git-hosting.io/get_started/' }],
redmine_contacts: [{ title: 'Redmine CRM',
url: 'https://www.redmineup.com/pages/help/crm' }],
redmine_contacts_helpdesk: [{ title: 'Redmine Helpdesk',
url: 'https://www.redmineup.com/pages/help/helpdesk' }],
redmine_ldap_sync: [{ title: 'Redmine LDAP',
url: 'https://www.redmine.org/projects/redmine/wiki/RedmineLDAP' },
{ title: 'Redmine LDAP Sync',
url: 'https://github.com/thorin/redmine_ldap_sync/blob/master/README.md' }] }
plugins[plugin_id]
end
end

View File

@ -20,9 +20,9 @@ de:
add_go_to_top_info: 'Bei langen Seiten ist es hilfreich, wenn ein Link zur Verfügung steht, mit dem man zum Seitenanfang springen kann.'
button_assign_to_me: Mir zuweisen
disabled_modules_info: "Module, die nicht zur Auswahl innerhalb der Projekte zur Verfügung stehen sollen. Sind in bestehenden Projekten schon diese Module aktiviert worden, werden die Einstellungen für diese Projekte erst nach erneuten Abspeichern der jeweiligen Projekteinstellungen aktiv."
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
error_issue_status_could_not_changed: Der Ticket-Status konnte nicht geändert werden
error_issues_could_not_be_assigned_to_me: Das Ticket konnte nicht mir zugeordnet werden
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
errors_invalid_icon_format: ist ein ungültiger Font-Awesome Code
errors_no_or_invalid_arguments: Kein oder ungültiger Parameter
errors_query_does_not_exist: Abfrage existiert nicht
@ -69,6 +69,7 @@ de:
label_global_wiki_sidebar: "Projektübergreifender Wiki-Sidebar Inhalt"
label_go_to_top: "Nach oben"
label_google_maps_embed_api: Google Maps Embed API Key
label_help_manual: Handbuch
label_hour: Stunde
label_icon_color: Symbolfarbe
label_invisible_captcha: SPAM Schutz bei Registrierung
@ -97,6 +98,9 @@ de:
label_query_edit: Abfrage bearbeiten
label_reddit_subject: Reddit Thema
label_reddit_user_account: Reddit Benutzer
label_macro_plural: Makros
label_redmine_org_issue: Redmine.org Ticket
label_redmine_org_wiki: Redmine.org Wikiseite
label_remove_help: "Entferne 'Hilfe' aus dem Topmenü"
label_remove_mypage: "Entferne 'Meine Seite' aus dem Topmenü"
label_remove_news: "Entferne 'Letzte News' von der Übersichtsseite"
@ -157,5 +161,3 @@ de:
wiki_pdf_header_info: Dieser Textblock wir auf der ersten Seite vor dem eigentlichen Inhalt der Wiki Seite in der PDF Ansicht angezeigt. Die Makros sind hier nur eingeschränkt einsetzbar.
wiki_pdf_remove_attachments_info: Wenn aktiv, werden die an der Wiki Seite angehängten Dateien nicht in der PDF Ansicht angezeigt.
wiki_pdf_remove_title_info: Wenn aktiv, wird der Wiki Titel nicht in der PDF Ansicht angezeigt.
label_redmine_org_issue: Redmine.org issue
label_redmine_org_wiki: Redmine.org wiki page

View File

@ -20,9 +20,9 @@ en:
add_go_to_top_info: 'If you have a lot of long pages, it is helpful to add a jump to top link.'
button_assign_to_me: Assign to me
disabled_modules_info: "Modules which should not be available for selection within the projects. If these modules already activated in existing projects, you will have to change and re-save the respective project settings first."
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
error_issue_status_could_not_changed: Issue state could not be changed
error_issues_could_not_be_assigned_to_me: Issue could not assigned to me
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
errors_invalid_icon_format: is an invalid font-awesome code
errors_no_or_invalid_arguments: No or invalid arguments
errors_query_does_not_exist: Query does not exist
@ -69,6 +69,7 @@ en:
label_global_wiki_sidebar: "Global wiki sidebar"
label_go_to_top: "Go to top"
label_google_maps_embed_api: Google Maps Embed API Key
label_help_manual: manual
label_hour: hour
label_icon_color: Icon color
label_invisible_captcha: SPAM protection for registration
@ -97,6 +98,9 @@ en:
label_query_edit: Edit query
label_reddit_subject: Reddit subject
label_reddit_user_account: Reddit user account
label_macro_plural: macros
label_redmine_org_issue: Redmine.org issue
label_redmine_org_wiki: Redmine.org wiki page
label_remove_help: "Remove 'Help' from top menu"
label_remove_mypage: "Remove 'My Page' from top menu"
label_remove_news: "Remove 'Lastest news' from overview page"
@ -157,5 +161,3 @@ en:
wiki_pdf_header_info: This text block will be displayed on the first page before the regular Wiki content in the PDF view. Macro use is very restricted, here.
wiki_pdf_remove_attachments_info: When active the attached Wiki files will not be displayed in PDF view.
wiki_pdf_remove_title_info: When active the Wiki title info will not be displayed in PDF view.
label_redmine_org_issue: Redmine.org issue
label_redmine_org_wiki: Redmine.org wiki page

View File

@ -20,9 +20,9 @@ fr:
add_go_to_top_info: "Si vous avez beaucoup de pages longues, il est utile d'ajouter un saut au lien du haut."
button_assign_to_me: Assign to me
disabled_modules_info: "Les modules qui ne devraient pas être disponibles pour la sélection dans le cadre des projets. Si ces modules sont déjà activés dans des projets existants, vous devez d'abord modifier et sauvegarder à nouveau les paramètres de projet respectifs."
error_query_statement_invalid: "Une erreur s'est produite lors de l'exécution de la requête et a été enregistrée. Veuillez signaler cette erreur à votre administrateur Redmine."
error_issue_status_could_not_changed: "L'état de la question n'a pas pu être modifié"
error_issues_could_not_be_assigned_to_me: "La question n'a pas pu m'être assignée"
error_query_statement_invalid: "Une erreur s'est produite lors de l'exécution de la requête et a été enregistrée. Veuillez signaler cette erreur à votre administrateur Redmine."
errors_invalid_icon_format: is an invalid font-awesome code
errors_no_or_invalid_arguments: "Pas d'arguments ou arguments invalides"
errors_query_does_not_exist: "Query n'existe pas"
@ -69,6 +69,7 @@ fr:
label_global_wiki_sidebar: "Global wiki sidebar"
label_go_to_top: "Go to top"
label_google_maps_embed_api: Google Maps Embed API Key
label_help_manual: manual
label_hour: Heure
label_icon_color: Icon color
label_invisible_captcha: SPAM protection for registration
@ -97,6 +98,9 @@ fr:
label_query_edit: Modifier query
label_reddit_subject: Reddit subject
label_reddit_user_account: Reddit user account
label_macro_plural: macros
label_redmine_org_issue: Redmine.org issue
label_redmine_org_wiki: Redmine.org wiki page
label_remove_help: "Remove 'Help' from top menu"
label_remove_mypage: "Remove 'My Page' from top menu"
label_remove_news: "Remove 'Lastest news' from overview page"
@ -157,5 +161,3 @@ fr:
wiki_pdf_header_info: "Ce bloc de texte sera affiché sur la première page avant le contenu Wiki normal dans la vue PDF. L'utilisation des macros est très restreinte, ici."
wiki_pdf_remove_attachments_info: "Lorsqu'ils sont actifs, les fichiers Wiki joints ne seront pas affichés en vue PDF."
wiki_pdf_remove_title_info: "Lorsqu'elle est active, l'information sur le titre du wiki ne sera pas affichée dans la vue PDF."
label_redmine_org_issue: Redmine.org issue
label_redmine_org_wiki: Redmine.org wiki page

View File

@ -20,9 +20,9 @@ it:
add_go_to_top_info: 'Se hai un sacco di pagine lunghe, è utile aggiungere un To top link principale.'
button_assign_to_me: Assign to me
disabled_modules_info: "Modules which should not be available for selection within the projects. If these modules already activated in existing projects, you will have to change and re-save the respective project settings first."
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
error_issue_status_could_not_changed: Issue state could not be changed
error_issues_could_not_be_assigned_to_me: Issue could not assigned to me
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
errors_invalid_icon_format: 'è un font-awesome codice non valido'
errors_no_or_invalid_arguments: No o non valido argomenti
errors_query_does_not_exist: Query non esiste
@ -69,6 +69,7 @@ it:
label_global_wiki_sidebar: "Global wiki sidebar"
label_go_to_top: "Vai in cima"
label_google_maps_embed_api: Google Maps Embed API Key
label_help_manual: manual
label_hour: ora
label_icon_color: Icon colore
label_invisible_captcha: Protezione SPAM per la pagina di registrazione
@ -97,6 +98,9 @@ it:
label_query_edit: Modifica query
label_reddit_subject: Reddit subject
label_reddit_user_account: Reddit user account
label_macro_plural: macros
label_redmine_org_issue: Redmine.org issue
label_redmine_org_wiki: Redmine.org wiki page
label_remove_help: "Remove 'Help' from top menu"
label_remove_mypage: "Remove 'My Page' from top menu"
label_remove_news: "Remove 'Lastest news' from overview page"
@ -157,5 +161,3 @@ it:
wiki_pdf_header_info: This text block will be displayed on the first page before the regular Wiki content in the PDF view. Macro use is very restricted, here.
wiki_pdf_remove_attachments_info: "Quando è attivo, il Wiki file allegati non verranno visualizzati nella vista PDF."
wiki_pdf_remove_title_info: "Quando è attivo, le informazioni sul titolo del Wiki non verranno visualizzate nella vista PDF."
label_redmine_org_issue: Redmine.org issue
label_redmine_org_wiki: Redmine.org wiki page

View File

@ -20,9 +20,9 @@ ja:
add_go_to_top_info: '長いページが多い場合、「トップへ」のリンクは役立ちます。'
button_assign_to_me: Assign to me
disabled_modules_info: "プロジェクト内で選択させたくないモジュール。もしこのモジュールが既存のプロジェクトで既に有効な場合、設定変更した上で、ウェブサーバを再起動しなければなりません。"
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
error_issue_status_could_not_changed: Issue state could not be changed
error_issues_could_not_be_assigned_to_me: Issue could not assigned to me
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
errors_invalid_icon_format: is an invalid font-awesome code
errors_no_or_invalid_arguments: No or invalid arguments
errors_query_does_not_exist: Query does not exist
@ -69,6 +69,7 @@ ja:
label_global_wiki_sidebar: "グローバルWikiサイドバー"
label_go_to_top: "トップへ"
label_google_maps_embed_api: Google Maps Embed API Key
label_help_manual: manual
label_hour: hour
label_icon_color: Icon color
label_invisible_captcha: SPAM protection for registration
@ -97,6 +98,9 @@ ja:
label_query_edit: Edit query
label_reddit_subject: Reddit subject
label_reddit_user_account: Reddit user account
label_macro_plural: macros
label_redmine_org_issue: Redmine.org issue
label_redmine_org_wiki: Redmine.org wiki page
label_remove_help: "「ヘルプ」をトップメニューから外す"
label_remove_mypage: "「マイ・ページ」をトップメニューから外す"
label_remove_news: "Remove 'Lastest news' from overview page"
@ -157,5 +161,3 @@ ja:
wiki_pdf_header_info: This text block will be displayed on the first page before the regular Wiki content in the PDF view. Macro use is very restricted, here.
wiki_pdf_remove_attachments_info: When active the attached Wiki files will not be displayed in PDF view.
wiki_pdf_remove_title_info: When active the Wiki title info will not be displayed in PDF view.
label_redmine_org_issue: Redmine.org issue
label_redmine_org_wiki: Redmine.org wiki page

View File

@ -20,9 +20,9 @@
add_go_to_top_info: "如果你有很長的頁面,建議增加 \"回到頁首\" 的按鈕。"
button_assign_to_me: Assign to me
disabled_modules_info: "專案中無法選擇模組。如果這些模組已經在現有專案中啟用,必須先變更對應的專案設定。"
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
error_issue_status_could_not_changed: Issue state could not be changed
error_issues_could_not_be_assigned_to_me: Issue could not assigned to me
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
errors_invalid_icon_format: "無效的 font-awesome 代碼。"
errors_no_or_invalid_arguments: "參數無效或不存在。"
errors_query_does_not_exist: "查無結果。"
@ -69,6 +69,7 @@
label_global_wiki_sidebar: "專案中Wiki側邊設定"
label_go_to_top: "回到頁首"
label_google_maps_embed_api: Google Maps Embed API Key
label_help_manual: manual
label_hour: 小時
label_icon_color: 圖示顏色
label_invisible_captcha: "註冊SPAM保護"
@ -97,6 +98,9 @@
label_query_edit: 編輯查詢
label_reddit_subject: Reddit 主題
label_reddit_user_account: Reddit 帳號
label_macro_plural: macros
label_redmine_org_issue: Redmine.org issue
label_redmine_org_wiki: Redmine.org wiki page
label_remove_help: "從頂部選單中移除 \"幫助\" 項"
label_remove_mypage: "從頂部選單中移除 \"帳戶首頁\" 項"
label_remove_news: "從概觀頁中移除 \"最近新聞\" 區域"
@ -157,5 +161,3 @@
wiki_pdf_header_info: "該訊息將顯示在PDF第一頁頁首。此處macros指令支援有限。"
wiki_pdf_remove_attachments_info: "當啟用時Wiki附件將不會顯示在PDF中。"
wiki_pdf_remove_title_info: "當啟用時Wiki標題訊息不會顯示在PDF中"
label_redmine_org_issue: Redmine.org issue
label_redmine_org_wiki: Redmine.org wiki page

View File

@ -20,9 +20,9 @@ zh:
add_go_to_top_info: '如果您有很长的页面,添加"回到页首"的功能将非常有用。'
button_assign_to_me: Assign to me
disabled_modules_info: "项目中无法选择模块。如果这些模块已经在现有项目中激活,则必须首先更改并重新保存响应的项目设置。"
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
error_issue_status_could_not_changed: Issue state could not be changed
error_issues_could_not_be_assigned_to_me: Issue could not assigned to me
error_query_statement_invalid: An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator.
errors_invalid_icon_format: 无效的 Font-awesome 代码。
errors_no_or_invalid_arguments: 参数无效或不存在。
errors_query_does_not_exist: 查询不存咋。
@ -69,6 +69,7 @@ zh:
label_global_wiki_sidebar: "全局 WIKI 侧边栏设置"
label_go_to_top: "回到页首"
label_google_maps_embed_api: Google Maps Embed API Key
label_help_manual: manual
label_hour: 小时
label_icon_color: 图标颜色
label_invisible_captcha: SPAM protection for registration
@ -97,6 +98,9 @@ zh:
label_query_edit: 编辑查询
label_reddit_subject: Reddit 主题
label_reddit_user_account: Reddit 账号
label_macro_plural: macros
label_redmine_org_issue: Redmine.org issue
label_redmine_org_wiki: Redmine.org wiki page
label_remove_help: "从顶部菜单栏中移除 '帮助' 项"
label_remove_mypage: "从顶部菜单栏中移除 '我的工作台' 项"
label_remove_news: "从概览页中移除 '最近新闻' 区域"
@ -157,5 +161,3 @@ zh:
wiki_pdf_header_info: 该文本快将显示在 PDF 视图中的常规 WIKI 内容之前的第一页上。此处宏命令的使用非常有限。
wiki_pdf_remove_attachments_info: 当启用时WIKI 附件将不会显示在PDF视图中。
wiki_pdf_remove_title_info: 当启用时WIKI 标题信息将不会显示在PDF视图中。
label_redmine_org_issue: Redmine.org issue
label_redmine_org_wiki: Redmine.org wiki page