Skip to content

Commit 969ce0f

Browse files
committed
Update editor layout design
1 parent 38e7296 commit 969ce0f

File tree

9 files changed

+89
-38
lines changed

9 files changed

+89
-38
lines changed

frontend/src/global_styles/openproject/_mixins.sass

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,9 @@ $scrollbar-size: 10px
222222
padding-bottom: 0
223223

224224
@mixin extended-content--top
225-
#content-body
226-
padding-top: 0
225+
@media screen and (min-width: $breakpoint-sm)
226+
#content-body
227+
padding-top: 0
227228

228229
@mixin extended-content--left
229230
#content-body,

frontend/src/react/OpBlockNoteContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export default function OpBlockNoteContainer({ inputField,
147147
attachmentsUploadUrl !== undefined &&
148148
attachmentsUploadUrl !== ''
149149
);
150-
}
150+
}
151151
const fileToIUploadFile = (file:File):IUploadFile => ({
152152
file: file
153153
});

lib/primer/open_project/forms/block_note_editor.html.erb

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1-
<%#-- copyright
2-
OpenProject is an open source project management software.
3-
Copyright (C) the OpenProject GmbH
1+
<%#
2+
-- copyright
3+
OpenProject is an open source project management software.
4+
Copyright (C) the OpenProject GmbH
45
5-
This program is free software; you can redistribute it and/or
6-
modify it under the terms of the GNU General Public License version 3.
6+
This program is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU General Public License version 3.
78
8-
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
9-
Copyright (C) 2006-2013 Jean-Philippe Lang
10-
Copyright (C) 2010-2013 the ChiliProject Team
9+
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
10+
Copyright (C) 2006-2013 Jean-Philippe Lang
11+
Copyright (C) 2010-2013 the ChiliProject Team
1112
12-
This program is free software; you can redistribute it and/or
13-
modify it under the terms of the GNU General Public License
14-
as published by the Free Software Foundation; either version 2
15-
of the License, or (at your option) any later version.
13+
This program is free software; you can redistribute it and/or
14+
modify it under the terms of the GNU General Public License
15+
as published by the Free Software Foundation; either version 2
16+
of the License, or (at your option) any later version.
1617
17-
This program is distributed in the hope that it will be useful,
18-
but WITHOUT ANY WARRANTY; without even the implied warranty of
19-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20-
GNU General Public License for more details.
18+
This program is distributed in the hope that it will be useful,
19+
but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
GNU General Public License for more details.
2122
22-
You should have received a copy of the GNU General Public License
23-
along with this program; if not, write to the Free Software
24-
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23+
You should have received a copy of the GNU General Public License
24+
along with this program; if not, write to the Free Software
25+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2526
26-
See COPYRIGHT and LICENSE files for more details.
27+
See COPYRIGHT and LICENSE files for more details.
2728
28-
++#%>
29+
++#
30+
%>
2931

3032
<%=
3133
render FormControl.new(
@@ -50,7 +52,7 @@ See COPYRIGHT and LICENSE files for more details.
5052
<%=
5153
render(
5254
Primer::BaseComponent.new(
53-
tag: :div, border: true, border_radius: 2, mt: 1, mb: 1,
55+
tag: :div, mt: 1, mb: 1,
5456
data: { block_note_target: "blockNoteEditor" }
5557
)
5658
)

modules/documents/app/assets/stylesheets/_index.sass

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
$blocknote-max-width: 800px
2+
13
.document-form--long-description
24
.ck-content
35
min-height: 30vh
@@ -12,7 +14,9 @@
1214
width: 100%
1315
> .bn-editor
1416
height: 100%
15-
max-width: 700px
17+
max-width: $blocknote-max-width
1618
min-height: 80vh
1719
overflow: auto
1820
width: 100%
21+
background-color: transparent
22+
padding-inline: 0 // No inline padding necessary given transparent background
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
@import "documents/list_component"
2+
@import "documents/show_edit_view/block_note_editor_component"

modules/documents/app/components/documents/show_edit_view/block_note_editor_component.html.erb

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,32 @@
3030
%>
3131

3232
<%=
33-
render(Primer::Alpha::Layout.new(stacking_breakpoint: :md)) do |component|
34-
component.with_main do
35-
primer_form_with(
36-
model: document,
37-
url: document_path(document),
38-
method: :patch,
39-
data: { turbo: false }
40-
) do |form|
41-
render Documents::BlockNoteEditorForm.new(form, oauth_token: @oauth_token)
33+
render(Primer::Alpha::Layout.new(stacking_breakpoint: :md, classes: "op-document-view")) do |component|
34+
component.with_main(classes: "op-document-view--main") do
35+
flex_layout do |flex|
36+
flex.with_row(mx: :auto, classes: "op-document-view--header") do
37+
render Documents::ShowEditView::PageHeaderComponent.new(document, project:)
38+
end
39+
40+
flex.with_row do
41+
primer_form_with(
42+
model: document,
43+
url: document_path(document),
44+
method: :patch,
45+
data: { turbo: false }
46+
) do |form|
47+
render Documents::BlockNoteEditorForm.new(form, oauth_token: @oauth_token)
48+
end
49+
end
4250
end
4351
end
4452

45-
component.with_sidebar(row_placement: :start, col_placement: :end) do
53+
component.with_sidebar(
54+
row_placement: :end,
55+
col_placement: :end,
56+
px: 3,
57+
classes: "op-document-view--sidebar"
58+
) do
4659
render(Primer::OpenProject::SidePanel.new) do |panel|
4760
panel.with_section do |section|
4861
section.with_title { t(:label_attachment_plural) }
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.controller-documents
2+
@include extended-content--top
3+
@include extended-content--bottom
4+
5+
.op-document-view
6+
height: 100%
7+
8+
&--main,
9+
&--sidebar
10+
padding-top: var(--main-menu-toggler-top-spacing)
11+
padding-bottom: 10px
12+
&--header
13+
max-width: $blocknote-max-width // Match the max-width of the editor below
14+
15+
&--sidebar
16+
@media screen and (min-width: $breakpoint-md)
17+
border-left: var(--borderWidth-thin, 1px) solid var(--borderColor-muted, var(--color-border-muted)) !important;
18+
19+
@media screen and (min-width: $breakpoint-sm)
20+
overflow: hidden
21+
&--main,
22+
&--sidebar
23+
overflow: auto
24+

modules/documents/app/components/documents/show_edit_view/page_header_component.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,14 @@ def action_menu_options
5151
def breadcrumbs_items
5252
[{ href: project_overview_path(project.id), text: project.name },
5353
{ href: project_documents_path(project), text: I18n.t(:label_document_plural) },
54-
document.title]
54+
document_title]
55+
end
56+
57+
# FIXME: Truncation will soon be addressed globally via: https://community.openproject.org/wp/67724
58+
def document_title
59+
render(Primer::Beta::Truncate.new) do |truncate|
60+
truncate.with_item(max_width: 200) { document.title }
61+
end
5562
end
5663

5764
def allowed_to_manage_documents?

modules/documents/app/components/documents/show_edit_view_component.html.erb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,4 @@
2929
++#
3030
%>
3131

32-
<%= render Documents::ShowEditView::PageHeaderComponent.new(document, project:) %>
3332
<%= render Documents::ShowEditView::BlockNoteEditorComponent.new(document, project:) %>

0 commit comments

Comments
 (0)