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

Feature: Moving project solutions to Hotwire final tweaks #3956

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app/components/project_submissions/item_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
data-transition-leave="transition ease-in duration-75"
data-transition-leave-start="transform opacity-100 scale-100"
data-transition-leave-end="transform opacity-10 scale-95"
class="absolute right-0 z-10 mt-2 w-32 origin-top-right rounded-md bg-white dark:bg-gray-700 py-2 shadow-lg ring-1 ring-gray-900/5 dark:ring-gray-300/5 focus:outline-none" role="menu" aria-orientation="vertical" aria-labelledby="options-menu-0-button" tabindex="-1">
class="hidden absolute right-0 z-10 mt-2 w-32 origin-top-right rounded-md bg-white dark:bg-gray-700 py-2 shadow-lg ring-1 ring-gray-900/5 dark:ring-gray-300/5 focus:outline-none" role="menu" aria-orientation="vertical" aria-labelledby="options-menu-0-button" tabindex="-1">
Copy link
Member

Choose a reason for hiding this comment

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

What controls the un-hiding of this element? Probably something obvious but it's not jumping out at me

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question and no worries, it's not that obvious. The visibility stimulus controller is unhiding via el-transistion. It toggles the hidden class and add transitions under the hood.


<% if project_submission.user == current_user %>
<%= link_to edit_lesson_v2_project_submission_path(project_submission.lesson, project_submission), class: 'text-gray-700 dark:text-gray-300 group flex items-center px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-600 hover:text-gray-900 dark:hover:text-gray-200', role: 'menuitem', tabindex: '-1', data: { turbo_frame: 'modal', test_id: 'edit-submission', action: 'click->visibility#off'} do %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= link_to new_lesson_v2_project_submission_path(@lesson), class: 'button button--primary', data: { turbo_frame: 'modal', test_id: 'add_submission_btn' } do %>
Add submission
Add solution
<% end %>
4 changes: 2 additions & 2 deletions app/views/lessons/v2_project_submissions/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</div>
<div class="pl-7 text-sm leading-6">
<%= form.label :is_public_true, 'Public to other learners', class: 'dark:text-gray-200' %>
<p class="text-gray-500 dark:text-gray-400">Anyone can see this project in the submissions list.</p>
<p class="text-gray-500 dark:text-gray-400">Anyone can see this project in the solutions list.</p>
</div>
</div>
<div>
Expand All @@ -35,7 +35,7 @@
</div>
<div class="pl-7 text-sm leading-6">
<%= form.label :is_public_false, 'Private to you' %>
<p class="text-gray-500 dark:text-gray-400">Only you can see this project in the submissions list.</p>
<p class="text-gray-500 dark:text-gray-400">Only you can see this project in the solutions list.</p>
</div>
</div>
</div>
Expand Down
9 changes: 5 additions & 4 deletions app/views/lessons/v2_project_submissions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
<%= @lesson.course.title %> : (<%= @lesson.title %>)
</h4>
</div>
<% if @current_user_submission.nil? %>
<div id="add-submission-button">

<div id="add-submission-button">
<% if @current_user_submission.nil? %>
<%= render 'lessons/v2_project_submissions/add_button', lesson: @lesson %>
</div>
<% end %>
<% end %>
</div>
</header>

<%= turbo_frame_tag 'submissions-list', data: { test_id: 'submissions-list', controller: 'sort' } do %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
expect(page).to have_content(user.username)
end

expect(page).not_to have_content('Add submission')
expect(page).not_to have_content('Add solution')
Copy link
Member

Choose a reason for hiding this comment

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

Have made some comments on #3955 but not a blocker for this PR


using_session('another_user') do
sign_in(another_user)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
end
end

expect(page).to have_content('Add submission')
expect(page).to have_content('Add solution')

within(:test_id, 'submissions-list') do
expect(page).not_to have_content(user.username)
Expand Down