Commit 9072697a by Tô Ngọc Ánh

load previous favorite page if page empty

parent eb291848
Pipeline #1011 canceled with stages
in 0 seconds
<div id="favorited-<%= job.id %>">
<div id="favorited-<%= job.id %>" class="form-item">
<div class='card flex-md-row align-items-center my-2 p-2'>
<%= radio_button_tag :job_id, job.id %>
<%= render 'shared/job_body', job: job %>
......
......@@ -2,3 +2,13 @@ $('#favorite-<%= @favorite.job_id %>')
.html("<%= j render 'favorites/link_favorite', job_id: @favorite.job_id %>")
$('#sum-favorited').html("<%= current_user.favorites.size %>")
$('#favorited-<%= @favorite.job_id %>').remove()
var num_child = $('.form-group .form-item').length
if (num_child == 0) {
var prev = $('a[rel=prev]')
if (prev.length > 0) {
window.location = prev.attr('href')
}
else {
window.location = '<%= favorites_path %>'
}
}
......@@ -4,7 +4,7 @@
<div class='content'>
<% if @jobs.any? %>
<%= paginate @jobs %>
<%= form_tag new_applied_job_path, method: :get, enforce_utf8: false do %>
<%= form_tag new_applied_job_path, method: :get, enforce_utf8: false, class: 'form-group' do %>
<%= render partial: 'favorites/job', collection: @jobs %>
<div class="actions text-center">
<%= submit_tag 'Apply Now', name: nil, class: 'btn btn-outline-success btn-lg' %>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment