-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15643 from opf/feature/54733-primerise-the-activi…
…ty-panel Feature/54733 primerise the activity panel
- Loading branch information
Showing
67 changed files
with
4,797 additions
and
20 deletions.
There are no files selected for viewing
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
7 changes: 7 additions & 0 deletions
7
app/components/work_packages/activities_tab/error_frame_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,7 @@ | ||
<%= | ||
content_tag("turbo-frame", id: "work-package-activities-tab-content") do | ||
unless error_message.blank? | ||
render(Primer::Alpha::Banner.new(scheme: :danger)) { error_message } | ||
end | ||
end | ||
%> |
46 changes: 46 additions & 0 deletions
46
app/components/work_packages/activities_tab/error_frame_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,46 @@ | ||
# frozen_string_literal: true | ||
|
||
# -- copyright | ||
# OpenProject is an open source project management software. | ||
# Copyright (C) 2023 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 ActivitiesTab | ||
class ErrorFrameComponent < ApplicationComponent | ||
include ApplicationHelper | ||
include OpPrimer::ComponentHelpers | ||
|
||
def initialize(error_message: nil) | ||
super | ||
|
||
@error_message = error_message | ||
end | ||
|
||
attr_reader :error_message | ||
end | ||
end | ||
end |
7 changes: 7 additions & 0 deletions
7
app/components/work_packages/activities_tab/error_stream_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,7 @@ | ||
<%= | ||
component_wrapper do | ||
unless error_message.blank? | ||
render(Primer::Alpha::Banner.new(scheme: :danger, dismiss_scheme: :hide)) { error_message } | ||
end | ||
end | ||
%> |
47 changes: 47 additions & 0 deletions
47
app/components/work_packages/activities_tab/error_stream_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,47 @@ | ||
# frozen_string_literal: true | ||
|
||
# -- copyright | ||
# OpenProject is an open source project management software. | ||
# Copyright (C) 2023 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 ActivitiesTab | ||
class ErrorStreamComponent < ApplicationComponent | ||
include ApplicationHelper | ||
include OpPrimer::ComponentHelpers | ||
include OpTurbo::Streamable | ||
|
||
def initialize(error_message: nil) | ||
super | ||
|
||
@error_message = error_message | ||
end | ||
|
||
attr_reader :error_message | ||
end | ||
end | ||
end |
53 changes: 53 additions & 0 deletions
53
app/components/work_packages/activities_tab/index_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,53 @@ | ||
<%= | ||
content_tag("turbo-frame", id: "work-package-activities-tab-content") do | ||
flex_layout(classes: "work-packages-activities-tab-index-component") do |activties_tab_wrapper_container| | ||
activties_tab_wrapper_container.with_row(classes: "work-packages-activities-tab-index-component--errors") do | ||
render( | ||
WorkPackages::ActivitiesTab::ErrorStreamComponent.new | ||
) | ||
end | ||
activties_tab_wrapper_container.with_row do | ||
component_wrapper(data: wrapper_data_attributes) do | ||
flex_layout do |activties_tab_container| | ||
activties_tab_container.with_row(mb: 2) do | ||
render( | ||
WorkPackages::ActivitiesTab::Journals::FilterAndSortingComponent.new( | ||
work_package:, | ||
filter: | ||
) | ||
) | ||
end | ||
activties_tab_container.with_row(flex_layout: true, mt: 3) do |journals_wrapper_container| | ||
journals_wrapper_container.with_row( | ||
classes: "work-packages-activities-tab-index-component--journals-container work-packages-activities-tab-index-component--journals-container_with-initial-input-compensation", | ||
data: { "work-packages--activities-tab--index-target": "journalsContainer" } | ||
) do | ||
render( | ||
WorkPackages::ActivitiesTab::Journals::IndexComponent.new(work_package:, filter:) | ||
) | ||
end | ||
if adding_comment_allowed? | ||
journals_wrapper_container.with_row( | ||
classes: "work-packages-activities-tab-index-component--input-container work-packages-activities-tab-index-component--input-container_sort-#{journal_sorting}", | ||
mt: 3, | ||
mb: [3, nil, nil, nil, 0], | ||
pt: 2, | ||
pb: 2, | ||
pl: 3, | ||
pr: [3, nil, nil, nil, 2], | ||
border: [nil, nil, nil, nil, :top], | ||
border_radius: [2, nil, nil, nil, 0], | ||
bg: :subtle | ||
) do | ||
render( | ||
WorkPackages::ActivitiesTab::Journals::NewComponent.new(work_package:) | ||
) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
%> |
84 changes: 84 additions & 0 deletions
84
app/components/work_packages/activities_tab/index_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,84 @@ | ||
# frozen_string_literal: true | ||
|
||
# -- copyright | ||
# OpenProject is an open source project management software. | ||
# Copyright (C) 2023 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 ActivitiesTab | ||
class IndexComponent < ApplicationComponent | ||
include ApplicationHelper | ||
include OpPrimer::ComponentHelpers | ||
include OpTurbo::Streamable | ||
|
||
def initialize(work_package:, filter: :all) | ||
super | ||
|
||
@work_package = work_package | ||
@filter = filter | ||
end | ||
|
||
private | ||
|
||
attr_reader :work_package, :filter | ||
|
||
def wrapper_data_attributes | ||
{ | ||
test_selector: "op-wp-activity-tab", | ||
controller: "work-packages--activities-tab--index", | ||
"application-target": "dynamic", | ||
"work-packages--activities-tab--index-update-streams-url-value": update_streams_work_package_activities_url( | ||
work_package | ||
), | ||
"work-packages--activities-tab--index-sorting-value": journal_sorting, | ||
"work-packages--activities-tab--index-filter-value": filter, | ||
"work-packages--activities-tab--index-user-id-value": User.current.id, | ||
"work-packages--activities-tab--index-work-package-id-value": work_package.id, | ||
"work-packages--activities-tab--index-polling-interval-in-ms-value": polling_interval, | ||
"work-packages--activities-tab--index-notification-center-path-name-value": notifications_path | ||
} | ||
end | ||
|
||
def journal_sorting | ||
User.current.preference&.comments_sorting || "desc" | ||
end | ||
|
||
def polling_interval | ||
# Polling interval should only be adjustable in test environment | ||
if Rails.env.test? | ||
ENV["WORK_PACKAGES_ACTIVITIES_TAB_POLLING_INTERVAL_IN_MS"].presence || 10000 | ||
else | ||
10000 | ||
end | ||
end | ||
|
||
def adding_comment_allowed? | ||
User.current.allowed_in_project?(:add_work_package_notes, @work_package.project) | ||
end | ||
end | ||
end | ||
end |
36 changes: 36 additions & 0 deletions
36
app/components/work_packages/activities_tab/index_component.sass
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,36 @@ | ||
.work-packages-activities-tab-index-component | ||
&--errors | ||
position: absolute | ||
width: calc(100% - 22px) | ||
z-index: 11 | ||
@media screen and (max-width: $breakpoint-xl) | ||
position: fixed | ||
bottom: 20px | ||
width: calc(100% - 30px) | ||
&--journals-container | ||
z-index: 10 | ||
padding-top: 3px | ||
overflow-y: auto | ||
|
||
&_with-initial-input-compensation | ||
margin-bottom: 65px // initial margin-bottom, will be increased by stimulus when opening ckeditor | ||
@media screen and (max-width: $breakpoint-xl) | ||
margin-bottom: -16px | ||
|
||
&_with-input-compensation | ||
margin-bottom: 180px | ||
@media screen and (max-width: $breakpoint-xl) | ||
margin-bottom: -16px | ||
|
||
&--input-container | ||
z-index: 10 | ||
@media screen and (min-width: $breakpoint-xl) | ||
position: absolute | ||
min-height: 60px | ||
bottom: 0 | ||
left: 0 | ||
right: 0 | ||
|
||
&_sort-desc | ||
@media screen and (max-width: $breakpoint-xl) | ||
order: -1 |
11 changes: 11 additions & 0 deletions
11
app/components/work_packages/activities_tab/journals/empty_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,11 @@ | ||
<%= | ||
component_wrapper do | ||
render(Primer::Beta::Blankslate.new( | ||
border: true, | ||
data: { test_selector: "op-wp-journals-container-empty"})) do |component| | ||
component.with_visual_icon(icon: :pulse) | ||
component.with_heading(tag: :h2).with_content(t("activities.work_packages.activity_tab.no_results_title_text")) | ||
component.with_description { t("activities.work_packages.activity_tab.no_results_description_text") } | ||
end | ||
end | ||
%> |
41 changes: 41 additions & 0 deletions
41
app/components/work_packages/activities_tab/journals/empty_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,41 @@ | ||
# frozen_string_literal: true | ||
|
||
# -- copyright | ||
# OpenProject is an open source project management software. | ||
# Copyright (C) 2023 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 ActivitiesTab | ||
module Journals | ||
class EmptyComponent < ApplicationComponent | ||
include ApplicationHelper | ||
include OpPrimer::ComponentHelpers | ||
include OpTurbo::Streamable | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.