Skip to content
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

Meetings module adjustments #14086

Merged
merged 52 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
539b385
Remove the words Added by from agenda item
bsatarnejad Nov 3, 2023
406126f
remove dot after author name
bsatarnejad Nov 3, 2023
5136159
Remove the words Added by from agenda item
bsatarnejad Nov 3, 2023
a93c78c
remove dot after author name
bsatarnejad Nov 3, 2023
eba2ab5
Merge branch 'meetings-module-adjustments' of github.com:opf/openproj…
bsatarnejad Nov 6, 2023
43263d9
hide item actions when meeting is closed
bsatarnejad Nov 6, 2023
d54aefe
Remove the words Added by from agenda item
bsatarnejad Nov 3, 2023
7ed5cf5
remove dot after author name
bsatarnejad Nov 3, 2023
679bbbc
hide item actions when meeting is closed
bsatarnejad Nov 6, 2023
5856348
reduce width of duration field
bsatarnejad Nov 7, 2023
841c794
Merge branch 'meetings-module-adjustments' of github.com:opf/openproj…
bsatarnejad Nov 7, 2023
c8d8fe2
add add notes button to actions of agenda item
bsatarnejad Nov 8, 2023
7d175ff
fix focus on ckeditor when adding note
bsatarnejad Nov 8, 2023
e076524
move show/hide button to the bottom
bsatarnejad Nov 8, 2023
0987bd3
Remove the words Added by from agenda item
bsatarnejad Nov 3, 2023
909ce25
remove dot after author name
bsatarnejad Nov 3, 2023
62abff8
hide item actions when meeting is closed
bsatarnejad Nov 6, 2023
26fa18c
reduce width of duration field
bsatarnejad Nov 7, 2023
a08bb0d
add add notes button to actions of agenda item
bsatarnejad Nov 8, 2023
6b3692f
fix focus on ckeditor when adding note
bsatarnejad Nov 8, 2023
6ad05f1
move show/hide button to the bottom
bsatarnejad Nov 8, 2023
dd6fef3
The Meeting details section should be at the top (before agenda items)
bsatarnejad Nov 9, 2023
96d2eba
shorten the meeting status part
bsatarnejad Nov 9, 2023
2f8abfc
Merge branch 'meetings-module-adjustments' of github.com:opf/openproj…
bsatarnejad Nov 9, 2023
00f1d11
remove participants in mobile mode and show them in details part
bsatarnejad Nov 9, 2023
ca149d7
Remove the words Added by from agenda item
bsatarnejad Nov 3, 2023
02701d3
remove dot after author name
bsatarnejad Nov 3, 2023
2c9f21b
hide item actions when meeting is closed
bsatarnejad Nov 6, 2023
da51d47
reduce width of duration field
bsatarnejad Nov 7, 2023
a74f931
add add notes button to actions of agenda item
bsatarnejad Nov 8, 2023
926e492
fix focus on ckeditor when adding note
bsatarnejad Nov 8, 2023
b523780
move show/hide button to the bottom
bsatarnejad Nov 8, 2023
1da4496
The Meeting details section should be at the top (before agenda items)
bsatarnejad Nov 9, 2023
625b434
shorten the meeting status part
bsatarnejad Nov 9, 2023
0489328
remove participants in mobile mode and show them in details part
bsatarnejad Nov 9, 2023
a68d3f9
use participants component in details component
bsatarnejad Nov 13, 2023
6443cfe
Merge branch 'meetings-module-adjustments' of github.com:opf/openproj…
bsatarnejad Nov 13, 2023
a7a3454
fix merge error
bsatarnejad Nov 13, 2023
db0dde4
change margin top value for hidden participants
bsatarnejad Nov 13, 2023
d4054f2
remove duplicated code and unnecessary files
bsatarnejad Nov 13, 2023
7430dfe
use system argument instead of custom classes
bsatarnejad Nov 13, 2023
fb4731d
change class name for changing template of closed meeting
bsatarnejad Nov 13, 2023
51e5f81
remove unnecessary identifier for closed meeting
bsatarnejad Nov 13, 2023
9dd8047
Merge branch dev into meetings-module-adjustments
bsatarnejad Nov 13, 2023
4a5e355
Merge branch 'dev' into meetings-module-adjustments
bsatarnejad Nov 14, 2023
beb4df1
fix failing feature test
bsatarnejad Nov 14, 2023
af1dfad
remove participant component from details component
bsatarnejad Nov 14, 2023
047c824
undo changes to show participants inline
bsatarnejad Nov 14, 2023
43a0277
remove unnecessary methods and strings
bsatarnejad Nov 14, 2023
625653b
Merge branch 'dev' into meetings-module-adjustments
bsatarnejad Nov 15, 2023
56963e7
fix unit test error
bsatarnejad Nov 15, 2023
a2e52e8
Merge branch 'meetings-module-adjustments' of github.com:opf/openproj…
bsatarnejad Nov 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ export default class extends Controller {

setTimeout(() => {
this.element.scrollIntoView({ block: 'center' });
if (titleInput) {
if (window.getComputedStyle(this.notesInputTarget).display !== 'none') {
this.focusCkEditor();
} else if (titleInput) {
(titleInput as HTMLInputElement).focus();
}
}, 100);
Expand All @@ -76,6 +78,10 @@ export default class extends Controller {
addNotes() {
this.notesInputTarget.classList.remove('d-none');
this.notesAddButtonTarget.classList.add('d-none');
this.focusCkEditor();
}

private focusCkEditor() {
setTimeout(() => {
const ckContent = this.element.querySelector<HTMLElement>('.ck-content');
if (ckContent) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* -- 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.
* ++
*/

import { Controller } from '@hotwired/stimulus';

export default class MeetingsSidebarParticipantsController extends Controller {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is literally the same code as the MeetingsSidebarDetailsController just with a different name. Please avoid that dubplication and use the same controller for the same logic.

static targets = ['showHideButton', 'hiddenParticipants'];
declare readonly showHideButtonTarget:HTMLInputElement;
declare readonly hiddenParticipantsTarget:HTMLElement;

showHiddenParticipants():void {
if (this.hiddenParticipantsTarget.classList.contains('d-none')) {
this.hiddenParticipantsTarget.classList.remove('d-none');
} else {
this.hiddenParticipantsTarget.classList.add('d-none');
}
}
}
1 change: 1 addition & 0 deletions modules/meeting/app/components/_index.sass
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@import "./meeting_agenda_items/item_component/show_component.sass"
@import "./meeting_agenda_items/form_component.sass"
@import "./meetings/sidebar/state_component.sass"
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class FormComponent < ApplicationComponent
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers

def initialize(meeting:, meeting_agenda_item:, method:, submit_path:, cancel_path:, type: :simple)
def initialize(meeting:, meeting_agenda_item:, method:, submit_path:, cancel_path:, type: :simple, display_notes_input: nil)
super

@meeting = meeting
Expand All @@ -41,6 +41,7 @@ def initialize(meeting:, meeting_agenda_item:, method:, submit_path:, cancel_pat
@submit_path = submit_path
@cancel_path = cancel_path
@type = type
@display_notes_input = display_notes_input
end

def wrapper_uniq_by
Expand All @@ -62,11 +63,23 @@ def wrapper_data_attributes
end

def display_notes_input_value
@meeting_agenda_item.notes.blank? ? :none : nil
if @display_notes_input
:block
elsif @meeting_agenda_item.notes.blank?
:none
else
:block
end
end

def display_notes_add_button_value
@meeting_agenda_item.notes.blank? ? nil : :none
if @display_notes_input
:none
elsif @meeting_agenda_item.notes.blank?
:block
else
:none
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.op-meeting-agenda-item-form
display: grid
grid-template-columns: 1fr 180px
grid-template-columns: 1fr 140px
grid-template-areas: "title duration" "notes notes" "add_note actions"
grid-gap: 8px

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ class ItemComponent < ApplicationComponent

with_collection_parameter :meeting_agenda_item

def initialize(meeting_agenda_item:, state: :show, container: nil)
def initialize(meeting_agenda_item:, state: :show, container: nil, display_notes_input: nil)
super

@meeting_agenda_item = meeting_agenda_item
@state = state
@display_notes_input = display_notes_input
@container = container
end

Expand All @@ -63,8 +64,9 @@ def call

def child_component_params
{
meeting_agenda_item: @meeting_agenda_item
}
meeting_agenda_item: @meeting_agenda_item,
display_notes_input: (@display_notes_input if @state == :edit)
}.compact
end

def wrapper_arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ class ItemComponent::EditComponent < ApplicationComponent
include ApplicationHelper
include OpPrimer::ComponentHelpers

def initialize(meeting_agenda_item:)
def initialize(meeting_agenda_item:, display_notes_input: nil)
super

@meeting_agenda_item = meeting_agenda_item
@display_notes_input = display_notes_input
@type = if @meeting_agenda_item.work_package.present?
:work_package
else
Expand All @@ -50,7 +51,8 @@ def call
method: :put,
submit_path: meeting_agenda_item_path(@meeting_agenda_item.meeting, @meeting_agenda_item, format: :turbo_stream),
cancel_path: cancel_edit_meeting_agenda_item_path(@meeting_agenda_item.meeting, @meeting_agenda_item),
type: @type
type: @type,
display_notes_input: @display_notes_input
))
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,15 @@
end
end

grid.with_area(:actions, tag: :div, justify_self: :end) do
render(Primer::Alpha::ActionMenu.new) do |menu|
menu.with_show_button(icon: "kebab-horizontal", 'aria-label': t("label_agenda_item_actions"), scheme: :invisible, test_selector: 'op-meeting-agenda-actions')
edit_action_item(menu) if @meeting_agenda_item.editable?
move_actions(menu)
delete_action_item(menu)
end if edit_enabled?
end
grid.with_area(:actions, tag: :div, justify_self: :end) do
render(Primer::Alpha::ActionMenu.new) do |menu|
menu.with_show_button(icon: "kebab-horizontal", 'aria-label': t("label_agenda_item_actions"), scheme: :invisible, test_selector: 'op-meeting-agenda-actions')
edit_action_item(menu) if @meeting_agenda_item.editable?
add_note_action_item(menu) if @meeting_agenda_item.editable?
move_actions(menu)
delete_action_item(menu)
end if edit_enabled?
end

grid.with_area(:notes, tag: :div) do
if @meeting_agenda_item.notes.present?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def edit_enabled?
@meeting.open? && User.current.allowed_in_project?(:manage_agendas, @meeting.project)
end

def meeting_closed?
!@meeting.open?
end
def edit_action_item(menu)
menu.with_item(label: t("label_edit"),
href: edit_meeting_agenda_item_path(@meeting_agenda_item.meeting, @meeting_agenda_item),
Expand All @@ -64,6 +67,16 @@ def edit_action_item(menu)
end
end

def add_note_action_item(menu)
menu.with_item(label: t("label_agenda_item_add_notes"),
href: edit_meeting_agenda_item_path(@meeting_agenda_item.meeting, @meeting_agenda_item, display_notes_input: true),
content_arguments: {
data: { 'turbo-stream': true }
}) do |item|
item.with_leading_visual_icon(icon: :note)
end
end

def move_actions(menu)
move_action_item(menu, :highest, t("label_agenda_item_move_to_top"), "move-to-top") unless @meeting_agenda_item.first?
move_action_item(menu, :higher, t("label_agenda_item_move_up"), "chevron-up") unless @meeting_agenda_item.first?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $meeting-agenda-item--author-width: 300px

.op-meeting-agenda-item
display: grid
grid-template-columns: 20px auto 1fr minmax(auto, $meeting-agenda-item--author-width) 40px
grid-template-columns: 20px auto 1fr minmax(auto, $meeting-agenda-item--author-width) fit-content(40px)
grid-template-areas: "drag-handle content duration author actions" ". notes notes notes notes"

&--drag-handle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def initialize(meeting:, state: :show)
def render_author_link
render(Primer::Beta::Link.new(font_size: :small, href: user_path(@meeting.author), underline: false,
target: "_blank")) do
"#{@meeting.author.name}."
"#{@meeting.author.name}"
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end

show_page.with_row do
render(Primer::Alpha::Layout.new(stacking_breakpoint: :lg)) do |content|
render(Primer::Alpha::Layout.new(stacking_breakpoint: :sm)) do |content|
content.with_main do
flex_layout do |agenda|
agenda.with_row do
Expand All @@ -25,7 +25,7 @@
end
end

content.with_sidebar(row_placement: :end, col_placement: :end, width: :wide) do
content.with_sidebar(row_placement: :start, col_placement: :end, width: :wide) do
render(Meetings::SidebarComponent.new(meeting: @meeting))
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def render_truncated_location
end
end
end

def render_meeting_attribute_row(icon, &)
flex_layout(align_items: :center, justify_content: :space_between) do |flex|
flex.with_column do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%=
component_wrapper do
component_wrapper(data: wrapper_data_attributes) do
flex_layout do |participants_container|
participants_container.with_row do
flex_layout(align_items: :center, justify_content: :space_between) do |heading|
Expand Down Expand Up @@ -48,28 +48,25 @@
end
end

list.with_row(mt: 2) do
render Primer::Beta::Details.new do |hidden_details|
flex_layout do |flex|
flex.with_row do
hidden_details.with_summary(size: :small, scheme: :link) do
t('label_meeting_show_hide_participants',
count: @meeting.invited_or_attended_participants.count - MAX_SHOWN_PARTICIPANTS).to_s
end
end

flex.with_row do
hidden_details.with_body do
flex_layout do |hidden_user_list|
@meeting.invited_or_attended_participants.sort[MAX_SHOWN_PARTICIPANTS..].each do |participant|
hidden_user_list.with_row(mt: 1) do
render_participant(participant)
end
end
list.with_row do
flex_layout do |flex|
flex.with_row(display: :none, data: { 'meetings-sidebar-participants-target': "hiddenParticipants" }) do
flex_layout do |hidden_user_list|
@meeting.invited_or_attended_participants.sort[MAX_SHOWN_PARTICIPANTS..].each do |participant|
hidden_user_list.with_row(mt: 1) do
render_participant(participant)
end
end
end
end
flex.with_row(mt: 1) do
render (Primer::Beta::Button.new(
scheme: :invisible,
data: { 'meetings-sidebar-participants-target': "showHideButton",
action: 'click->meetings-sidebar-participants#showHiddenParticipants keydown.enter->meetings-sidebar-participants#showHiddenParticipants'
}
)) { I18n.t('label_meeting_show_hide_participants', count: @meeting.invited_or_attended_participants.count - MAX_SHOWN_PARTICIPANTS) }
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ class Sidebar::ParticipantsComponent < ApplicationComponent

MAX_SHOWN_PARTICIPANTS = 5

def wrapper_data_attributes
{
controller: 'meetings-sidebar-participants',
'application-target': 'dynamic'
}
end

def initialize(meeting:)
super

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
component_wrapper do
case @meeting.state
when "open"
flex_layout do |open_state|
flex_layout(classes: 'op-meeting-sidebar-state') do |open_state|
open_state.with_row do
render(Primer::Beta::State.new(title: "state", scheme: :open)) do
flex_layout do |open_state_label|
Expand All @@ -17,14 +17,14 @@
end
end

open_state.with_row(mt: 3) do
open_state.with_row(mt: 3, classes:'hidden-for-mobile') do
render(Primer::Beta::Text.new(color: :subtle)) do
t("text_meeting_open_description")
end
end

if edit_enabled?
open_state.with_row(mt: 3) do
open_state.with_row(mt: [0, 3, 3, 3, 3]) do
form_for(@meeting, method: "put", url: change_state_meeting_path(@meeting),
data: { 'turbo-stream': true }) do |f|
flex_layout do |open_state_actions|
Expand All @@ -50,7 +50,7 @@
end
end
when "closed"
flex_layout do |closed_state|
flex_layout(classes: 'op-meeting-sidebar-state') do |closed_state|
closed_state.with_row do
render(Primer::Beta::State.new(title: "state", scheme: :default)) do
flex_layout do |closed_state_label|
Expand All @@ -66,13 +66,13 @@
end

closed_state.with_row(mt: 3) do
render(Primer::Beta::Text.new(color: :subtle)) do
render(Primer::Beta::Text.new(color: :subtle, classes:'hidden-for-mobile')) do
t("text_meeting_closed_description")
end
end

if edit_enabled?
closed_state.with_row(mt: 3) do
closed_state.with_row(mt: [0, 3, 3, 3, 3]) do
form_for(@meeting, method: "put", url: change_state_meeting_path(@meeting),
data: { 'turbo-stream': true }) do |f|
flex_layout do |closed_state_actions|
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import 'helpers'

@media screen and (max-width: $breakpoint-sm)
.op-meeting-sidebar-state
flex-direction: row !important
justify-content: space-between
align-items: center
Loading
Loading