-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Feature/54733 primerise the activity panel #15643
Merged
Merged
Changes from 58 commits
Commits
Show all changes
136 commits
Select commit
Hold shift + click to select a range
0f1a49d
[#54733] Primerise the Activity panel
jjabari-op 97f28b5
introducing primerized work package activities
jjabari-op 55d67ef
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
jjabari-op 932bb52
WIP: primerizing work_package activities, editing not yet implemented…
jjabari-op 40be17c
minor cleanup
jjabari-op 46c8d5d
activate primierized activities in pullpreview env
jjabari-op bae0317
enable editing
jjabari-op 1149522
prevent edit state form being overwritten and added basic polling for…
jjabari-op ad87a56
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
jjabari-op fc5f94b
changed polling frequency to 1 minute
jjabari-op a0b5141
added comments only filter
jjabari-op 7fd2ac8
added i18n
jjabari-op cb44f59
highlight journal items with unread notification, minor refactoring
jjabari-op 435368f
changed filter component as seen on updated mockups
jjabari-op 7ad0e2f
added sorting update directly in activity tab
jjabari-op 21a7eea
implemented sticky bottom editor approach, file upload and mentions n…
jjabari-op 83a4948
group journals by day
jjabari-op 32d50a7
optimized syncing approach
jjabari-op a9e5675
implemented dynamic heights/margins of editor and journals container
jjabari-op ee3b501
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
jjabari-op 78ca627
minor adjustments towards resource injection, not restricting the edi…
jjabari-op 2da5d8b
Merge remote-tracking branch 'refs/remotes/origin/feature/54733-prime…
jjabari-op 7ae79e8
support mentions and uploads based on feedback from @oliverguenther
jjabari-op 971bcd4
added quoting
jjabari-op 222d309
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
jjabari-op 66fca73
fixed sass imports
jjabari-op dc350dd
fixed bg colors of inputs
jjabari-op a1a2577
close editor on blur and keep editor open after submit for a more cha…
jjabari-op 0c127d9
fixed blur event listener
jjabari-op d2ade88
decreased timeout as much as possible
jjabari-op ce38f76
fixed rendering after sorting update
jjabari-op d7bd52b
mobile adjustments following iteration made for the mobile concept
jjabari-op e3e80c2
adjusted max height of editor as requested and fixed margin adjustment
jjabari-op 9a855c5
decreased polling interval as requested by @wielinde, optimization ba…
jjabari-op b3754c5
fixed paddings
jjabari-op ec8367c
optimized polling approach in order to avoid unnecessary requests
jjabari-op 8b4b138
avoid editor data loss on tab change or other browser events unmounti…
jjabari-op 66bab81
implemented github PR style
jjabari-op 674ffae
fixed detail update streams
jjabari-op b09c50d
fixed filter behavior
jjabari-op 0c48308
quickly adjusted font rendering of detail descriptions, refactoring r…
jjabari-op 0e005be
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
jjabari-op f8915bf
added first specs for primerized workpackage activities
jjabari-op eb4ac8f
implemented feedback from product team and adjusted micro behaviors, …
jjabari-op 9b3a08a
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
jjabari-op 9521a2c
fixed bottom detection for md viewports
jjabari-op 8b138e8
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
jjabari-op 0f276c7
implemented feedback from product team, finalized new specs, cleanup,…
jjabari-op c9b011e
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
jjabari-op 8c4811c
cleanup temp test code
jjabari-op 228f95a
fixing eslint issues
jjabari-op 1288435
enable primerized workpackages feature flag in ci
jjabari-op 2717246
reenabled and fixed failing spec
jjabari-op 87ec0da
refactored to resolve rubocop issues
jjabari-op 75a358f
more refactorings to resolve rubocop issues
jjabari-op d5ca1a5
fixed ckeditor bottom margin
jjabari-op 6759bd9
hide stem connection when empty
jjabari-op 64c6494
refactored and fixed stem behaviour for filter states
jjabari-op 47ae87f
auto-reset filter when adding a comment which would not be visible, m…
jjabari-op 66014cd
text adjustments as requested by Parimal
jjabari-op 077593f
fixed margin bottom for desc sorting
jjabari-op 205af10
fixed permissions, handle permissions on UI, added permission specs
jjabari-op 9f121c8
added and refactore permission specs
jjabari-op aa79dee
WIP: adding controller spec and exception handling
jjabari-op 045aabd
added exception handling and controller specs
jjabari-op 3d22248
refactored CSS and applied BEM notations
jjabari-op ed653df
fixed specs after refactoring
jjabari-op 7243d3a
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
jjabari-op d308500
fixed stem for filter states
jjabari-op bca765c
mobile UX fixes
jjabari-op 9ebdc7e
temporarly removed meta data as its consuming too much width with lon…
jjabari-op f203d9a
ckeditor fixes due to more toolbar items, open editor when dragover, …
jjabari-op 518dbe7
fixed positioning issues caused by anchor scrolls via url and click o…
jjabari-op 27e5956
added support for retracted journal entries
jjabari-op db65e97
disabling some rubocop checks as the permission specs seem not to fol…
jjabari-op a609070
WIP: implementing review feedback from @oliverguenther
jjabari-op 867aebc
make ckeditor primer adjustments reusable following input from @olive…
jjabari-op 2c3cf42
WIP implementing review feedback from Oliver
jjabari-op 9ef7760
added generic error handling for initial and subsequent requests
jjabari-op 0481ed3
moved ckeditor code as requested by @oliverguenther
jjabari-op fc45e41
js refactoring as requested by @oliverguenther
jjabari-op 4cc43ff
extended permission controller specs
jjabari-op a86e4b9
rubocop fixes
jjabari-op cfd4a13
styling fixes
jjabari-op 52d8fcf
fixed specs, eslint errors and prevent multi form submission
jjabari-op 657590a
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
jjabari-op 0a7537a
fixed flaky specs
jjabari-op 8329d1b
fixed flaky specs and styling fixes
jjabari-op 73a87f8
refactored http request as requested by @oliverguenther
jjabari-op 7663f2c
note future required code maintenance on js based view port checks
jjabari-op de14988
fix stem rendering as requested by @psatyal
jjabari-op 72d4a3f
adjusted notification dot color as requested by @psatyal
jjabari-op 7f5f1f8
fixed scrolling behaviour on mobile screens
jjabari-op 97656e0
restrict polling interval env to test env
jjabari-op 541cbaa
fixed ellipsis
jjabari-op 352e4b7
trying to avoid flaky spec
jjabari-op 9c5bf53
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
jjabari-op 6082e6d
trying to fix flaky spec through a more dynamic waiting approach
jjabari-op 274faed
removed obsolete sleeps
jjabari-op deaef80
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
jjabari-op b575b02
fixing auto-scrollings due to content wrapper changes resolving ancho…
jjabari-op 6107dcd
only perform scrolling when really required
jjabari-op 2f9c64e
fixed eslint error
jjabari-op ca0e80f
update workpackage attributes on main workpackage section when change…
jjabari-op 2f05a53
fixed attachement links in changesets
jjabari-op f087bf7
added missing labels and aria-labels, adjusted username width in orde…
jjabari-op 65e0211
fixed stem styling
jjabari-op 4890d01
rename sorting labels as requested
jjabari-op 453a2a7
removed latest activties from overview tab as requested by @wielinde …
jjabari-op ecfdb39
update the count in the primerized activty tab header when new activi…
jjabari-op 6757eba
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
jjabari-op 66aa229
prototypical implementation of the toggle singel notifications featur…
jjabari-op a5a17ba
prototypical changes to the notification center and its behaviour whe…
jjabari-op 86efb41
decrease polling interval via env var for pullpreview
jjabari-op 0f60704
Revert "prototypical implementation of the toggle singel notification…
jjabari-op f1b6620
reverted browser notification experiment
jjabari-op 54b0ca0
not using a flash message anymore as decided with product team, workp…
jjabari-op 81e8c83
adjusted notification bubble color in favicon as requested
jjabari-op 9668e6b
cleanup
jjabari-op 5efae3d
enable immediate notification center and bell update through ianCente…
jjabari-op c570df7
display labels as requested
jjabari-op ec33bc0
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
jjabari-op 69551f0
put changes in notification center behind feature flag as well
jjabari-op 10c1ed1
fixed too short ellipsis
jjabari-op 75afa65
trying to fix flaky spec
jjabari-op c80efd4
fix eslint issues on CI
jjabari-op aaf47f5
fix rubocop issues on CI
jjabari-op 6b8aa9c
fix scroll behavior on mobile
jjabari-op 990c4bd
reapplied refactoring previously reverted
jjabari-op 52beb63
Merge branch 'dev' into feature/54733-primerise-the-activity-panel
akabiru f5d0e8d
chore[Op#54733]: add missing newlines
akabiru c1575f3
fix[Op#54733]: restore old concept to bind to `notificationCountIncre…
akabiru dc24573
chore[Op#54733]: extract feature flag check to function
akabiru 651c3e8
chore[Op#54733]: remove red dot favicon- out of scope
akabiru 9c1d601
chore[Op#54733]: remove leftover var
akabiru 26ba6cb
chore[Op#54733]: resolve eslint missing comma
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 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
44 changes: 44 additions & 0 deletions
44
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,44 @@ | ||
<%= | ||
content_tag("turbo-frame", id: "work-package-activities-tab-content") 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( | ||
id: "journals-container", | ||
classes: "with-initial-input-compensation", | ||
akabiru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
data: { "work-packages--activities-tab--index-target": "journalsContainer" } | ||
) do | ||
render( | ||
WorkPackages::ActivitiesTab::Journals::IndexComponent.new(work_package:, filter:) | ||
) | ||
end | ||
journals_wrapper_container.with_row( | ||
id: "input-container", | ||
classes: "sort-#{journal_sorting}", # css order attribute will take care of correct position | ||
akabiru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
%> |
74 changes: 74 additions & 0 deletions
74
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,74 @@ | ||
# 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 # protoypical implementation | ||
} | ||
end | ||
|
||
def journal_sorting | ||
User.current.preference&.comments_sorting || "desc" | ||
end | ||
|
||
def polling_interval | ||
ENV["WORK_PACKAGES_ACTIVITIES_TAB_POLLING_INTERVAL_IN_MS"] || 10000 | ||
akabiru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
end | ||
end | ||
end | ||
end |
34 changes: 34 additions & 0 deletions
34
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,34 @@ | ||
#work-packages-activities-tab-index-component | ||
#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 | ||
#stem-connection | ||
@media screen and (min-width: $breakpoint-xl) | ||
position: absolute | ||
z-index: 9 | ||
border-left: var(--borderWidth-thin, 1px) solid var(--borderColor-default) | ||
margin-left: 19px | ||
margin-top: 20px | ||
height: 100vh | ||
@media screen and (max-width: $breakpoint-xl) | ||
display: none | ||
#input-container | ||
z-index: 10 | ||
@media screen and (min-width: $breakpoint-xl) | ||
position: absolute | ||
min-height: 60px | ||
bottom: 0 | ||
left: 0 | ||
right: 0 | ||
@media screen and (max-width: $breakpoint-xl) | ||
&.sort-desc | ||
order: -1 | ||
akabiru marked this conversation as resolved.
Show resolved
Hide resolved
|
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 |
75 changes: 75 additions & 0 deletions
75
app/components/work_packages/activities_tab/journals/filter_and_sorting_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,75 @@ | ||
<%= | ||
component_wrapper do | ||
|
||
flex_layout(justify_content: :space_between) do |container| | ||
container.with_column do | ||
render(Primer::Alpha::ActionMenu.new( | ||
select_variant: :single, dynamic_label: true, | ||
data: { "test_selector": "op-wp-journals-filter-menu" } | ||
)) do |menu| | ||
menu.with_show_button do |button| | ||
button.with_trailing_action_icon(icon: :"triangle-down") | ||
end | ||
menu.with_item( | ||
label: t("activities.work_packages.activity_tab.label_activity_show_all"), | ||
href: update_filter_work_package_activities_path(work_package), | ||
content_arguments: { | ||
data: { | ||
"turbo-stream": true, "action": "click->work-packages--activities-tab--index#unsetFilter", | ||
"test_selector": "op-wp-journals-filter-show-all" | ||
} | ||
}, | ||
active: show_all? | ||
) | ||
menu.with_item( | ||
label: t("activities.work_packages.activity_tab.label_activity_show_only_changes"), | ||
href: update_filter_work_package_activities_path(work_package, filter: :only_changes), | ||
content_arguments: { | ||
data: { | ||
"turbo-stream": true, "action": "click->work-packages--activities-tab--index#setFilterToOnlyChanges", | ||
"test_selector": "op-wp-journals-filter-show-only-changes" | ||
} | ||
}, | ||
active: show_only_changes? | ||
) | ||
menu.with_item( | ||
label: t("activities.work_packages.activity_tab.label_activity_show_only_comments"), | ||
href: update_filter_work_package_activities_path(work_package, filter: :only_comments), | ||
content_arguments: { | ||
data: { | ||
"turbo-stream": true, "action": "click->work-packages--activities-tab--index#setFilterToOnlyComments", | ||
"test_selector": "op-wp-journals-filter-show-only-comments" | ||
} | ||
}, | ||
active: show_only_comments? | ||
) | ||
end | ||
end | ||
container.with_column do | ||
render(Primer::Alpha::ActionMenu.new(select_variant: :single, dynamic_label: true)) do |menu| | ||
menu.with_show_button(scheme: :invisible, data: { "test_selector": "op-wp-journals-sorting-menu" }) do |button| | ||
button.with_trailing_action_icon(icon: :"triangle-down") | ||
end | ||
menu.with_item( | ||
label: t("activities.work_packages.activity_tab.label_sort_desc"), | ||
href: update_sorting_work_package_activities_path(work_package, sorting: :desc, filter:), | ||
form_arguments: { method: :put }, | ||
content_arguments: { | ||
data: { "turbo-stream": true, "test_selector": "op-wp-journals-sorting-desc" } | ||
}, | ||
active: desc_sorting? | ||
) | ||
menu.with_item( | ||
label: t("activities.work_packages.activity_tab.label_sort_asc"), | ||
href: update_sorting_work_package_activities_path(work_package, sorting: :asc, filter:), | ||
form_arguments: { method: :put }, | ||
content_arguments: { | ||
data: { "turbo-stream": true, "test_selector": "op-wp-journals-sorting-asc" } | ||
}, | ||
active: asc_sorting? | ||
) | ||
end | ||
end | ||
end | ||
end | ||
%> |
76 changes: 76 additions & 0 deletions
76
app/components/work_packages/activities_tab/journals/filter_and_sorting_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,76 @@ | ||
# 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 FilterAndSortingComponent < 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 show_all? | ||
filter == :all | ||
end | ||
|
||
def show_only_comments? | ||
filter == :only_comments | ||
end | ||
|
||
def show_only_changes? | ||
filter == :only_changes | ||
end | ||
|
||
def journal_sorting | ||
User.current.preference&.comments_sorting || "desc" | ||
end | ||
|
||
def desc_sorting? | ||
journal_sorting == "desc" | ||
end | ||
|
||
def asc_sorting? | ||
journal_sorting == "asc" | ||
end | ||
end | ||
end | ||
end | ||
end |
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.
Why is there turbo-frame and component_wrapper? Couldn't you use component_wrapper(tag: "turbo-frame") ?
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.
No, otherwise the turbo-STREAM update of this component would include a turbo-FRAME