Add turbo to Issues page

This commit is contained in:
nertc 2024-08-27 11:50:43 +04:00
parent c32f6dd4ff
commit 3cf5667c91
3 changed files with 37 additions and 34 deletions

View file

@ -45,6 +45,7 @@ class IssuesController < ApplicationController
end end
@issues, @newer_issues_id, @older_issues_id = get_page_items(@issues, :limit => @params[:limit]) @issues, @newer_issues_id, @older_issues_id = get_page_items(@issues, :limit => @params[:limit])
render :partial => "page" if turbo_frame_request_id == "pagination"
end end
def show def show

View file

@ -1,4 +1,5 @@
<table class="table table-sm"> <turbo-frame id="pagination" target="_top">
<table class="table table-sm">
<thead> <thead>
<tr> <tr>
<th><%= t ".status" %></th> <th><%= t ".status" %></th>
@ -26,9 +27,10 @@
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<%= render "shared/pagination", <%= render "shared/pagination",
:newer_key => "issues.page.newer_issues", :newer_key => "issues.page.newer_issues",
:older_key => "issues.page.older_issues", :older_key => "issues.page.older_issues",
:newer_id => @newer_issues_id, :newer_id => @newer_issues_id,
:older_id => @older_issues_id %> :older_id => @older_issues_id %>
</turbo-frame>

View file

@ -181,12 +181,12 @@ class IssuesTest < ApplicationSystemTestCase
click_on I18n.t("issues.page.older_issues") click_on I18n.t("issues.page.older_issues")
assert_no_content I18n.t("issues.index.user_not_found") assert_no_content I18n.t("issues.index.user_not_found")
assert_no_content I18n.t("issues.index.issues_not_found") assert_no_content I18n.t("issues.index.issues_not_found")
assert_css "tr", :count => 31, :wait => 1 assert_css "tr", :count => 31
# Back to First Page # Back to First Page
click_on I18n.t("issues.page.newer_issues") click_on I18n.t("issues.page.newer_issues")
assert_no_content I18n.t("issues.index.user_not_found") assert_no_content I18n.t("issues.index.user_not_found")
assert_no_content I18n.t("issues.index.issues_not_found") assert_no_content I18n.t("issues.index.issues_not_found")
assert_css "tr", :count => 51, :wait => 1 assert_css "tr", :count => 51
end end
end end