From: nertc Date: Tue, 27 Aug 2024 07:50:43 +0000 (+0400) Subject: Add turbo to Issues page X-Git-Tag: live~262^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/3cf5667c919813e2fd5a71254ff56bf1ebdba793 Add turbo to Issues page --- diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 1baf533f4..f53a8dad5 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -45,6 +45,7 @@ class IssuesController < ApplicationController end @issues, @newer_issues_id, @older_issues_id = get_page_items(@issues, :limit => @params[:limit]) + render :partial => "page" if turbo_frame_request_id == "pagination" end def show diff --git a/app/views/issues/_page.html.erb b/app/views/issues/_page.html.erb index ed23fb8cd..2c0340c11 100644 --- a/app/views/issues/_page.html.erb +++ b/app/views/issues/_page.html.erb @@ -1,34 +1,36 @@ - - - - - - - - - - - - <% @issues.each do |issue| %> + +
<%= t ".status" %><%= t ".reports" %><%= t ".reported_item" %><%= t ".reported_user" %><%= t ".last_updated" %>
+ - - - - - + + + + + - <% end %> - -
<%= t ".states.#{issue.status}" %><%= link_to t(".reports_count", :count => issue.reports_count), issue %><%= link_to reportable_title(issue.reportable), reportable_url(issue.reportable) %><%= link_to issue.reported_user.display_name, issue.reported_user if issue.reported_user %> - <% if issue.user_updated %> - <%= t ".last_updated_time_ago_user_html", :user => link_to(issue.user_updated.display_name, issue.user_updated), - :time_ago => friendly_date_ago(issue.updated_at) %> - <% else %> - <%= friendly_date_ago(issue.updated_at) %> - <% end %> - <%= t ".status" %><%= t ".reports" %><%= t ".reported_item" %><%= t ".reported_user" %><%= t ".last_updated" %>
-<%= render "shared/pagination", - :newer_key => "issues.page.newer_issues", - :older_key => "issues.page.older_issues", - :newer_id => @newer_issues_id, - :older_id => @older_issues_id %> + + + <% @issues.each do |issue| %> + + <%= t ".states.#{issue.status}" %> + <%= link_to t(".reports_count", :count => issue.reports_count), issue %> + <%= link_to reportable_title(issue.reportable), reportable_url(issue.reportable) %> + <%= link_to issue.reported_user.display_name, issue.reported_user if issue.reported_user %> + + <% if issue.user_updated %> + <%= t ".last_updated_time_ago_user_html", :user => link_to(issue.user_updated.display_name, issue.user_updated), + :time_ago => friendly_date_ago(issue.updated_at) %> + <% else %> + <%= friendly_date_ago(issue.updated_at) %> + <% end %> + + + <% end %> + + + <%= render "shared/pagination", + :newer_key => "issues.page.newer_issues", + :older_key => "issues.page.older_issues", + :newer_id => @newer_issues_id, + :older_id => @older_issues_id %> + diff --git a/test/system/issues_test.rb b/test/system/issues_test.rb index 4086a4fe4..4d58b9cfc 100644 --- a/test/system/issues_test.rb +++ b/test/system/issues_test.rb @@ -181,12 +181,12 @@ class IssuesTest < ApplicationSystemTestCase 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.issues_not_found") - assert_css "tr", :count => 31, :wait => 1 + assert_css "tr", :count => 31 # Back to First Page 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.issues_not_found") - assert_css "tr", :count => 51, :wait => 1 + assert_css "tr", :count => 51 end end