-
Notifications
You must be signed in to change notification settings - Fork 12
Resource Index - Lazy load with turbo frame #587
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0ff1b15
lazy load resource index
jmilljr24 17656b3
add turbo-false to edit button
jmilljr24 1e1966b
add search on input
jmilljr24 437da19
add select type to form auto-submit
jmilljr24 0a83afc
use radio button
jmilljr24 047adb3
update button style with stimulus
jmilljr24 b7e5ce1
stack kinds filter
jmilljr24 db2c472
add url share and resource count with turbo
jmilljr24 650488a
add animate-fade for user input visual indication
jmilljr24 b94e342
use shared partial
jmilljr24 b5ae93f
Adding back in the total to workshops
maebeale b3b0df8
use plural kinds
jmilljr24 deaf7de
fix kinds
jmilljr24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
| <div id="resource_count"> | ||
| <hr class="border-gray-300 my-6"> | ||
| <div class="filters-applied w-full flex gap-3 items-center"> | ||
| <h3 class="text-sm font-semibold uppercase text-gray-500 tracking-wide">Resources ( <%= @count_display %>)</h3> | ||
| <%= render "shared/copy_url" %> | ||
| </div> | ||
| </div> |
This file contains hidden or 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 hidden or 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,45 +1,26 @@ | ||
| <% default_btn = "text-gray-600 bg-white border border-gray-300 | ||
| hover:bg-gray-100 hover:text-gray-800 shadow-sm" %> | ||
|
|
||
| <% selected_btn = "text-white #{ DomainTheme.bg_class_for(:resources, intensity: 600) } border-indigo-600 | ||
| #{ DomainTheme.bg_class_for(:resources, intensity: 700, hover: true) } shadow-md ring-2 ring-indigo-300" %> | ||
|
|
||
| <div class="mb-3"> | ||
| <h3 class="text-xs font-semibold text-gray-500 tracking-wide mb-1 uppercase"> | ||
| Kinds (click to filter) | ||
| </h3> | ||
|
|
||
| <div class="flex flex-wrap gap-2"> | ||
| <% sortable_fields.each do |sortable_field| %> | ||
| <% Resource::PUBLISHED_KINDS.each do |sortable_field| %> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah. this is much clearer. |
||
| <% name = sortable_field.is_a?(String) ? sortable_field : sortable_field.name %> | ||
|
|
||
| <label for="kind_<%= name %>" | ||
| class=" | ||
| <label | ||
| for="kind_<%= name %>" | ||
| class=" | ||
| inline-flex items-center cursor-pointer | ||
| px-4 py-2 rounded-lg font-medium text-sm | ||
| transition-all duration-150 | ||
| <%= name.to_s == params[:kind] ? selected_btn : default_btn %> | ||
| "> | ||
| <%= check_box_tag(:kind, name, name.to_s == params[:kind], | ||
| id: "kind_#{name}", | ||
| class: "hidden") %> | ||
| <%= default_btn %> | ||
| " | ||
| > | ||
| <%= check_box_tag("kinds[]", name, Array(params[:kinds]).include?(name), | ||
| id: "kind_#{name}", | ||
| class: "hidden") %> | ||
| <%= name.titleize.pluralize %> | ||
| </label> | ||
|
|
||
| <script> | ||
| document.addEventListener("turbo:load", function () { | ||
| const el = document.getElementById("kind_<%= name %>") | ||
| if (el) { | ||
| el.addEventListener("change", function () { | ||
| const url = new URL(window.location.href) | ||
| url.searchParams.set("kind", "<%= name %>") | ||
| url.searchParams.delete("show_all") | ||
| window.location.href = url.toString() | ||
| }) | ||
| } | ||
| }) | ||
| </script> | ||
|
|
||
| <% end %> | ||
| </div> | ||
| </div> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
FYI 1: i started changing these to
unfilteredinstead ofunpaginatedto be more clearFYI 2:
total_entriescan't be used anymore now that we're decorating the paginated collection