-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standup meeting group refactor (#138)
* wip * wip * Define @standup_meeting_group_user variable in joined_card_component.rb co-author: Roc Devenport rubykod@gmail.com * Add standup_meeting_groups::joins_controller.rb destroy action co-author: Roc Devenport rubykod@gmail.com * Defines @standup_meeting_group_user variable in joined_card_component.html.erb co-authored-by: Roc Devenport rubykod@gmail.com * . * Adds destroy.turbo_stream.erb file and updates controller to render turbo stream on destroy co-authored-by: RocDavenport rubykod@gmail.com * fixes linting error * breaks @joinable_standup_meeting_groups line the standup_meeting_groups_controller.rb * . * . * wip: adding joinable_item_component specs * removes join_button_component * removes leave_button_component * removed base_botton_component * Remove uneeded code from _standup_meeting_group_list_item.erb * adds styling changes to joined_card_component.html.erb * Refactores standup meeting group index to only display 3 cards per row. * clean code * Address pr comments * centered joined_card_components on small screen * deleted commented out code * wip: adding checkin_status feature to joined_cards * reverting to split up issues * adds icons and flash text for checkins messages * cleans code for pr * Adds test for joinableItemComponent * adds joined card component test * fixes rubocop errors * removes turbo from leave button and adds a redirect to joins destroy action * Changes joined card components container from grid to flexbox * refactor standup_meeting_groups turbo_stream to render JoinableItemComponent * remove _standup_meeting_group_list item partial --------- Co-authored-by: Gustavo Valenzuela <gustavo.devvv@gmail.com>
- Loading branch information
1 parent
8211bc6
commit 8b767a1
Showing
22 changed files
with
130 additions
and
108 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
25 changes: 0 additions & 25 deletions
25
app/components/standup_meeting_group/base_button_component.rb
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
app/components/standup_meeting_group/join_button_component.html.erb
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
app/components/standup_meeting_group/join_button_component.rb
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
app/components/standup_meeting_group/joinable_item_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 @@ | ||
<%= tag.li(id: dom_id(standup_meeting_group), class: " justify-between flex flex-row p-4 mb-2 border-black border-2 items-center") do %> | ||
<h1 class=""><%= standup_meeting_group.name %></h1> | ||
|
||
<div class=""> | ||
<%= button_to 'Join', standup_meeting_group_joins_path(@standup_meeting_group), class: 'btn btn-success' %> | ||
</div> | ||
<% end %> |
14 changes: 14 additions & 0 deletions
14
app/components/standup_meeting_group/joinable_item_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,14 @@ | ||
# frozen_string_literal: true | ||
|
||
class StandupMeetingGroup::JoinableItemComponent < ViewComponent::Base | ||
include Turbo::FramesHelper | ||
|
||
with_collection_parameter :standup_meeting_group | ||
|
||
attr_reader :standup_meeting_group, :user | ||
|
||
def initialize(standup_meeting_group:, current_user:) | ||
@standup_meeting_group = standup_meeting_group | ||
@user = current_user | ||
end | ||
end |
17 changes: 17 additions & 0 deletions
17
app/components/standup_meeting_group/joined_card_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,17 @@ | ||
<%= tag.div(id: dom_id(standup_meeting_group), class: "card card-bordered w-72") do %> | ||
<div class="card-body flex flex-row p-4"> | ||
<div class="w-1/2"> | ||
<h4 class="card-title font-bold text-lg"><%= link_to standup_meeting_group %></h4> | ||
<div class="checkin_message"> | ||
<p class="text-xs"> <i class="fa-solid fa-check"></i> Checked in </p> | ||
<p class="text-xs"> <i class="fa-solid fa-triangle-exclamation"></i> Outstanding check in</p> | ||
</div> | ||
</div> | ||
<div class="w-1/2"> | ||
<div class="card-actions flex space-x-2 justify-end"> | ||
<button class="btn btn-sm">Check In</button> | ||
<button class="btn btn-sm">Skip</button> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> |
13 changes: 13 additions & 0 deletions
13
app/components/standup_meeting_group/joined_card_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,13 @@ | ||
# frozen_string_literal: true | ||
|
||
class StandupMeetingGroup::JoinedCardComponent < ViewComponent::Base | ||
with_collection_parameter :standup_meeting_group | ||
|
||
attr_reader :standup_meeting_group, :user | ||
|
||
def initialize(standup_meeting_group:, current_user:) | ||
@standup_meeting_group = standup_meeting_group | ||
@user = current_user | ||
@standup_meeting_group_user = standup_meeting_group.standup_meeting_groups_users.find_by(user:) | ||
end | ||
end |
1 change: 0 additions & 1 deletion
1
app/components/standup_meeting_group/leave_button_component.html.erb
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
app/components/standup_meeting_group/leave_button_component.rb
This file was deleted.
Oops, something went wrong.
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
17 changes: 0 additions & 17 deletions
17
app/views/standup_meeting_groups/_standup_meeting_group_list_item.erb
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,11 +1,12 @@ | ||
<%= turbo_stream.prepend( | ||
"standup_meeting_group_list", | ||
partial: 'standup_meeting_group_list_item', | ||
locals: { standup_meeting_group: @standup_meeting_group } | ||
) | ||
%> | ||
<%= turbo_stream.update "flash", partial: "layouts/flash" %> | ||
<%= turbo_stream.update "new_standup_meeting_group" do %> | ||
<%= render "form", standup_meeting_group: @new_standup_meeting_group %> | ||
<% if @standup_meeting_group.valid? %> | ||
<%= turbo_stream.prepend "find-standup-meeting-groups" do %> | ||
<%= render StandupMeetingGroup::JoinableItemComponent.new(standup_meeting_group: @standup_meeting_group, current_user: current_user) %> | ||
<% end %> | ||
<%= turbo_stream.update "new_standup_meeting_group" do %> | ||
<%= render "form", standup_meeting_group: @new_standup_meeting_group %> | ||
<% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
<h1>Standup Meeting Groups</h1> | ||
|
||
<% if policy(:standup_meeting_group).new? %> | ||
<div class="p-2 border-black border-2" id="new_standup_meeting_group"> | ||
<%= render 'form', standup_meeting_group: StandupMeetingGroup.new %> | ||
</div> | ||
<% end %> | ||
|
||
<hr class="mb-5 mt-5 border-b-2"> | ||
<div class="flex flex-col justify-center"> | ||
<h2 class="font-bold text-3xl pl-5 text-center md:text-left">My Standups</h2> | ||
<div id="my-standup-meeting-groups" class=" flex justify-center flex flex-wrap gap-5 pl-5 pt-5 pb-5"> | ||
<%= render StandupMeetingGroup::JoinedCardComponent.with_collection(@my_standup_meeting_groups, current_user:) %> | ||
</div> | ||
</div> | ||
|
||
<ul role="list" id="standup_meeting_group_list"> | ||
<%= render partial: 'standup_meeting_group_list_item', collection: @standup_meeting_groups, as: :standup_meeting_group %> | ||
</ul> | ||
<div class="flex flex-col"> | ||
<h2 class="font-bold text-3xl pl-5 text-center md:text-left">Find a Standup</h2> | ||
<ul id="find-standup-meeting-groups" class="flex flex-col pl-5 pt-5 pb-5"> | ||
<%= render StandupMeetingGroup::JoinableItemComponent.with_collection(@joinable_standup_meeting_groups, current_user:) %> | ||
</ul> | ||
</div> |
4 changes: 4 additions & 0 deletions
4
app/views/standup_meeting_groups/joins/create.turbo_stream.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,4 @@ | ||
<%= turbo_stream.remove @standup_meeting_group %> | ||
<%= turbo_stream.prepend 'my-standup-meeting-groups' do %> | ||
<%= render StandupMeetingGroup::JoinedCardComponent.new(standup_meeting_group: @standup_meeting_group, current_user: current_user) %> | ||
<% end %> |
5 changes: 5 additions & 0 deletions
5
app/views/standup_meeting_groups/joins/destroy.turbo_stream.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,5 @@ | ||
<%= turbo_stream.remove @standup_meeting_group %> | ||
<%= turbo_stream.prepend 'find-standup-meeting-groups' do %> | ||
<%= render StandupMeetingGroup::JoinableItemComponent.new(standup_meeting_group: @standup_meeting_group, current_user: current_user ) %> | ||
<% end %> |
16 changes: 16 additions & 0 deletions
16
spec/components/standup_meeting_group/joinable_item_component_spec.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,16 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe StandupMeetingGroup::JoinableItemComponent, type: :component do | ||
let(:standup_meeting_group) { create(:standup_meeting_group) } | ||
let(:user) { create(:user) } | ||
|
||
context 'when standup meeting group is present and user is not a member' do | ||
it 'renders the join button' do | ||
render_inline(described_class.new(standup_meeting_group:, current_user: user)) | ||
|
||
expect(page).to have_button(text: 'Join') | ||
end | ||
end | ||
end |
14 changes: 14 additions & 0 deletions
14
spec/components/standup_meeting_group/joined_card_component_spec.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,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe StandupMeetingGroup::JoinedCardComponent, type: :component do | ||
let(:standup_meeting_group) { create(:standup_meeting_group, name: 'Test Group') } | ||
let(:user) { create(:user) } | ||
|
||
it 'renders the joined card with the right name' do | ||
render_inline(described_class.new(standup_meeting_group:, current_user: user)) | ||
|
||
expect(page).to have_css('h4', text: 'Test Group') | ||
end | ||
end |