-
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.
Extract content of the IncludeProjects modal into a separate componen…
…t so that we can re-use it in the rails Primer::Dialog (wip) [ci skip]
- Loading branch information
Showing
16 changed files
with
388 additions
and
155 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
app/components/work_packages/include_projects/modal_dialog_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,22 @@ | ||
<%= render(Primer::Alpha::Dialog.new( | ||
title: I18n.t("js.include_projects.title"), | ||
size: :medium_portrait, | ||
id: MODAL_ID | ||
)) do |dialog| %> | ||
<% dialog.with_header(variant: :large) %> | ||
<% dialog.with_body do %> | ||
<%= helpers.angular_component_tag "opce-include-projects", | ||
inputs: { | ||
showHeaderText: false, | ||
} %> | ||
<% end %> | ||
<% dialog.with_footer do %> | ||
<%= render(Primer::ButtonComponent.new(data: { "close-dialog-id": MODAL_ID })) { I18n.t(:button_cancel) } %> | ||
<%= render(Primer::ButtonComponent.new( | ||
data: { | ||
"close-dialog-id": MODAL_ID, | ||
}, | ||
scheme: :primary, | ||
type: :submit)) { I18n.t(:button_apply) } %> | ||
<% end %> | ||
<% end %> |
50 changes: 50 additions & 0 deletions
50
app/components/work_packages/include_projects/modal_dialog_component.rb
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,50 @@ | ||
# 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 IncludeProjects | ||
class ModalDialogComponent < ApplicationComponent | ||
MODAL_ID = "op-work-packages-include-projects-dialog" | ||
EXPORT_FORM_ID = "op-work-packages-include-projects-dialog-form" | ||
include OpTurbo::Streamable | ||
include OpPrimer::ComponentHelpers | ||
|
||
attr_reader :query, :project, :query_params | ||
|
||
def initialize(query:, project:, title:) | ||
super | ||
|
||
@query = query | ||
@project = project | ||
@query_params = ::API::V3::Queries::QueryParamsRepresenter.new(query).to_url_query(merge_params: { columns: [], title: }) | ||
end | ||
end | ||
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
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
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
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
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
57 changes: 57 additions & 0 deletions
57
frontend/src/app/shared/components/project-include/project-include-entry.component.ts
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,57 @@ | ||
//-- 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. | ||
//++ | ||
|
||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
ElementRef, | ||
Input, | ||
} from '@angular/core'; | ||
import { populateInputsFromDataset } from 'core-app/shared/components/dataset-inputs'; | ||
import { WorkPackageIsolatedQuerySpaceDirective } from 'core-app/features/work-packages/directives/query-space/wp-isolated-query-space.directive'; | ||
|
||
@Component({ | ||
hostDirectives: [WorkPackageIsolatedQuerySpaceDirective], | ||
template: ` | ||
<op-project-include | ||
[showHeaderText]="showHeaderText" | ||
[showActionBar]="showActionBar" | ||
></op-project-include> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class OpIncludeProjectsEntryComponent { | ||
@Input() showActionBar? = false; | ||
@Input() showHeaderText = true; | ||
|
||
constructor( | ||
readonly elementRef:ElementRef, | ||
) { | ||
populateInputsFromDataset(this); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
frontend/src/app/shared/components/project-include/project-include-modal.component.html
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,27 @@ | ||
<spot-drop-modal | ||
[opened]="opened" | ||
(closed)="opened = false" | ||
class="op-project-list-modal" | ||
> | ||
<button | ||
slot="trigger" | ||
type="button" | ||
class="button" | ||
(click)="toggleOpen()" | ||
[title]="text.toggle_title" | ||
data-test-selector="project-include-button" | ||
> | ||
{{ text.toggle_title }} | ||
<span | ||
*ngIf="count" | ||
class="badge -secondary" | ||
[textContent]="count" | ||
> | ||
</span> | ||
<span class="spot-icon spot-icon_dropdown"></span> | ||
</button> | ||
|
||
<op-project-include | ||
slot="body" | ||
></op-project-include> | ||
</spot-drop-modal> |
Oops, something went wrong.