-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Implementation/68723 redesign document show page for collaborative document with blocknote #20943
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
Merged
akabiru
merged 13 commits into
dev
from
implementation/68723-redesign-document-show-page-for-collaborative-document-with-blocknote
Nov 13, 2025
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
dbc0c3f
Extract class document show view to partial
akabiru 30cfc06
Begin collaborative document show/edit view with page header
akabiru 75d0134
Add block note editor with basic layout
akabiru 1b96365
Update editor layout design
akabiru 657f4f7
Remove breadcrumb truncation, will be handled globally
akabiru 5b4b483
Remove unnecessary parent component
akabiru 6308ef6
Remove blocknote from classic document view
akabiru d1a6a66
Update delete specs for classic documents
akabiru 83b1d53
Remove delete document placeholder action
akabiru 0b31ccf
DRY editor finder
akabiru 681d19e
Add happy path for collaborative editing
akabiru 7cd4e5f
Reinstate oauth token setup to controller
akabiru 0cbcf56
Update blocknote locale specs with new show layout
akabiru File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| @import "documents/list_component" | ||
| @import "documents/show_edit_view/block_note_editor_component" |
83 changes: 83 additions & 0 deletions
83
...es/documents/app/components/documents/show_edit_view/block_note_editor_component.html.erb
This file contains hidden or 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,83 @@ | ||
| <%# | ||
| -- 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. | ||
|
|
||
| ++# | ||
| %> | ||
|
|
||
| <%= | ||
| render(Primer::Alpha::Layout.new(stacking_breakpoint: :md, classes: "op-document-view")) do |component| | ||
| component.with_main(classes: "op-document-view--main") do | ||
| flex_layout(align_items: :center) do |flex| | ||
| flex.with_row(classes: "op-document-view--header") do | ||
| render Documents::ShowEditView::PageHeaderComponent.new(document, project:) | ||
| end | ||
|
|
||
| flex.with_row(classes: "op-document-view--editor") do | ||
| primer_form_with( | ||
| model: document, | ||
| url: document_path(document), | ||
| method: :patch, | ||
| data: { turbo: false } | ||
| ) do |form| | ||
| render Documents::BlockNoteEditorForm.new(form, oauth_token:) | ||
| end | ||
| end | ||
| end | ||
| end | ||
|
|
||
| component.with_sidebar( | ||
| row_placement: :end, | ||
| col_placement: :end, | ||
| px: 3, | ||
| classes: "op-document-view--sidebar" | ||
| ) do | ||
| render(Primer::OpenProject::SidePanel.new) do |panel| | ||
| panel.with_section do |section| | ||
| section.with_title { t(:label_attachment_plural) } | ||
|
|
||
| section.with_footer_button( | ||
| color: :accent, | ||
| id: "documents-add-attachments", | ||
| classes: "hide-when-print" | ||
| ) do |button| | ||
| button.with_leading_visual_icon(icon: "op-add-attachment") | ||
| I18n.t("js.label_add_attachments") | ||
| end | ||
|
|
||
| list_attachments( | ||
| api_v3_document_resource(document), | ||
| inputs: { | ||
| allowUploading: true, | ||
| externalUploadButton: "#documents-add-attachments" | ||
| } | ||
| ) | ||
| end | ||
| end | ||
| end | ||
| end | ||
| %> |
51 changes: 51 additions & 0 deletions
51
modules/documents/app/components/documents/show_edit_view/block_note_editor_component.rb
This file contains hidden or 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,51 @@ | ||
| # 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 Documents | ||
| module ShowEditView | ||
| class BlockNoteEditorComponent < ApplicationComponent | ||
| include AngularHelper | ||
| include AttachmentsHelper | ||
| include DocumentsHelper | ||
| include OpPrimer::ComponentHelpers | ||
|
|
||
| alias_method :document, :model | ||
|
|
||
| options :project, :oauth_token | ||
|
|
||
| private | ||
|
|
||
| def current_user | ||
| User.current | ||
| end | ||
| end | ||
| end | ||
| end |
37 changes: 37 additions & 0 deletions
37
modules/documents/app/components/documents/show_edit_view/block_note_editor_component.sass
This file contains hidden or 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 @@ | ||
| .controller-documents | ||
| @include extended-content--top | ||
| @include extended-content--bottom | ||
|
|
||
| // UNDO "the very ugly hack to make the PageHeader sticky on mobile." | ||
| @media screen and (max-width: $breakpoint-sm) | ||
| #content-body div:has(page-header), | ||
| page-header | ||
| position: static | ||
|
|
||
| // Do not offset the breadcrumbs within documents as page header is nested within main layout | ||
| #wrapper .hidden-navigation .PageHeader-contextBar | ||
| margin-left: 0 | ||
|
|
||
| .op-document-view | ||
| height: 100% | ||
|
|
||
| &--main, | ||
| &--sidebar | ||
| padding-top: var(--main-menu-toggler-top-spacing) | ||
| padding-bottom: 10px | ||
|
|
||
| &--header, | ||
| &--editor | ||
| max-width: $blocknote-max-width | ||
| width: 100% | ||
|
|
||
| &--sidebar | ||
| @media screen and (min-width: $breakpoint-md) | ||
| border-left: var(--borderWidth-thin, 1px) solid var(--borderColor-muted, var(--color-border-muted)) | ||
|
|
||
| @media screen and (min-width: $breakpoint-sm) | ||
| overflow: hidden | ||
| &--main, | ||
| &--sidebar | ||
| @include no-visible-scroll-bar | ||
| overflow: auto |
60 changes: 60 additions & 0 deletions
60
...ocuments/app/components/documents/show_edit_view/page_header/info_line_component.html.erb
This file contains hidden or 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,60 @@ | ||
| <%# | ||
| -- 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. | ||
|
|
||
| ++# | ||
| %> | ||
|
|
||
| <%= | ||
| component_wrapper do | ||
| flex_layout(tag: :div, align_items: :center, test_selector: "document-info-line") do |flex| | ||
| flex.with_column(hide: :sm, mr: 2) do | ||
| render(Primer::Alpha::ActionMenu.new(select_variant: :single)) do |menu| | ||
| menu.with_show_button do |button| | ||
| button.with_trailing_visual_icon(icon: :"triangle-down") | ||
| document.type.name | ||
| end | ||
|
|
||
| other_document_types.each do |name, id| | ||
| menu.with_item( | ||
| label: name, | ||
| href: update_type_document_path(document), | ||
| form_arguments: { | ||
| method: :put, | ||
| inputs: [{ name: "type_id", value: id }] | ||
| } | ||
| ) | ||
| end | ||
| end | ||
| end | ||
|
|
||
| flex.with_column do | ||
| last_updated_at_content | ||
| end | ||
| end | ||
| end | ||
| %> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid of global changes. How can I know that this is not going to have collateral effects somewhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for noticing and not just ignoring this @brunopagno 🙇
The change is actually from me 😅 The mixin is only used in one other place, so the impact is rather small. Due to the new way of handling PageHeaders on mobile, this is actually important and a bug we fixed 👍