Skip to content

Commit

Permalink
Merge branch 'dev' into documentation/fix-small-typo
Browse files Browse the repository at this point in the history
  • Loading branch information
judithroth committed Jun 20, 2024
2 parents e1b0831 + b4195a4 commit fba1cea
Show file tree
Hide file tree
Showing 50 changed files with 1,001 additions and 721 deletions.
10 changes: 5 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ gem "will_paginate", "~> 4.0.0"

gem "friendly_id", "~> 5.5.0"

gem "acts_as_list", "~> 1.1.0"
gem "acts_as_list", "~> 1.2.0"
gem "acts_as_tree", "~> 2.9.0"
gem "awesome_nested_set", "~> 3.6.0"
gem "closure_tree", "~> 7.4.0"
Expand Down Expand Up @@ -93,7 +93,7 @@ gem "deckar01-task_list", "~> 2.3.1"
# Requires escape-utils for faster escaping
gem "escape_utils", "~> 1.3"
# Syntax highlighting used in html-pipeline with rouge
gem "rouge", "~> 4.2.0"
gem "rouge", "~> 4.3.0"
# HTML sanitization used for html-pipeline
gem "sanitize", "~> 6.1.0"
# HTML autolinking for mails and urls (replaces autolink)
Expand All @@ -107,7 +107,7 @@ gem "svg-graph", "~> 2.2.0"

gem "date_validator", "~> 0.12.0"
gem "email_validator", "~> 2.2.3"
gem "json_schemer", "~> 2.2.0"
gem "json_schemer", "~> 2.3.0"
gem "ruby-duration", "~> 3.2.0"

# `config/initializers/mail_starttls_patch.rb` has also been patched to
Expand All @@ -118,7 +118,7 @@ gem "mail", "= 2.8.1"
gem "csv", "~> 3.3"

# provide compatible filesystem information for available storage
gem "sys-filesystem", "~> 1.4.0", require: false
gem "sys-filesystem", "~> 1.5.0", require: false

gem "bcrypt", "~> 3.1.6"

Expand Down Expand Up @@ -204,7 +204,7 @@ gem "plaintext", "~> 0.3.2"

gem "ruby-progressbar", "~> 1.13.0", require: false

gem "mini_magick", "~> 4.12.0", require: false
gem "mini_magick", "~> 4.13.0", require: false

gem "validate_url"

Expand Down
46 changes: 23 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ PATH
remote: modules/backlogs
specs:
openproject-backlogs (1.0.0)
acts_as_list (~> 1.1.0)
acts_as_list (~> 1.2.0)

PATH
remote: modules/bim
Expand Down Expand Up @@ -206,7 +206,7 @@ PATH
remote: modules/two_factor_authentication
specs:
openproject-two_factor_authentication (1.0.0)
aws-sdk-sns (~> 1.75.0)
aws-sdk-sns (~> 1.77.0)
messagebird-rest (~> 1.4.2)
rotp (~> 6.1)
webauthn (~> 3.0)
Expand Down Expand Up @@ -318,8 +318,9 @@ GEM
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
acts_as_list (1.1.0)
activerecord (>= 4.2)
acts_as_list (1.2.1)
activerecord (>= 6.1)
activesupport (>= 6.1)
acts_as_tree (2.9.1)
activerecord (>= 3.0.0)
addressable (2.8.6)
Expand All @@ -341,21 +342,21 @@ GEM
activerecord (>= 4.0.0, < 7.2)
awrence (1.2.1)
aws-eventstream (1.3.0)
aws-partitions (1.944.0)
aws-sdk-core (3.197.0)
aws-partitions (1.945.0)
aws-sdk-core (3.197.1)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.84.0)
aws-sdk-kms (1.85.0)
aws-sdk-core (~> 3, >= 3.197.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.152.3)
aws-sdk-core (~> 3, >= 3.197.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sdk-sns (1.75.0)
aws-sdk-core (~> 3, >= 3.193.0)
aws-sdk-sns (1.77.0)
aws-sdk-core (~> 3, >= 3.197.0)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
Expand Down Expand Up @@ -517,7 +518,7 @@ GEM
factory_bot_rails (6.4.3)
factory_bot (~> 6.4)
railties (>= 5.0.0)
faraday (2.9.0)
faraday (2.9.2)
faraday-net_http (>= 2.0, < 3.2)
faraday-follow_redirects (0.3.0)
faraday (>= 1, < 3)
Expand Down Expand Up @@ -653,24 +654,23 @@ GEM
faraday-follow_redirects
json-schema (4.3.0)
addressable (>= 2.8)
json_schemer (2.2.1)
base64
json_schemer (2.3.0)
bigdecimal
hana (~> 1.3)
regexp_parser (~> 2.0)
simpleidn (~> 0.2)
json_spec (1.1.5)
multi_json (~> 1.0)
rspec (>= 2.0, < 4.0)
jwt (2.8.1)
jwt (2.8.2)
base64
ladle (1.0.1)
open4 (~> 1.0)
language_server-protocol (3.17.0.3)
launchy (3.0.1)
addressable (~> 2.8)
childprocess (~> 5.0)
lefthook (1.6.16)
lefthook (1.6.17)
letter_opener (1.10.0)
launchy (>= 2.2, < 4)
letter_opener_web (3.0.0)
Expand Down Expand Up @@ -720,7 +720,7 @@ GEM
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0604)
mini_magick (4.12.0)
mini_magick (4.13.1)
mini_mime (1.1.5)
mini_portile2 (2.8.7)
minitest (5.24.0)
Expand All @@ -733,7 +733,7 @@ GEM
mutex_m (0.2.0)
net-http (0.4.1)
uri
net-imap (0.4.12)
net-imap (0.4.13)
date
net-protocol
net-ldap (0.19.0)
Expand Down Expand Up @@ -943,7 +943,7 @@ GEM
roar (1.2.0)
representable (~> 3.1)
rotp (6.3.0)
rouge (4.2.1)
rouge (4.3.0)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
Expand Down Expand Up @@ -1066,7 +1066,7 @@ GEM
attr_required (>= 0.0.5)
faraday (~> 2.0)
faraday-follow_redirects
sys-filesystem (1.4.5)
sys-filesystem (1.5.0)
ffi (~> 1.1)
table_print (1.5.7)
terminal-table (3.0.2)
Expand Down Expand Up @@ -1155,7 +1155,7 @@ DEPENDENCIES
activerecord-import (~> 1.7.0)
activerecord-nulldb-adapter (~> 1.0.0)
activerecord-session_store (~> 2.1.0)
acts_as_list (~> 1.1.0)
acts_as_list (~> 1.2.0)
acts_as_tree (~> 2.9.0)
addressable (~> 2.8.0)
airbrake (~> 13.0.0)
Expand Down Expand Up @@ -1217,7 +1217,7 @@ DEPENDENCIES
httpx
i18n-js (~> 4.2.3)
i18n-tasks (~> 1.0.13)
json_schemer (~> 2.2.0)
json_schemer (~> 2.3.0)
json_spec (~> 1.1.4)
ladle
launchy (~> 3.0.0)
Expand All @@ -1231,7 +1231,7 @@ DEPENDENCIES
matrix (~> 0.4.2)
md_to_pdf!
meta-tags (~> 2.21.0)
mini_magick (~> 4.12.0)
mini_magick (~> 4.13.0)
multi_json (~> 1.15.0)
my_page!
net-ldap (~> 0.19.0)
Expand Down Expand Up @@ -1301,7 +1301,7 @@ DEPENDENCIES
retriable (~> 3.1.1)
rinku (~> 2.0.4)
roar (~> 1.2.0)
rouge (~> 4.2.0)
rouge (~> 4.3.0)
rspec (~> 3.13.0)
rspec-rails (~> 6.1.0)
rspec-retry (~> 0.6.1)
Expand Down Expand Up @@ -1333,7 +1333,7 @@ DEPENDENCIES
stringex (~> 2.8.5)
structured_warnings (~> 0.4.0)
svg-graph (~> 2.2.0)
sys-filesystem (~> 1.4.0)
sys-filesystem (~> 1.5.0)
table_print (~> 1.5.6)
test-prof (~> 1.3.0)
timecop (~> 0.9.0)
Expand Down
13 changes: 13 additions & 0 deletions app/components/open_project/common/submenu_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="op-sidebar--search">
<%= render Primer::Alpha::TextField.new(name: "search",
label: I18n.t("label_search"),
placeholder: I18n.t("label_search"),
leading_visual: { icon: :search },
visually_hide_label: true,
classes: "op-sidebar--search-input",
Expand Down Expand Up @@ -68,4 +69,16 @@
</div>
<% end %>
</div>

<% if @create_btn_options.present? %>
<div class="op-sidebar--footer">
<%= render Primer::Beta::Button.new(scheme: :primary,
tag: :a,
href: @create_btn_options[:href],
classes: "op-sidebar--footer-action") do |button|
button.with_leading_visual_icon(icon: "plus")
@create_btn_options[:text]
end %>
</div>
<% end %>
</div>
3 changes: 2 additions & 1 deletion app/components/open_project/common/submenu_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
module OpenProject
module Common
class SubmenuComponent < ApplicationComponent
def initialize(sidebar_menu_items: nil, searchable: false)
def initialize(sidebar_menu_items: nil, searchable: false, create_btn_options: nil)
super()
@sidebar_menu_items = sidebar_menu_items
@searchable = searchable
@create_btn_options = create_btn_options
end

def render?
Expand Down
2 changes: 1 addition & 1 deletion app/contracts/base_contract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def collect_available_custom_field_attributes
# as the disabled custom fields would be treated as not-writable
#
# relevant especially for the project API
model.available_custom_fields(global: true).map(&:attribute_name)
model.all_available_custom_fields.map(&:attribute_name)
else
model.available_custom_fields.map(&:attribute_name)
end
Expand Down
111 changes: 111 additions & 0 deletions app/menus/submenu.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2010-2023 the OpenProject GmbH
#
# 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-2013 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 COPYRIGHT and LICENSE files for more details.
# ++
class Submenu
include Rails.application.routes.url_helpers
attr_reader :view_type, :project, :params

def initialize(view_type:, project: nil, params: nil)
@view_type = view_type
@project = project
@params = params
end

def menu_items
[
OpenProject::Menu::MenuGroup.new(header: I18n.t("js.label_starred_queries"), children: starred_queries),
OpenProject::Menu::MenuGroup.new(header: I18n.t("js.label_default_queries"), children: default_queries),
OpenProject::Menu::MenuGroup.new(header: I18n.t("js.label_global_queries"), children: global_queries),
OpenProject::Menu::MenuGroup.new(header: I18n.t("js.label_custom_queries"), children: custom_queries)
]
end

def starred_queries
base_query
.where("starred" => "t")
.pluck(:id, :name)
.map { |id, name| menu_item(query_params(id), name) }
end

def default_queries
raise NotImplementedError
end

def global_queries
base_query
.where("starred" => "f")
.where("public" => "t")
.pluck(:id, :name)
.map { |id, name| menu_item(query_params(id), name) }
end

def custom_queries
base_query
.where("starred" => "f")
.where("public" => "f")
.pluck(:id, :name)
.map { |id, name| menu_item(query_params(id), name) }
end

def base_query
base_query ||= Query
.visible(User.current)
.includes(:project)
.joins(:views)
.where("views.type" => view_type)

if project.present?
base_query.where("queries.project_id" => project.id)
else
base_query.where("queries.project_id" => nil)
end
end

def query_params(id)
{ query_id: id }
end

def menu_item(query_params, name)
OpenProject::Menu::MenuItem.new(title: name,
href: query_path(query_params),
selected: selected?(query_params))
end

def selected?(query_params)
query_params.each_key do |filter_key|
if params[filter_key] != query_params[filter_key].to_s
return false
end
end

true
end

def query_path(query_params)
raise NotImplementedError
end
end
2 changes: 1 addition & 1 deletion app/models/activities/base_activity_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def restrict_projects_query(user, options)

def restrict_projects_by_selection(options, query)
if (project = options[:project])
query = query.where(project.project_condition(options[:with_subprojects]))
query = query.where(project.with_subprojects(options[:with_subprojects]))
end

query
Expand Down
Loading

0 comments on commit fba1cea

Please sign in to comment.