Skip to content

Commit 5345547

Browse files
committed
save progress
1 parent d562af5 commit 5345547

File tree

4 files changed

+90
-56
lines changed

4 files changed

+90
-56
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<% if @job_applications.any? %>
2+
<div class="mb-8 flex justify-end">
3+
<%= link_to 'New Job Application', new_job_application_path, class: 'text-sm bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded cursor-pointer', data: { turbo_frame: "_top" } %>
4+
</div>
5+
<%= form_with url: job_applications_path, method: :get, data: { controller: "job-filter", turbo_frame: "job_applications_table" } do |form| %>
6+
<!-- Your existing filter form code here -->
7+
<% end %>
8+
<%= turbo_frame_tag "job_applications_table" do %>
9+
<%= render partial: "job_applications_table", locals: { job_applications: @job_applications } %>
10+
<div id="pagination" class="mt-4">
11+
<%= render partial: "pagination", locals: { job_applications: @job_applications, job_application_count: @job_application_count } %>
12+
</div>
13+
<% end %>
14+
<% else %>
15+
<%= render 'empty_state' %>
16+
<% end %>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<div class="text-center py-10 border-dashed border-2 border-gray-300 rounded-lg">
2+
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
3+
<path vector-effect="non-scaling-stroke" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z" />
4+
</svg>
5+
<h2 class="mt-2 text-base font-semibold text-gray-900">No job applications</h2>
6+
<p class="mt-1 mb-8 text-sm text-gray-500">Get started by creating a new job application.</p>
7+
<%= link_to 'New Job Application', new_job_application_path, class: 'text-sm bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded cursor-pointer', data: { turbo_frame: "_top" } %>
8+
</div>

app/views/job_applications/_job_applications_table.html.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
<p class="mt-1 text-sm text-gray-500">
5555
<%= "No results match your search criteria." if params[:search].present? || params[:method_of_contact].present? || params[:position_type].present? %>
5656
</p>
57+
<p class="mt-1 mb-4 text-sm text-gray-500">
58+
<%= "No job applications. Add your first job application now" if job_applications.blank? %>
59+
</p>
60+
<%= link_to 'New Job Application', new_job_application_path, class: 'text-sm bg-blue-600 hover:bg-blue-700 text-white mt-4 font-bold py-2 px-4 rounded cursor-pointer', data: { turbo_frame: "_top" } %>
5761
</div>
5862
<% end %>
5963
</div>

app/views/job_applications/index.html.erb

Lines changed: 62 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -6,69 +6,75 @@
66
<div class="mb-8 flex justify-between items-center">
77
<div class="flex items-center">
88
<%= image_tag(asset_path('apple-touch-icon.png'),
9-
height: '32',
10-
width: '32',
11-
class: "rounded-full object-cover shadow-sm border-2 border-gray-200 mr-2",
12-
aria: { label: "Job Tracker logo" },
13-
title: "Job Tracker logo") %>
9+
height: '32',
10+
width: '32',
11+
class: "rounded-full object-cover shadow-sm border-2 border-gray-200 mr-2",
12+
aria: { label: "Job Tracker logo" },
13+
title: "Job Tracker logo") %>
1414
<h2 class="hidden md:block md:text-2xl font-semibold text-gray-700 shadow-2xl">
1515
Job Tracker
1616
</h2>
1717
</div>
18-
<%= link_to 'New Job Application', new_job_application_path, class: 'text-sm bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded cursor-pointer', data: { turbo_frame: "_top" } %>
18+
<% if @job_applications.any? %>
19+
<%= link_to 'New Job Application', new_job_application_path, class: 'text-sm bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded cursor-pointer', data: { turbo_frame: "_top" } %>
20+
<% end %>
1921
</div>
20-
<%= form_with url: job_applications_path, method: :get, data: { controller: "job-filter", turbo_frame: "job_applications_table" } do |form| %>
21-
<div class="flex flex-wrap -mx-2 mb-4">
22-
<div class="w-full md:w-1/6 px-2 mb-4 md:mb-0">
23-
<%= form.label :search, "Search", class: "sr-only" %>
24-
<%= form.text_field :search, value: params[:search], class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline", placeholder: "Search", data: { action: "input->job-filter#submit" } %>
22+
<% if @job_applications.any? %>
23+
<%= form_with url: job_applications_path, method: :get, data: { controller: "job-filter", turbo_frame: "job_applications_table" } do |form| %>
24+
<div class="flex flex-wrap -mx-2 mb-4">
25+
<div class="w-full md:w-1/6 px-2 mb-4 md:mb-0">
26+
<%= form.label :search, "Search", class: "sr-only" %>
27+
<%= form.text_field :search, value: params[:search], class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline", placeholder: "Search", data: { action: "input->job-filter#submit" } %>
28+
</div>
29+
<div class="w-full md:w-1/6 px-2 mb-4 md:mb-0">
30+
<%= form.label :method_of_contact, "Contact Method", class: "sr-only" %>
31+
<%= form.select :method_of_contact,
32+
options_for_select([["All Contact Methods", ""]] + JobApplication.method_of_contacts.map { |k, v| [k.humanize, v] }, params[:method_of_contact]),
33+
{},
34+
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline",
35+
data: { action: "change->job-filter#submit" }
36+
%>
37+
</div>
38+
<div class="w-full md:w-1/6 px-2 mb-4 md:mb-0">
39+
<%= form.label :position_type, "Position Type", class: "sr-only" %>
40+
<%= form.select :position_type,
41+
options_for_select([["All Position Types", ""]] + JobApplication.position_types.map { |k, v| [display_position_type(k), v] }, params[:position_type]),
42+
{},
43+
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline",
44+
data: { action: "change->job-filter#submit" }
45+
%>
46+
</div>
47+
<div class="w-full md:w-1/6 px-2 mb-4 md:mb-0">
48+
<%= form.label :claimed_for_unemployment, "Unemployment Claim", class: "sr-only" %>
49+
<%= form.select :claimed_for_unemployment,
50+
options_for_select([["All Claims", ""], ["Claimed", "true"], ["Not Claimed", "false"]], params[:claimed_for_unemployment]),
51+
{},
52+
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline",
53+
data: { action: "change->job-filter#submit" }
54+
%>
55+
</div>
56+
<div class="w-full md:w-1/6 px-2 mb-4 md:mb-0">
57+
<%= form.label :status, "Application Status", class: "sr-only" %>
58+
<%= form.select :status,
59+
options_for_select([["All Statuses", ""]] + JobApplication.statuses.map { |k, v| [k.humanize, v] }, params[:status]),
60+
{},
61+
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline",
62+
data: { action: "change->job-filter#submit" }
63+
%>
64+
</div>
65+
<div class="w-full md:w-1/6 px-2 mt-4 md:mt-0">
66+
<%= form.button "Reset Filters", type: "button", class: "w-full bg-gray-600 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded cursor-pointer", data: { action: "click->job-filter#reset" } %>
67+
</div>
2568
</div>
26-
<div class="w-full md:w-1/6 px-2 mb-4 md:mb-0">
27-
<%= form.label :method_of_contact, "Contact Method", class: "sr-only" %>
28-
<%= form.select :method_of_contact,
29-
options_for_select([["All Contact Methods", ""]] + JobApplication.method_of_contacts.map { |k, v| [k.humanize, v] }, params[:method_of_contact]),
30-
{},
31-
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline",
32-
data: { action: "change->job-filter#submit" }
33-
%>
69+
<% end %>
70+
<%= turbo_frame_tag "job_applications_table" do %>
71+
<%= render partial: "job_applications_table", locals: { job_applications: @job_applications } %>
72+
<div id="pagination" class="mt-4">
73+
<%= render partial: "pagination", locals: { job_applications: @job_applications, job_application_count: @job_application_count } %>
3474
</div>
35-
<div class="w-full md:w-1/6 px-2 mb-4 md:mb-0">
36-
<%= form.label :position_type, "Position Type", class: "sr-only" %>
37-
<%= form.select :position_type,
38-
options_for_select([["All Position Types", ""]] + JobApplication.position_types.map { |k, v| [display_position_type(k), v] }, params[:position_type]),
39-
{},
40-
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline",
41-
data: { action: "change->job-filter#submit" }
42-
%>
43-
</div>
44-
<div class="w-full md:w-1/6 px-2 mb-4 md:mb-0">
45-
<%= form.label :claimed_for_unemployment, "Unemployment Claim", class: "sr-only" %>
46-
<%= form.select :claimed_for_unemployment,
47-
options_for_select([["All Claims", ""], ["Claimed", "true"], ["Not Claimed", "false"]], params[:claimed_for_unemployment]),
48-
{},
49-
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline",
50-
data: { action: "change->job-filter#submit" }
51-
%>
52-
</div>
53-
<div class="w-full md:w-1/6 px-2 mb-4 md:mb-0">
54-
<%= form.label :status, "Application Status", class: "sr-only" %>
55-
<%= form.select :status,
56-
options_for_select([["All Statuses", ""]] + JobApplication.statuses.map { |k, v| [k.humanize, v] }, params[:status]),
57-
{},
58-
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline",
59-
data: { action: "change->job-filter#submit" }
60-
%>
61-
</div>
62-
<div class="w-full md:w-1/6 px-2 mt-4 md:mt-0">
63-
<%= form.button "Reset Filters", type: "button", class: "w-full bg-gray-600 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded cursor-pointer", data: { action: "click->job-filter#reset" } %>
64-
</div>
65-
</div>
66-
<% end %>
67-
<%= turbo_frame_tag "job_applications_table" do %>
68-
<%= render partial: "job_applications_table", locals: { job_applications: @job_applications } %>
69-
<div id="pagination" class="mt-4">
70-
<%= render partial: "pagination", locals: { job_applications: @job_applications, job_application_count: @job_application_count } %>
71-
</div>
75+
<% end %>
76+
<% else %>
77+
<%= render 'empty_state' %>
7278
<% end %>
7379
<%= turbo_frame_tag "new_job_application" %>
7480
</div>

0 commit comments

Comments
 (0)