OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/config/initializers/menus.rb

321 lines
11 KiB

#-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2017 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See docs/COPYRIGHT.rdoc for more details.
#++
require 'redmine/menu_manager'
Redmine::MenuManager.map :top_menu do |menu|
# projects menu will be added by
# Redmine::MenuManager::TopMenuHelper#render_projects_top_menu_node
menu.push :work_packages,
{ controller: '/work_packages', project_id: nil, state: nil, action: 'index' },
context: :modules,
caption: I18n.t('label_work_package_plural'),
if: Proc.new {
(User.current.logged? || !Setting.login_required?) &&
User.current.allowed_to?(:view_work_packages, nil, global: true)
}
menu.push :news,
{ controller: '/news', project_id: nil, action: 'index' },
context: :modules,
if: Proc.new {
(User.current.logged? || !Setting.login_required?) &&
User.current.allowed_to?(:view_news, nil, global: true)
}
menu.push :time_sheet,
{ controller: '/timelog', project_id: nil, action: 'index' },
context: :modules,
caption: I18n.t('label_time_sheet_menu'),
if: Proc.new {
(User.current.logged? || !Setting.login_required?) &&
User.current.allowed_to?(:view_time_entries, nil, global: true)
}
menu.push :help, OpenProject::Static::Links.help_link,
last: true,
caption: '',
icon: 'icon5 icon-help',
html: { accesskey: OpenProject::AccessKeys.key_for(:help),
title: I18n.t('label_help'),
8 years ago
class: 'menu-item--help',
target: '_blank' }
end
Redmine::MenuManager.map :account_menu do |menu|
menu.push :my_page,
:my_page_path,
if: Proc.new { User.current.logged? }
menu.push :my_account,
{ controller: '/my', action: 'account' },
if: Proc.new { User.current.logged? }
menu.push :administration,
{ controller: '/users', action: 'index' },
if: Proc.new { User.current.admin? }
menu.push :logout,
:signout_path,
if: Proc.new { User.current.logged? }
end
[27828] Feature: Query menu in sidenav (#6429) * in main menu add gantt as extra work package child item * Satisfy spec and code climate * Add gantt chart icon behin default gantt query name. * WIP Query menu in left sidebar * Shift query dropdown in left sidenav * Reload menu or load query on click from every project location * WIP set correct label for default queries * Query menu listens on all changes of queries (delete, create, rename, toggle starred) and updates immediatly * WIP: Inline edit, field validation * Inline Edit validation and comfirm * Inline edit: validation of duplicate name * Set default columns and sorting for static queries * Codeclimate issues fixed * WIP Inline edit validation not working perfectly in all error states * Inline edit working * Autocompleter hover disabled and hovering over categories fixed * Category hover and toggle fixed; tested in Chrome, Firefox and Opera * Placeholder cut off fixed and text wrap added * English and german wording adjusted * Styles of inline edit and menu adjusted; matching wiki page styles * prevent menus to be displayed to often * application menu only displayed on work package * specify using no_menu layout more often * adapt tests to altered production implementation * Hamburger icon only in project; on global wp page: default queries shown correctly and summary removed * searching for undefined leads to error * Accessible click fixed (listen on escape) * Gantt in top menu deleted (gantt chart is part of default queries on wp page) * load menu on wp summary page * reduce times queries are loaded * lowercase on second word * remove menu from search and home * Styles fixed (category toggle and correct highlighting) * reflect static query in url * fix autocomplete handling in specs * Open all global menus on default and hide hamburger icon on global pages; Rebuild changes that have been ovrwritten after merge" * Correct highlighting of default queries after reload * Replace summary cuke with spec * WIP * Clear up selectors * Avoid actively setting promises and instead use $state.go to load links [ci skip] * Make editable title component a little simpler We can reuse the component I built for the wiki, that wasn't present in the frontend beforehand. * Fix moving through the menu and selecting items [ci skip] * Add save button to query title when query changed * Improve static names lookup by comparing query_props * Adapt and fix specs * Allow inner scrolling of wp query results Also, style the webkit scrollbar to make it pretty where supported * Allow renaming the query through setting menu, but simply focus on field [ci skip]
6 years ago
Redmine::MenuManager.map :application_menu do |menu|
menu.push :work_packages_query_select,
{ controller: '/work_packages', action: 'index' },
parent: :work_packages,
partial: 'work_packages/menu_query_select',
last: true
end
Redmine::MenuManager.map :my_menu do |menu|
menu_push = menu.push :account,
{ controller: '/my', action: 'account' },
caption: :label_profile,
icon: 'icon2 icon-user'
menu_push
menu.push :settings,
{ controller: '/my', action: 'settings' },
caption: :label_settings,
icon: 'icon2 icon-settings2'
menu.push :password,
{ controller: '/my', action: 'password' },
caption: :button_change_password,
if: Proc.new { User.current.change_password_allowed? },
icon: 'icon2 icon-locked'
menu.push :access_token,
{ controller: '/my', action: 'access_token' },
caption: I18n.t('my_account.access_tokens.access_token'),
icon: 'icon2 icon-key'
menu.push :mail_notifications,
{ controller: '/my', action: 'mail_notifications' },
caption: I18n.t('activerecord.attributes.user.mail_notification'),
icon: 'icon2 icon-news'
6 years ago
menu.push :delete_account, :delete_my_account_info_path,
caption: I18n.t('account.delete'),
param: :user_id,
if: Proc.new { Setting.users_deletable_by_self? },
last: :delete_account,
icon: 'icon2 icon-delete'
end
Redmine::MenuManager.map :admin_menu do |menu|
menu.push :users,
{ controller: '/users' },
caption: :label_user_plural,
icon: 'icon2 icon-user'
menu.push :groups,
{ controller: '/groups' },
caption: :label_group_plural,
icon: 'icon2 icon-group'
menu.push :roles,
{ controller: '/roles' },
caption: :label_role_and_permissions,
icon: 'icon2 icon-settings'
menu.push :types,
{ controller: '/types' },
caption: :label_work_package_types,
icon: 'icon2 icon-types'
menu.push :statuses,
{ controller: '/statuses' },
caption: :label_work_package_status_plural,
icon: 'icon2 icon-flag',
html: { class: 'statuses' }
menu.push :workflows,
{ controller: '/workflows', action: 'edit' },
caption: Proc.new { Workflow.model_name.human },
icon: 'icon2 icon-workflow'
menu.push :custom_fields,
{ controller: '/custom_fields' },
caption: :label_custom_field_plural,
icon: 'icon2 icon-custom-fields',
html: { class: 'custom_fields' }
menu.push :custom_actions,
{ controller: '/custom_actions' },
caption: :'custom_actions.plural',
icon: 'icon2 icon-play'
menu.push :attribute_help_texts,
{ controller: '/attribute_help_texts' },
caption: :'attribute_help_texts.label_plural',
icon: 'icon2 icon-help2',
if: Proc.new {
EnterpriseToken.allows_to?(:attribute_help_texts)
}
menu.push :enumerations,
{ controller: '/enumerations' },
icon: 'icon2 icon-enumerations'
menu.push :settings,
{ controller: '/settings' },
caption: :label_system_settings,
icon: 'icon2 icon-settings2'
menu.push :authentication,
{ controller: '/authentication', action: 'authentication_settings' },
caption: :label_authentication,
icon: 'icon2 icon-two-factor-authentication'
menu.push :authentication_settings,
{ controller: '/authentication', action: 'authentication_settings' },
caption: :label_settings,
parent: :authentication
menu.push :ldap_authentication,
{ controller: '/ldap_auth_sources', action: 'index' },
parent: :authentication,
html: { class: 'server_authentication' },
last: true,
if: proc { !OpenProject::Configuration.disable_password_login? }
menu.push :oauth_applications,
{ controller: '/oauth/applications', action: 'index' },
parent: :authentication,
html: { class: 'oauth_applications' }
menu.push :announcements,
{ controller: '/announcements', action: 'edit' },
caption: 'Announcement',
icon: 'icon2 icon-news'
menu.push :plugins,
{ controller: '/admin', action: 'plugins' },
last: true,
icon: 'icon2 icon-plugins'
menu.push :info,
{ controller: '/admin', action: 'info' },
caption: :label_information_plural,
last: true,
icon: 'icon2 icon-info1'
menu.push :custom_style,
{ controller: '/custom_styles', action: 'show' },
caption: :label_custom_style,
icon: 'icon2 icon-design'
menu.push :colors,
{ controller: '/colors', action: 'index' },
caption: :'timelines.admin_menu.colors',
icon: 'icon2 icon-status'
menu.push :enterprise,
{ controller: '/enterprises', action: 'show' },
caption: :label_enterprise_edition,
icon: 'icon2 icon-headset',
if: proc { OpenProject::Configuration.ee_manager_visible? }
end
Redmine::MenuManager.map :project_menu do |menu|
menu.push :overview,
{ controller: '/projects', action: 'show' },
icon: 'icon2 icon-info1'
menu.push :activity,
{ controller: '/activities', action: 'index' },
param: :project_id,
if: Proc.new { |p| p.module_enabled?('activity') },
icon: 'icon2 icon-checkmark'
menu.push :roadmap,
{ controller: '/versions', action: 'index' },
param: :project_id,
if: Proc.new { |p| p.shared_versions.any? },
icon: 'icon2 icon-roadmap'
menu.push :work_packages,
{ controller: '/work_packages', action: 'index' },
param: :project_id,
caption: :label_work_package_plural,
icon: 'icon2 icon-view-timeline',
html: {
id: 'main-menu-work-packages',
:'wp-query-menu' => 'wp-query-menu'
}
[27828] Feature: Query menu in sidenav (#6429) * in main menu add gantt as extra work package child item * Satisfy spec and code climate * Add gantt chart icon behin default gantt query name. * WIP Query menu in left sidebar * Shift query dropdown in left sidenav * Reload menu or load query on click from every project location * WIP set correct label for default queries * Query menu listens on all changes of queries (delete, create, rename, toggle starred) and updates immediatly * WIP: Inline edit, field validation * Inline Edit validation and comfirm * Inline edit: validation of duplicate name * Set default columns and sorting for static queries * Codeclimate issues fixed * WIP Inline edit validation not working perfectly in all error states * Inline edit working * Autocompleter hover disabled and hovering over categories fixed * Category hover and toggle fixed; tested in Chrome, Firefox and Opera * Placeholder cut off fixed and text wrap added * English and german wording adjusted * Styles of inline edit and menu adjusted; matching wiki page styles * prevent menus to be displayed to often * application menu only displayed on work package * specify using no_menu layout more often * adapt tests to altered production implementation * Hamburger icon only in project; on global wp page: default queries shown correctly and summary removed * searching for undefined leads to error * Accessible click fixed (listen on escape) * Gantt in top menu deleted (gantt chart is part of default queries on wp page) * load menu on wp summary page * reduce times queries are loaded * lowercase on second word * remove menu from search and home * Styles fixed (category toggle and correct highlighting) * reflect static query in url * fix autocomplete handling in specs * Open all global menus on default and hide hamburger icon on global pages; Rebuild changes that have been ovrwritten after merge" * Correct highlighting of default queries after reload * Replace summary cuke with spec * WIP * Clear up selectors * Avoid actively setting promises and instead use $state.go to load links [ci skip] * Make editable title component a little simpler We can reuse the component I built for the wiki, that wasn't present in the frontend beforehand. * Fix moving through the menu and selecting items [ci skip] * Add save button to query title when query changed * Improve static names lookup by comparing query_props * Adapt and fix specs * Allow inner scrolling of wp query results Also, style the webkit scrollbar to make it pretty where supported * Allow renaming the query through setting menu, but simply focus on field [ci skip]
6 years ago
menu.push :work_packages_query_select,
{ controller: '/work_packages', action: 'index' },
param: :project_id,
[27828] Feature: Query menu in sidenav (#6429) * in main menu add gantt as extra work package child item * Satisfy spec and code climate * Add gantt chart icon behin default gantt query name. * WIP Query menu in left sidebar * Shift query dropdown in left sidenav * Reload menu or load query on click from every project location * WIP set correct label for default queries * Query menu listens on all changes of queries (delete, create, rename, toggle starred) and updates immediatly * WIP: Inline edit, field validation * Inline Edit validation and comfirm * Inline edit: validation of duplicate name * Set default columns and sorting for static queries * Codeclimate issues fixed * WIP Inline edit validation not working perfectly in all error states * Inline edit working * Autocompleter hover disabled and hovering over categories fixed * Category hover and toggle fixed; tested in Chrome, Firefox and Opera * Placeholder cut off fixed and text wrap added * English and german wording adjusted * Styles of inline edit and menu adjusted; matching wiki page styles * prevent menus to be displayed to often * application menu only displayed on work package * specify using no_menu layout more often * adapt tests to altered production implementation * Hamburger icon only in project; on global wp page: default queries shown correctly and summary removed * searching for undefined leads to error * Accessible click fixed (listen on escape) * Gantt in top menu deleted (gantt chart is part of default queries on wp page) * load menu on wp summary page * reduce times queries are loaded * lowercase on second word * remove menu from search and home * Styles fixed (category toggle and correct highlighting) * reflect static query in url * fix autocomplete handling in specs * Open all global menus on default and hide hamburger icon on global pages; Rebuild changes that have been ovrwritten after merge" * Correct highlighting of default queries after reload * Replace summary cuke with spec * WIP * Clear up selectors * Avoid actively setting promises and instead use $state.go to load links [ci skip] * Make editable title component a little simpler We can reuse the component I built for the wiki, that wasn't present in the frontend beforehand. * Fix moving through the menu and selecting items [ci skip] * Add save button to query title when query changed * Improve static names lookup by comparing query_props * Adapt and fix specs * Allow inner scrolling of wp query results Also, style the webkit scrollbar to make it pretty where supported * Allow renaming the query through setting menu, but simply focus on field [ci skip]
6 years ago
parent: :work_packages,
partial: 'work_packages/menu_query_select',
last: true,
caption: :label_all_open_wps
menu.push :calendar,
{ controller: '/work_packages/calendars', action: 'index' },
param: :project_id,
caption: :label_calendar,
icon: 'icon2 icon-calendar'
menu.push :news,
{ controller: '/news', action: 'index' },
param: :project_id,
caption: :label_news_plural,
icon: 'icon2 icon-news'
menu.push :forums,
{ controller: '/forums', action: 'index', id: nil },
param: :project_id,
if: Proc.new { |p| p.forums.any? },
caption: :label_forum_plural,
icon: 'icon2 icon-ticket-note'
menu.push :repository,
{ controller: '/repositories', action: 'show' },
param: :project_id,
if: Proc.new { |p| p.repository && !p.repository.new_record? },
icon: 'icon2 icon-folder-open'
# Wiki menu items are added by WikiMenuItemHelper
menu.push :time_entries,
{ controller: '/timelog', action: 'index' },
param: :project_id,
if: -> (project) { User.current.allowed_to?(:view_time_entries, project) },
caption: :label_time_sheet_menu,
icon: 'icon2 icon-cost-reports'
menu.push :members,
{ controller: '/members', action: 'index' },
param: :project_id,
caption: :label_member_plural,
icon: 'icon2 icon-group'
menu.push :settings,
{ controller: '/project_settings', action: 'show' },
caption: :label_project_settings,
last: true,
icon: 'icon2 icon-settings2'
end