Skip to content

Commit

Permalink
live search fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
carsoncole committed Dec 7, 2023
1 parent 2262093 commit 643910c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/javascript/controllers/search_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Controller } from "@hotwired/stimulus"

// Connects to data-controller="search"
export default class extends Controller {
search() {
clearTimeout(this.timeout)
this.timeout = setTimeout(() => {
this.element.requestSubmit()
}, 200)

}
}
5 changes: 5 additions & 0 deletions app/views/jobs/_jobs.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%= turbo_frame_tag "jobs" do %>
<div id="jobs" class="flex flex-wrap gap-4 justify-center" data-controller="sortable" data-sortable-animation-value="150" data-sortable-resource-name-value="job">
<%= render @jobs %>
</div>
<% end %>
11 changes: 11 additions & 0 deletions app/views/jobs/dashboard.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div>
<%- if !@has_jobs && !params[:archived] && !params[:query] %>
<%= render 'welcome' %>
<%- else %>
<div id="jobs" class="flex flex-wrap gap-4 justify-center" data-controller="sortable" data-sortable-animation-value="150" data-sortable-resource-name-value="job">
<%= turbo_frame_tag "jobs", src: jobs_path do %>
Content coming
<% end %>
</div>
<%- end %>
</div>
6 changes: 6 additions & 0 deletions db/migrate/20231207185806_add_archived_at_to_jobs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddArchivedAtToJobs < ActiveRecord::Migration[7.1]
def change
add_column :jobs, :archived_at, :datetime
rename_column :jobs, :applied_on, :applied_at
end
end

0 comments on commit 643910c

Please sign in to comment.