Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[57405] Use Primer's PageHeader component on the WorkPackage list view #16708

Draft
wants to merge 39 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
afc9b03
Add a turboFrame in the partitioned query space to render a Primer Pa…
HDinger Sep 11, 2024
5877cd6
A rails based WP create button
HDinger Sep 11, 2024
a4fbf49
Use base filter component for projects and work packages
oliverguenther Sep 11, 2024
e404c1e
Merge branch 'dev' into feature/57405-use-primers-pageheader-componen…
oliverguenther Sep 27, 2024
e8a7891
Render as controller
oliverguenther Sep 27, 2024
9d7cf59
Remove page header turbo
oliverguenther Sep 27, 2024
f004a79
custom list component rendered from rails
oliverguenther Sep 27, 2024
25f1aa5
New split view route
oliverguenther Sep 27, 2024
4d6cd44
Merge remote-tracking branch 'origin/dev' into feature/57405-use-prim…
HDinger Oct 9, 2024
da1c1cc
Add a splitCreate component
HDinger Oct 10, 2024
27ad1d8
Enable splitView and splitCreate on global WorkPackage page
HDinger Oct 10, 2024
8b982a3
Merge remote-tracking branch 'origin/dev' into feature/57405-use-prim…
HDinger Oct 10, 2024
3871930
Pass splitViewType along to be able to differentiate between the comp…
HDinger Oct 11, 2024
d83886e
Create a FullView::CopyComponent for WorkPackages which is routed fro…
HDinger Oct 11, 2024
2f26577
Harmonize code structure due to increased number of components
HDinger Oct 11, 2024
57f8524
Merge remote-tracking branch 'origin/dev' into feature/57405-use-prim…
HDinger Oct 15, 2024
251eb77
Remove angular splitCopy route and component as it was overwritten by…
HDinger Oct 15, 2024
84b50fb
Create FullView::CreateComponent for WorkPackages which is now routed…
HDinger Oct 15, 2024
8a46e33
First draft of implementing the FullView route for WorkPackages from …
HDinger Oct 16, 2024
cb2702e
Merge remote-tracking branch 'origin/dev' into feature/57405-use-prim…
HDinger Oct 16, 2024
790433b
Pass correct tab from the URL to the FullView::ShowComponent
HDinger Oct 16, 2024
a9cb2b6
Do a hard reload to "create" route when we are not routed from Angular
HDinger Oct 16, 2024
099bb38
Adapt routing spec to new WorkPackage routes and to some fine-tuning …
HDinger Oct 16, 2024
52bab59
Trigger export modal
HDinger Oct 16, 2024
80de553
Show correct tab in WP Full view and change URL when clicking a tab e…
HDinger Oct 17, 2024
773d5a9
Merge remote-tracking branch 'origin/dev' into feature/57405-use-prim…
HDinger Oct 17, 2024
7f2ef2d
Fix some data for the still existing angular pages
HDinger Oct 18, 2024
0a6aa62
First draft of the baseline modal inside a Primer Dialog triggered fr…
HDinger Oct 18, 2024
644206f
Merge remote-tracking branch 'origin/dev' into feature/57405-use-prim…
HDinger Oct 23, 2024
afc5d35
Adapt to new rails based routing
HDinger Oct 23, 2024
34c0b72
Add upsale route for sharing
HDinger Oct 23, 2024
b30deb4
Extract content of the IncludeProjects modal into a separate componen…
HDinger Oct 24, 2024
ae03d99
Merge remote-tracking branch 'origin/dev' into feature/57405-use-prim…
HDinger Oct 25, 2024
fe475bb
Prepare configuration modal on the base of a Primer::Dialog
HDinger Oct 25, 2024
4923841
Merge remote-tracking branch 'origin/dev' into feature/57405-use-prim…
HDinger Oct 29, 2024
b319d14
Merge remote-tracking branch 'origin/dev' into feature/57405-use-prim…
HDinger Nov 18, 2024
2779193
Show tab content in the WpTableConfiguration Modal
HDinger Nov 19, 2024
9b0b2a3
add placeholder for visibility settings
HDinger Nov 19, 2024
cfadfa5
Merge remote-tracking branch 'origin/dev' into feature/57405-use-prim…
HDinger Nov 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/_index.sass
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@import "work_packages/details/tab_component"
@import "work_packages/progress/modal_body_component"
@import "work_packages/hover_card_component"
@import "work_packages/split_view_component"
@import "work_packages/split_view/show_component"
@import "open_project/common/attribute_component"
@import "open_project/common/submenu_component"
@import "filter/filters_component"
Expand Down
6 changes: 2 additions & 4 deletions app/components/filter/filter_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<% each_filter do |filter, filter_active, additional_options| %>
<% filter_boolean = filter.is_a?(Queries::Filters::Shared::BooleanFilter) %>
<% autocomplete_filter = additional_options.key?(:autocomplete_options) %>

<li class="advanced-filters--filter <%= filter_active ? '' : 'hidden' %>"
data-filter-name="<%= filter.name %>"
data-filter-type="<%= filter.type %>"
Expand Down Expand Up @@ -75,10 +74,8 @@
</div>
</li>
<% end %>

<li class="advanced-filters--spacer <%= query.filters.blank? ? 'hidden' : '' %>"
data-filter--filters-form-target="spacer"></li>

<li class="advanced-filters--add-filter">
<!-- Add filters -->
<label for="add_filter_select" aria-hidden="true" class="advanced-filters--add-filter-label ng-binding">
Expand All @@ -90,7 +87,6 @@
<%= t('js.filter.description.text_open_filter') %>
<%= t('js.filter.description.text_close_filter') %>
</label>

<div class="advanced-filters--add-filter-value">
<%= select_tag 'add_filter_select',
options_from_collection_for_select(
Expand All @@ -109,9 +105,11 @@
} %>
</div>
</li>
<% if show_apply? %>
<li class="advanced-filters--controls">
<%= submit_tag t('button_apply'), class: 'button -small -primary', name: nil %>
</li>
<% end %>
</ul>
</fieldset>
<% end %>
4 changes: 4 additions & 0 deletions app/components/filter/filter_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def show_filters_section?
always_visible || params[:filters].present?
end

def show_apply?
true
end

# Returns filters, active and inactive.
# In case a filter is active, the active one will be preferred over the inactive one.
def each_filter
Expand Down
109 changes: 0 additions & 109 deletions app/components/projects/projects_filters_component.html.erb

This file was deleted.

4 changes: 4 additions & 0 deletions app/components/projects/projects_filters_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def turbo_requests?
true
end

def show_apply?
false
end

private

def allowed_filter?(filter)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<% if can_create_work_packages? %>
<%=
render Primer::Alpha::ActionMenu.new do |menu|
menu.with_show_button(scheme: :primary,
aria: {
label: I18n.t(:label_work_package_new)
}) do |button|
button.with_trailing_action_icon(icon: :"triangle-down")
button.with_leading_visual_icon(icon: :plus)
I18n.t(:button_create)
end

items.each do |type|
menu.with_item(label: type.name,
tag: :a,
href: create_href_for_type(type),
content_arguments: { target: "_top" },
label_arguments: { classes: "__hl_inline_type_#{type.id}" })
end
end
%>
<% end %>
67 changes: 67 additions & 0 deletions app/components/work_packages/create/wp_create_button_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# frozen_string_literal: true

# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) 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.
# ++

module WorkPackages
module Create
class WpCreateButtonComponent < ApplicationComponent
include ApplicationHelper

def initialize(project: nil)
super
@project = project
end

def items
if @project
@project.types.all
else
Type.all
end
end

def create_href_for_type(type)
# TODO: make configurable for other modules
if @project
split_create_project_work_packages_path(@project, type: type.id)
else
split_create_work_packages_path(type: type.id)
end
end

def can_create_work_packages?
if @project
helpers.current_user.allowed_in_project?(:add_work_packages, @project)
else
helpers.current_user.allowed_in_any_project?(:add_work_packages)
end
end
end
end
end
36 changes: 36 additions & 0 deletions app/components/work_packages/filter_button_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# frozen_string_literal: true

# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) 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.
# ++
module WorkPackages
class FilterButtonComponent < Filter::FilterButtonComponent
def filters_count
@filters_count ||= query.filters.count
end
end
end
59 changes: 59 additions & 0 deletions app/components/work_packages/filters_component.rb
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) 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 WorkPackages::FiltersComponent < Filter::FilterComponent
def allowed_filters
super.sort_by(&:human_name)
end

def turbo_requests?
true
end

def show_apply?
false
end

protected

def additional_filter_attributes(filter)
case filter
when Queries::WorkPackages::Filter::FilterForWpMixin
{
autocomplete_options: {
component: "opce-autocompleter",
resource: "work_packages"
}
}
else
super
end
end
end
11 changes: 11 additions & 0 deletions app/components/work_packages/full_view/copy_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%=
helpers.angular_component_tag "opce-wp-full-copy",
inputs: {
type: @type,
copiedFromWorkPackageId: @copied_from_work_package_id,
projectIdentifier: @project.present? ? @project.identifier : nil,
resizerClass: helpers.container_class,
routedFromAngular: false,
}

%>
18 changes: 18 additions & 0 deletions app/components/work_packages/full_view/copy_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

module WorkPackages
module FullView
class CopyComponent < ApplicationComponent
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable

def initialize(type:, copied_from_work_package_id:, project:)
super

@type = type
@copied_from_work_package_id = copied_from_work_package_id
@project = project
end
end
end
end
Loading
Loading