-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
338 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# frozen_string_literal: true | ||
|
||
# -- 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 Projects::FiltersComponent < ApplicationComponent | ||
options :query | ||
|
||
def allowed_filters | ||
query | ||
.available_filters | ||
.select { |f| allowed_filter?(f) } | ||
.sort_by(&:human_name) | ||
end | ||
|
||
private | ||
|
||
def allowed_filter?(filter) | ||
allowlist = [ | ||
Queries::Projects::Filters::ActiveFilter, | ||
Queries::Projects::Filters::TemplatedFilter, | ||
Queries::Projects::Filters::PublicFilter, | ||
Queries::Projects::Filters::ProjectStatusFilter, | ||
Queries::Projects::Filters::MemberOfFilter, | ||
Queries::Projects::Filters::CreatedAtFilter, | ||
Queries::Projects::Filters::LatestActivityAtFilter, | ||
Queries::Projects::Filters::NameAndIdentifierFilter, | ||
Queries::Projects::Filters::TypeFilter | ||
] | ||
allowlist << Queries::Filters::Shared::CustomFields::Base if EnterpriseToken.allows_to?(:custom_fields_in_projects_list) | ||
|
||
allowlist.detect { |clazz| filter.is_a? clazz } | ||
end | ||
end |
100 changes: 100 additions & 0 deletions
100
app/components/projects/index_page_header_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<%= render(Primer::OpenProject::PageHeader.new) do |header| %> | ||
<% header.with_title { t(:label_project_plural) } %> | ||
|
||
<% header.with_actions do %> | ||
<% if current_user.allowed_globally?(:add_project) %> | ||
<%= render( | ||
Primer::Beta::Button.new( | ||
tag: :a, | ||
href: new_project_path, | ||
scheme: :primary, | ||
size: :medium, | ||
aria: { label: I18n.t(:label_project_new) }, | ||
mr: BUTTON_MARGIN_RIGHT, | ||
data: { 'test-selector': 'project-new-button' } | ||
) | ||
) do |button| | ||
button.with_leading_visual_icon(icon: :plus) | ||
Project.model_name.human | ||
end | ||
%> | ||
<% end %> | ||
|
||
<%= render( | ||
Primer::Beta::IconButton.new( | ||
icon: :filter, | ||
size: :medium, | ||
aria: { label: t(:label_filters_toggle) }, | ||
mr: BUTTON_MARGIN_RIGHT, | ||
data: { 'project-target': 'filterFormToggle', | ||
'action': 'project#toggleDisplayFilters', | ||
'test-selector': 'project-filter-toggle' } | ||
) | ||
) | ||
%> | ||
|
||
<%= render( | ||
Primer::Beta::Button.new( | ||
tag: :a, | ||
href: activities_path, | ||
size: :medium, | ||
type: :submit, | ||
aria: { label: t(:label_overall_activity) }, | ||
mr: BUTTON_MARGIN_RIGHT | ||
) | ||
) do | ||
t(:label_overall_activity) | ||
end | ||
%> | ||
|
||
<%= render( | ||
Primer::Beta::Button.new( | ||
tag: :a, | ||
href: gantt_portfolio_query_link, | ||
size: :medium, | ||
disabled: gantt_portfolio_project_ids.empty?, | ||
type: :submit, | ||
aria: { label: t('projects.index.open_as_gantt') }, | ||
mr: BUTTON_MARGIN_RIGHT, | ||
id: 'projects-index-open-as-gantt', | ||
target: '_blank' | ||
) | ||
) do |button| | ||
button.with_leading_visual_icon(icon: 'op-view-timeline') | ||
button.with_trailing_visual_icon(icon: 'link-external') | ||
button.with_tooltip(text: gantt_portfolio_title) | ||
|
||
t('projects.index.open_as_gantt') | ||
end %> | ||
|
||
<%= render(Primer::Alpha::ActionMenu.new) do |menu| | ||
menu.with_show_button(icon: 'op-kebab-vertical', 'aria-label': t(:label_more), data: { 'test-selector': 'project-more-dropdown-menu' }) | ||
|
||
if current_user.admin? | ||
menu.with_item( | ||
label: t('button_configure'), | ||
href: admin_settings_projects_path, | ||
content_arguments: { target: '_blank' } | ||
) do |item| | ||
item.with_leading_visual_icon(icon: :gear) | ||
end | ||
end | ||
|
||
menu.with_item( | ||
label: t('js.label_export'), | ||
content_arguments: { 'data-show-dialog-id': 'project-export-dialog' } | ||
) do |item| | ||
item.with_leading_visual_icon(icon: 'op-file-download') | ||
end | ||
end | ||
%> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= render(Primer::Alpha::Dialog.new(title: t('js.label_export'), | ||
id: 'project-export-dialog')) do |d| | ||
d.with_header(variant: :large) | ||
d.with_body do | ||
render partial: 'project_export_modal', locals: { query: query } | ||
end | ||
end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# frozen_string_literal: true | ||
|
||
# -- 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 Projects::IndexPageHeaderComponent < ApplicationComponent | ||
options :projects, | ||
:current_user, | ||
:query | ||
|
||
BUTTON_MARGIN_RIGHT = 2 | ||
|
||
def gantt_portfolio_query_link | ||
generator = ::Projects::GanttQueryGeneratorService.new(gantt_portfolio_project_ids) | ||
work_packages_path query_props: generator.call | ||
end | ||
|
||
def gantt_portfolio_project_ids | ||
@gantt_portfolio_project_ids ||= projects | ||
.where(active: true) | ||
.select(:id) | ||
.uniq | ||
.pluck(:id) | ||
end | ||
|
||
def gantt_portfolio_title | ||
title = t('projects.index.open_as_gantt_title') | ||
|
||
if current_user.admin? | ||
title << ' ' | ||
title << t('projects.index.open_as_gantt_title_admin') | ||
end | ||
|
||
title | ||
end | ||
end |
6 changes: 6 additions & 0 deletions
6
app/components/projects/storage_information_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<p class="information-section"> | ||
<%= helpers.op_icon('icon-info1') %> | ||
<%= t(:label_projects_storage_information, | ||
count: Project.count, | ||
storage: number_to_human_size(Project.total_projects_size, precision: 2)) %> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# frozen_string_literal: true | ||
|
||
# -- 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 Projects::StorageInformationComponent < ApplicationComponent | ||
options :current_user | ||
|
||
def render? | ||
current_user.admin? | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.