OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
show favored project queries in menu
Ivan Kuchin0a6f7cda9c90
diff --git a/app/components/open_project/common/submenu_component.html.erb b/app/components/open_project/common/submenu_component.html.erbindex 5b38527ce18..ba0b2953121 100644--- a/app/components/open_project/common/submenu_component.html.erb+++ b/app/components/open_project/common/submenu_component.html.erb@@ -62,6 +62,9 @@<% selected = child_item.selected ? 'selected' : '' %><a class="op-sidemenu--item-action <%= selected %>" href="<%= child_item.href %>" data-test-selector="op-sidemenu--item-action"><span class="op-sidemenu--item-title"><%= child_item.title %></span>+ <% if child_item.favored %>+ <%= render Primer::Beta::Octicon.new(icon: "star-fill", "aria-label": I18n.t(:label_favorite), classes: %w[op-sidemenu--item-mark op-primer--star-icon]) %>+ <% end %></a></li><% end %>diff --git a/app/menus/projects/menu.rb b/app/menus/projects/menu.rbindex 1726f9e8e01..96fb25144cb 100644--- a/app/menus/projects/menu.rb+++ b/app/menus/projects/menu.rb@@ -67,6 +67,10 @@ module Projectsendend+ def favored?(query_params)+ query_params[:query_id].in?(favored_ids)+ end+def query_path(query_params)projects_path(query_params)end@@ -117,6 +121,11 @@ module Projectsdef persisted_filters@persisted_filters = ::ProjectQuery.visible(current_user).order(:name)+ .sort_by.with_index { |query, i| [query.id.in?(favored_ids) ? 0 : 1, i] }+ end++ def favored_ids+ @favored_ids = ::ProjectQuery.favored_by(current_user).pluck(:id).to_setenddef modification_params?diff --git a/app/menus/submenu.rb b/app/menus/submenu.rbindex 0cdbcbbb861..3028e3fbd63 100644--- a/app/menus/submenu.rb+++ b/app/menus/submenu.rb@@ -92,7 +92,8 @@ class Submenudef menu_item(name, query_params)OpenProject::Menu::MenuItem.new(title: name,href: query_path(query_params),- selected: selected?(query_params))+ selected: selected?(query_params),+ favored: favored?(query_params))enddef selected?(query_params)@@ -109,6 +110,10 @@ class Submenutrueend+ def favored?(_query_params)+ false+ end+def query_path(query_params)raise NotImplementedErrorenddiff --git a/frontend/src/global_styles/content/_sidemenu.sass b/frontend/src/global_styles/content/_sidemenu.sassindex 059ab00bf74..019ef72b898 100644--- a/frontend/src/global_styles/content/_sidemenu.sass+++ b/frontend/src/global_styles/content/_sidemenu.sass@@ -46,15 +46,16 @@padding-left: 12px&--item-title- display: flex- margin-right: auto+ display: inline-blockoverflow: hiddentext-overflow: ellipsiswhite-space: nowrapline-height: 30pxtext-decoration: none- width: 100%&--item-iconfont-size: 24pxmargin-right: 8px++ &--item-mark+ margin-left: 8pxdiff --git a/lib/open_project/menu.rb b/lib/open_project/menu.rbindex 693e4517b87..0c2458efa59 100644--- a/lib/open_project/menu.rb+++ b/lib/open_project/menu.rb@@ -31,6 +31,6 @@module OpenProjectmodule MenuMenuGroup = Data.define(:header, :children)- MenuItem = Data.define(:title, :href, :selected)+ MenuItem = Data.define(:title, :href, :selected, :favored)endend