[#73352] consolidate controller actions

- reorder yaml file to satisfy reviewdog?
This commit is contained in:
Eric Schubert
2026-06-08 14:52:46 +02:00
parent 7c3cd3953a
commit 892fc6a4d0
7 changed files with 87 additions and 92 deletions
@@ -41,28 +41,26 @@ module Wikis
end
def form_options
{
id: form_id,
model:,
url: form_url,
data: {
turbo_frame: WorkPackageWikisTabComponent::TURBO_FRAME_ID
if show_first_step?
{
id: form_id,
model:,
method: :get,
url: create_new_page_dialog_wiki_pages_path,
data: { turbo_stream: true }
}
}
else
{
id: form_id,
model:,
url: create_and_link_wiki_pages_path,
data: { turbo_frame: WorkPackageWikisTabComponent::TURBO_FRAME_ID }
}
end
end
def system_arguments
options
end
private
def form_url
if show_first_step?
continue_create_new_page_dialog_wiki_pages_path
else
create_and_link_wiki_pages_path
end
end
end
end
@@ -53,7 +53,7 @@ See COPYRIGHT and LICENSE files for more details.
menu.with_item(
label: t(".link_new"),
tag: :a,
href: create_new_page_dialog_wiki_pages_path(linkable: work_package, provider:),
href: create_new_page_dialog_wiki_pages_path(create_new_page_parameters),
content_arguments: { data: { controller: "async-dialog" } }
)
end
@@ -50,6 +50,16 @@ module Wikis
provider.user_connected?(User.current)
end
def create_new_page_parameters
{
wikis_forms_create_new_wiki_page_form_model: {
linkable_id: work_package.id,
linkable_type: work_package.class.name,
provider_id: provider.id
}
}
end
private
def page_link_service
@@ -48,16 +48,6 @@ module Wikis
end
def create_new_page_dialog
linkable = WorkPackage.visible.find(params.expect(:linkable))
provider = Provider.visible.find(params.expect(:provider))
form_object = Forms::CreateNewWikiPageFormModel.new(linkable_id: linkable.id,
linkable_type: linkable.class.name,
provider_id: provider.id,
page_title: nil)
respond_with_dialog Wikis::CreateNewWikiPageDialog.new(form_object)
end
def continue_create_new_page_dialog
params = create_new_page_params
form_object = Forms::CreateNewWikiPageFormModel.new(linkable_id: params[:linkable_id],
linkable_type: params[:linkable_type],
+60 -60
View File
@@ -34,71 +34,13 @@ en:
permission_manage_wiki_page_links: Manage Wiki Page Links
project_module_wiki_platforms: Wiki providers
wikis:
buttons:
connect_account: Connect %{provider} account
done_continue: Done, continue
open_wiki: Open wiki
save_and_continue: Save and continue
wiki_page: Wiki page
create_new_wiki_page_dialog:
page_title: Title
parent_help_text: Select a parent for this new wiki page.
title: Create new wiki page
delete_relation_page_link_confirmation_dialog:
title: Delete related wiki page link
heading: Delete related wiki page link?
health_checks:
authentication:
existing_token: User token
header: Authentication
user_bound_request: User-based request authentication
base_configuration:
header: Configuration
provider_configured: Configuration complete
errors:
not_configured: The connection could not be validated. Please finish configuration first.
xwiki_oauth_connection_error: OpenProject could not connect to the configured XWiki instance.
xwiki_oauth_request_error: An unexpected error occured when trying to communicate with the XWiki instance.
xwiki_oauth_token_missing: OpenProject cannot test the user-level communication with XWiki as the user did not yet connect their XWiki account.
xwiki_oauth_unauthorized: The user token was not recognized by XWiki.
instructions:
xwiki:
integration: XWiki Administration
oauth_application_details_html: The client secret value will not be accessible again after you close this window. Please copy these values into the [XWiki OpenProject Integration settings](xwiki_admin_link).
link_existing_wiki_page_dialog:
title: Add existing wiki page
link_existing_wiki_page_form:
no_results: No wiki pages found
placeholder: Search for a wiki page
work_package_wikis_tab_component:
inline_page_links: Inline page links
referencing_pages: Referenced in
page_links:
errors:
page_not_found: Linked wiki page no longer available
page_access_forbidden: You do not have permission to access this wiki page
unexpected: An unexpected error occurred
page_link_component:
remove: Remove page link
provider_types:
xwiki:
name: XWiki
relation_page_links_component:
link_existing: Existing wiki page
link_new: New wiki page
empty_heading: No related pages
empty_text: Manually add links to other related wiki pages.
oauth_login_component:
heading: Not connected to %{provider}
description: Log in to %{provider} to view and manage related wiki pages from this OpenProject instance.
connect_button: Connect %{provider} account
admin:
destroy_confirmation_dialog_component:
title: Delete wiki provider
heading: Permanently delete this wiki provider?
description_html: >-
The wiki provider %{wiki_provider} and all the related wiki page links will be deleted. In addition, every
inline wiki page link will no longer be accessible. This action is irreversible.
heading: Permanently delete this wiki provider?
title: Delete wiki provider
forms:
general_info_form_component:
provider_description: Please make sure you have administration privileges in your XWiki instance before doing the setup.
@@ -165,3 +107,61 @@ en:
openproject_oauth_description: Allow XWiki to access OpenProject data using an OAuth.
xwiki_oauth: XWiki OAuth
xwiki_oauth_description: Allow OpenProject to access XWiki data using an OAuth.
buttons:
connect_account: Connect %{provider} account
done_continue: Done, continue
open_wiki: Open wiki
save_and_continue: Save and continue
wiki_page: Wiki page
create_new_wiki_page_dialog:
page_title: Title
parent_help_text: Select a parent for this new wiki page.
title: Create new wiki page
delete_relation_page_link_confirmation_dialog:
heading: Delete related wiki page link?
title: Delete related wiki page link
health_checks:
authentication:
existing_token: User token
header: Authentication
user_bound_request: User-based request authentication
base_configuration:
header: Configuration
provider_configured: Configuration complete
errors:
not_configured: The connection could not be validated. Please finish configuration first.
xwiki_oauth_connection_error: OpenProject could not connect to the configured XWiki instance.
xwiki_oauth_request_error: An unexpected error occured when trying to communicate with the XWiki instance.
xwiki_oauth_token_missing: OpenProject cannot test the user-level communication with XWiki as the user did not yet connect their XWiki account.
xwiki_oauth_unauthorized: The user token was not recognized by XWiki.
instructions:
xwiki:
integration: XWiki Administration
oauth_application_details_html: The client secret value will not be accessible again after you close this window. Please copy these values into the [XWiki OpenProject Integration settings](xwiki_admin_link).
link_existing_wiki_page_dialog:
title: Add existing wiki page
link_existing_wiki_page_form:
no_results: No wiki pages found
placeholder: Search for a wiki page
oauth_login_component:
connect_button: Connect %{provider} account
description: Log in to %{provider} to view and manage related wiki pages from this OpenProject instance.
heading: Not connected to %{provider}
page_link_component:
remove: Remove page link
page_links:
errors:
page_access_forbidden: You do not have permission to access this wiki page
page_not_found: Linked wiki page no longer available
unexpected: An unexpected error occurred
provider_types:
xwiki:
name: XWiki
relation_page_links_component:
empty_heading: No related pages
empty_text: Manually add links to other related wiki pages.
link_existing: Existing wiki page
link_new: New wiki page
work_package_wikis_tab_component:
inline_page_links: Inline page links
referencing_pages: Referenced in
-1
View File
@@ -76,7 +76,6 @@ Rails.application.routes.draw do
resource :wiki_pages, controller: "wikis/pages", only: [] do
get :search
get :create_new_page_dialog
post :continue_create_new_page_dialog
post :create_and_link
end
end
@@ -73,9 +73,7 @@ module OpenProject::Wikis
project_module :work_package_tracking do
permission :manage_wiki_page_links,
{
"wikis/pages": %i[create_and_link
create_new_page_dialog
continue_create_new_page_dialog],
"wikis/pages": %i[create_and_link create_new_page_dialog],
"wikis/relation_page_links": %i[create
destroy
confirm_delete_dialog