-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 #16860 from opf/feature/57854-primerised-meeting-i…
…ndex-pages [#57854] Primerised Meeting index pages
- Loading branch information
Showing
38 changed files
with
941 additions
and
356 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
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
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
10 changes: 10 additions & 0 deletions
10
modules/meeting/app/components/meetings/index/dialog_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,10 @@ | ||
<%= | ||
render(Primer::Alpha::Dialog.new( | ||
id: "new-meeting-dialog", title: title, | ||
size: :medium_portrait, | ||
data: { 'keep-open-on-submit': true } | ||
)) do |dialog| | ||
dialog.with_header(variant: :large) | ||
render(Meetings::Index::FormComponent.new(meeting: @meeting, project: @project, type: @type)) | ||
end | ||
%> |
58 changes: 58 additions & 0 deletions
58
modules/meeting/app/components/meetings/index/dialog_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,58 @@ | ||
#-- 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 Meetings | ||
class Index::DialogComponent < ApplicationComponent | ||
include ApplicationHelper | ||
include OpenProject::FormTagHelper | ||
include OpTurbo::Streamable | ||
include OpPrimer::ComponentHelpers | ||
|
||
def initialize(meeting:, project:, type:) | ||
super | ||
|
||
@meeting = meeting | ||
@project = project | ||
@type = type | ||
end | ||
|
||
private | ||
|
||
def render? | ||
if @project | ||
User.current.allowed_in_project?(:create_meetings, @project) | ||
else | ||
User.current.allowed_in_any_project?(:create_meetings) | ||
end | ||
end | ||
|
||
def title | ||
@type == :new ? I18n.t("label_meeting_new_one_time") : "Copy meeting" | ||
end | ||
end | ||
end |
82 changes: 82 additions & 0 deletions
82
modules/meeting/app/components/meetings/index/form_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,82 @@ | ||
<%= | ||
component_wrapper do | ||
primer_form_with( | ||
scope: :meeting, | ||
model: @meeting, | ||
method: :post, | ||
data: { turbo: true }, | ||
html: { :id => 'meeting-form' }, | ||
url: {:controller => '/meetings', :action => 'create', :project_id => @project} | ||
) do |f| | ||
component_collection do |collection| | ||
collection.with_component(Primer::Alpha::Dialog::Body.new) do | ||
flex_layout(mb: 3) do |modal_body| | ||
if @project.nil? | ||
modal_body.with_row(mt: 3) do | ||
render(Meeting::ProjectAutocompleter.new(f)) | ||
end | ||
end | ||
|
||
modal_body.with_row(mt: 3) do | ||
render(Meeting::Title.new(f)) | ||
end | ||
|
||
modal_body.with_row(mt: 3) do | ||
render(Meeting::StartDate.new(f, initial_value: start_date_initial_value)) | ||
end | ||
|
||
modal_body.with_row(mt: 3) do | ||
render(Meeting::StartTime.new(f, initial_value: start_time_initial_value)) | ||
end | ||
|
||
modal_body.with_row(mt: 3) do | ||
render(Meeting::Duration.new(f)) | ||
end | ||
|
||
modal_body.with_row(mt: 3) do | ||
render(Meeting::Location.new(f)) | ||
end | ||
|
||
modal_body.with_row do | ||
render(Meeting::Type.new(f)) | ||
end | ||
|
||
unless @type == :new | ||
modal_body.with_row do | ||
render(Meeting::CopiedFrom.new(f, id: @type.id)) | ||
end | ||
|
||
modal_body.with_row(mt: 3) do | ||
render(Meeting::CopyItems.new(f)) | ||
end | ||
|
||
modal_body.with_row(mt: 3) do | ||
render(Meeting::CopyParticipants.new(f)) | ||
end | ||
|
||
modal_body.with_row(mt: 3) do | ||
render(Meeting::CopyAttachments.new(f)) | ||
end | ||
|
||
modal_body.with_row(mt: 3) do | ||
render(Meeting::EmailParticipants.new(f)) | ||
end | ||
end | ||
end | ||
end | ||
|
||
collection.with_component(Primer::Alpha::Dialog::Footer.new) do | ||
component_collection do |modal_footer| | ||
modal_footer.with_component(Primer::ButtonComponent.new(data: { 'close-dialog-id': "new-meeting-dialog" })) do | ||
I18n.t("button_cancel") | ||
end | ||
|
||
modal_footer.with_component(Primer::ButtonComponent.new(scheme: :primary, type: :submit)) do | ||
I18n.t("label_meeting_create") | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
%> |
53 changes: 53 additions & 0 deletions
53
modules/meeting/app/components/meetings/index/form_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,53 @@ | ||
#-- 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 Meetings | ||
class Index::FormComponent < ApplicationComponent | ||
include ApplicationHelper | ||
include OpTurbo::Streamable | ||
include OpPrimer::ComponentHelpers | ||
|
||
def initialize(meeting:, project:, type:) | ||
super | ||
|
||
@meeting = meeting | ||
@project = project | ||
@type = type | ||
end | ||
|
||
private | ||
|
||
def start_date_initial_value | ||
format_time_as_date(@meeting.start_time, format: "%Y-%m-%d") | ||
end | ||
|
||
def start_time_initial_value | ||
format_time(@meeting.start_time, include_date: false, format: "%H:%M") | ||
end | ||
end | ||
end |
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
Oops, something went wrong.