Skip to content

Commit

Permalink
Merge branch 'documentation/57632-use-feedbackdialog-component-in-cor…
Browse files Browse the repository at this point in the history
…e' of https://github.com/opf/openproject into documentation/57632-use-feedbackdialog-component-in-core
  • Loading branch information
psatyal committed Sep 13, 2024
2 parents 477d0e1 + abc46db commit 2b62c25
Show file tree
Hide file tree
Showing 570 changed files with 5,065 additions and 2,597 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/version-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Check work package version

on:
pull_request:
types: [labeled, synchronize]

permissions:
contents: read # to fetch code (actions/checkout)
pull-requests: write # to comment on the PR

jobs:
check-pr:
if: contains(github.event.pull_request.labels.*.name, 'needs review')
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1

- name: Verify linked version matches core version
id: version-check
run: ./script/ci/version_check.sh "${{ github.event.pull_request.body }}"

- name: Add comment if versions differ
if: steps.version-check.outputs.version_mismatch == 'true'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: version-mismatch-comment
message: |
The provided work package version does not match the core version:
- Work package URL: ${{ steps.version-check.outputs.wp_url }}
- Work package version: ${{steps.version-check.outputs.wp_version}}
- Core version: ${{steps.version-check.outputs.core_version}}
Please make sure that:
- The work package version OR your pull request target branch is correct
- name: Version check passed
if: steps.version-check.outputs.version_mismatch != 'true'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: version-mismatch-comment
delete: true
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ gem "view_component"
gem "lookbook", "~> 2.3.0"

# Require factory_bot for usage with openproject plugins testing
gem "factory_bot", "~> 6.4.0", require: false
gem "factory_bot", "~> 6.5.0", require: false
# require factory_bot_rails for convenience in core development
gem "factory_bot_rails", "~> 6.4.0", require: false

Expand All @@ -247,7 +247,7 @@ group :test do
gem "rack_session_access"
gem "rspec", "~> 3.13.0"
# also add to development group, so 'spec' rake task gets loaded
gem "rspec-rails", "~> 6.1.0", group: :development
gem "rspec-rails", "~> 7.0.0", group: :development

# Retry failures within the same environment
gem "retriable", "~> 3.1.1"
Expand Down Expand Up @@ -398,4 +398,4 @@ end

gem "openproject-octicons", "~>19.18.0"
gem "openproject-octicons_helper", "~>19.18.0"
gem "openproject-primer_view_components", "~>0.43.1"
gem "openproject-primer_view_components", "~>0.46.1"
56 changes: 27 additions & 29 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -342,16 +342,16 @@ GEM
activerecord (>= 4.0.0, < 8.0)
awrence (1.2.1)
aws-eventstream (1.3.0)
aws-partitions (1.970.0)
aws-partitions (1.973.0)
aws-sdk-core (3.203.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.89.0)
aws-sdk-kms (1.90.0)
aws-sdk-core (~> 3, >= 3.203.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.160.0)
aws-sdk-s3 (1.161.0)
aws-sdk-core (~> 3, >= 3.203.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -540,7 +540,7 @@ GEM
eventmachine (1.2.7)
eventmachine_httpserver (0.2.1)
excon (0.111.0)
factory_bot (6.4.6)
factory_bot (6.5.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.4.3)
factory_bot (~> 6.4)
Expand All @@ -560,7 +560,7 @@ GEM
websocket-driver (~> 0.7)
ffi (1.17.0)
flamegraph (0.9.5)
fog-aws (3.25.0)
fog-aws (3.26.0)
base64 (~> 0.2.0)
fog-core (~> 2.1)
fog-json (~> 1.1)
Expand Down Expand Up @@ -714,7 +714,7 @@ GEM
omniauth (~> 1.1)
omniauth-openid-connect (>= 0.2.1)
rails (>= 3.2.21)
logger (1.6.0)
logger (1.6.1)
lograge (0.14.0)
actionpack (>= 4)
activesupport (>= 4)
Expand Down Expand Up @@ -749,7 +749,7 @@ GEM
method_source (1.1.0)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0820)
mime-types-data (3.2024.0903)
mini_magick (5.0.1)
mini_mime (1.1.5)
mini_portile2 (2.8.7)
Expand Down Expand Up @@ -777,7 +777,7 @@ GEM
nokogiri (1.16.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
oj (3.16.5)
oj (3.16.6)
bigdecimal (>= 3.0)
ostruct (>= 0.2)
okcomputer (1.18.5)
Expand All @@ -803,7 +803,7 @@ GEM
actionview
openproject-octicons (= 19.18.0)
railties
openproject-primer_view_components (0.43.1)
openproject-primer_view_components (0.46.1)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
openproject-octicons (>= 19.17.0)
Expand All @@ -821,7 +821,7 @@ GEM
activerecord (>= 6.1)
request_store (~> 1.4)
parallel (1.26.3)
parallel_tests (4.7.1)
parallel_tests (4.7.2)
parallel
parser (3.3.5.0)
ast (~> 2.4.1)
Expand All @@ -835,7 +835,7 @@ GEM
hashery (~> 2.0)
ruby-rc4
ttfunk
pg (1.5.7)
pg (1.5.8)
plaintext (0.3.4)
activesupport (> 2.2.1)
nokogiri (~> 1.10, >= 1.10.4)
Expand Down Expand Up @@ -945,7 +945,7 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rb_sys (0.9.100)
rb_sys (0.9.102)
rbtrace (0.5.1)
ffi (>= 1.0.6)
msgpack (>= 0.4.3)
Expand All @@ -960,7 +960,7 @@ GEM
redis-client (0.22.2)
connection_pool
regexp_parser (2.9.2)
reline (0.5.9)
reline (0.5.10)
io-console (~> 0.5)
representable (3.2.0)
declarative (< 0.1.0)
Expand All @@ -972,8 +972,7 @@ GEM
actionpack (>= 5.2)
railties (>= 5.2)
retriable (3.1.2)
rexml (3.3.6)
strscan
rexml (3.3.7)
rinku (2.0.6)
roar (1.2.0)
representable (~> 3.1)
Expand All @@ -985,16 +984,16 @@ GEM
rspec-mocks (~> 3.13.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.2)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (6.1.5)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-rails (7.0.1)
actionpack (>= 7.0)
activesupport (>= 7.0)
railties (>= 7.0)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
Expand Down Expand Up @@ -1023,12 +1022,12 @@ GEM
rubocop-performance (1.21.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.26.0)
rubocop-rails (2.26.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.0.4)
rubocop-rspec (3.0.5)
rubocop (~> 1.61)
rubocop-rspec_rails (2.30.0)
rubocop (~> 1.61)
Expand All @@ -1041,7 +1040,7 @@ GEM
ruby-prof (1.7.0)
ruby-progressbar (1.13.0)
ruby-rc4 (0.1.5)
ruby-saml (1.16.0)
ruby-saml (1.17.0)
nokogiri (>= 1.13.10)
rexml
ruby2_keywords (0.0.5)
Expand Down Expand Up @@ -1081,7 +1080,7 @@ GEM
spring (>= 0.9.1)
spring-commands-rubocop (0.4.0)
spring (>= 1.0)
sprockets (3.7.3)
sprockets (3.7.4)
base64
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
Expand All @@ -1095,7 +1094,6 @@ GEM
activerecord (>= 6.1)
stringex (2.8.6)
stringio (3.1.1)
strscan (3.1.0)
structured_warnings (0.4.0)
svg-graph (2.2.2)
swd (2.0.3)
Expand Down Expand Up @@ -1183,7 +1181,7 @@ GEM
zeitwerk (>= 2.6)
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.36)
yard (0.9.37)
zeitwerk (2.6.18)

PLATFORMS
Expand Down Expand Up @@ -1241,7 +1239,7 @@ DEPENDENCIES
erb_lint
erblint-github
escape_utils (~> 1.3)
factory_bot (~> 6.4.0)
factory_bot (~> 6.5.0)
factory_bot_rails (~> 6.4.0)
ffi (~> 1.15)
flamegraph
Expand Down Expand Up @@ -1303,7 +1301,7 @@ DEPENDENCIES
openproject-octicons (~> 19.18.0)
openproject-octicons_helper (~> 19.18.0)
openproject-openid_connect!
openproject-primer_view_components (~> 0.43.1)
openproject-primer_view_components (~> 0.46.1)
openproject-recaptcha!
openproject-reporting!
openproject-storages!
Expand Down Expand Up @@ -1347,7 +1345,7 @@ DEPENDENCIES
roar (~> 1.2.0)
rouge (~> 4.3.0)
rspec (~> 3.13.0)
rspec-rails (~> 6.1.0)
rspec-rails (~> 7.0.0)
rspec-retry (~> 0.6.1)
rubocop
rubocop-capybara
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ See COPYRIGHT and LICENSE files for more details.
<%=
component_wrapper do
primer_form_with(
class: "op-new-project-mapping-form",
model: @project_mapping,
url: link_admin_settings_project_custom_field_path(@project_custom_field),
model: ,
url:,
data: { turbo: true },
method: :post
) do |form|
concat(render(Primer::Alpha::Dialog::Body.new(
id: DIALOG_BODY_ID, test_selector: DIALOG_BODY_ID, aria: { label: title },
id: dialog_body_id, test_selector: dialog_body_id, aria: { label: title },
style: "min-height: 300px"
)) do
render(Projects::CustomFields::CustomFieldMappingForm.new(form, project_mapping: @project_mapping))
render(Projects::CustomFields::CustomFieldMappingForm.new(form, project_mapping: @custom_field_project_mapping))
end)

concat(render(Primer::Alpha::Dialog::Footer.new(show_divider: false)) do
concat(render(Primer::ButtonComponent.new(data: { 'close-dialog-id': DIALOG_ID })) { cancel_button_text })
concat(render(Primer::ButtonComponent.new(data: { 'close-dialog-id': dialog_id })) { cancel_button_text })
concat(render(Primer::ButtonComponent.new(scheme: :primary, type: :submit)) { submit_button_text })
end)
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#-- 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 Admin
module CustomFields
module CustomFieldProjects
class NewCustomFieldProjectsFormModalComponent < ApplicationComponent
include OpTurbo::Streamable

DIALOG_ID = "new-custom-field-projects-modal".freeze
DIALOG_BODY_ID = "new-custom-field-projects-modal-body".freeze

def initialize(custom_field_project_mapping:, custom_field:, **)
@custom_field_project_mapping = custom_field_project_mapping
@custom_field = custom_field

super(@custom_field_project_mapping, **)
end

private

def url
url_helpers.custom_field_projects_path(@custom_field)
end

def dialog_id = DIALOG_ID
def dialog_body_id = DIALOG_BODY_ID

attr_reader :custom_field_project_mapping, :custom_field

def title
I18n.t(:label_add_projects)
end

def cancel_button_text
I18n.t("button_cancel")
end

def submit_button_text
I18n.t("button_add")
end
end
end
end
end
Loading

0 comments on commit 2b62c25

Please sign in to comment.