-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[#48114] Create Meetings outside of a Project #12783
[#48114] Create Meetings outside of a Project #12783
Conversation
f192fd8
to
a1dbbaf
Compare
d0df4fe
to
74bd38d
Compare
8d5382f
to
20a883f
Compare
f158c9c
to
49e0ca8
Compare
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.
- I'm not entirely sure if the two controllers are required, to simplify the code we could create a
meetings_scope
like:
def meetings
@projects = Project.allowed_to(User.current, :view_meetings)
@projects = @projects.where(project_id:) if project_id
@meetings = Meeting.where(project: projects).from_today
end
This could be used in both of the index pages, without further ado.
The scope can be used to build the Meeting in the create action and it will automatically assign the project_id
:
def create
@meeting = @meetings.build(meeting_params)
end
- Submitting the meeting form without selecting a project results in an error page.
modules/meeting/app/controllers/projects/meetings_controller.rb
Outdated
Show resolved
Hide resolved
5c26e2f
to
3116e45
Compare
3116e45
to
ce7da24
Compare
1a4b5b3
to
70de795
Compare
75606d8
to
8c1467e
Compare
As discussed, I've moved the PR back to a draft state in order to modify the form implementation to use turbo-streams instead of turbo-frames. |
Thanks for the catch Attila!
Adds a `turbo-frame` elemenet that dynamically fetches the participants section upon a change to the selected project from the dropdown.
Thanks :)
…eter` **NOTE**: `typeToSearchText` was not an accepted option by `ng-select` according to its docs. Removing it as it's dead code and the `placeholder` property was already provided and this is where the "Type to search" placeholder was actually being fetched from.
fd9693d
to
d971435
Compare
As suggested by Jonas, this is much cleaner and extensible of an approach. The `src` attribute hack of the prior `turbo-frame` approach is not really of my liking for this anymore. As a side-benefit, this is quite a reusable Stimulus action now.
d971435
to
4309282
Compare
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.
The things I am complaining about are leftovers of the pervious attempt. Feel free to merge this PR yourself, @aaron-contreras after those have been removed since the overall change is good.
request.path == new_meeting_path | ||
end | ||
|
||
def options_for_project_selection |
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.
This can now be removed since the functionality is now provided by the filters passed into the autocompleter.
@@ -99,6 +101,8 @@ en: | |||
|
|||
project_module_meetings: "Meetings" | |||
|
|||
project_selection_placeholder: "Select project" |
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.
Can be removed since the autocompleter is implemented in Angular now.
rescue ActiveRecord::RecordNotFound | ||
render_404 | ||
end | ||
|
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.
Always good to get rid of those controller specific overrides if they are not needed. 🙇
@@ -40,7 +40,10 @@ class Engine < ::Rails::Engine | |||
project_module :meetings do | |||
permission :view_meetings, meetings: %i[index show], meeting_agendas: %i[history show diff], | |||
meeting_minutes: %i[history show diff] | |||
permission :create_meetings, { meetings: %i[new create copy] }, require: :member | |||
permission :create_meetings, | |||
{ meetings: %i[new participants_section create copy] }, |
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.
With the change to turbo-stream, there no longer is a participants_section
method added to the controller so this addition can be reverted.
See: https://community.openproject.org/work_packages/48114