From dbc9e5a931b6289fe9c891a25fc05372433667e5 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 30 Dec 2014 21:37:58 +0800 Subject: [PATCH] fix for pagination and revoke and grant buttons --- .../admin/registered_sites/_index.html.erb | 8 +++++++- .../change_access_status.js.erb | 17 ++++++++++++++++- app/views/admin/registered_sites/index.html.erb | 7 +------ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/app/views/admin/registered_sites/_index.html.erb b/app/views/admin/registered_sites/_index.html.erb index 4dcb87e..bca042f 100644 --- a/app/views/admin/registered_sites/_index.html.erb +++ b/app/views/admin/registered_sites/_index.html.erb @@ -52,4 +52,10 @@ <% end %> - \ No newline at end of file + + + <%= + content_tag :div, class: "bottomnav clearfix" do + content_tag :div, paginate(@registeredsites), class: "pagination pagination-centered" + end +%> \ No newline at end of file diff --git a/app/views/admin/registered_sites/change_access_status.js.erb b/app/views/admin/registered_sites/change_access_status.js.erb index b4ba57c..9592967 100644 --- a/app/views/admin/registered_sites/change_access_status.js.erb +++ b/app/views/admin/registered_sites/change_access_status.js.erb @@ -1 +1,16 @@ -$("#index_table").html("<%= j render 'index' %>") \ No newline at end of file +$("#index_table").html("<%= j render 'index' %>"); +var atags = $(".pagination a"); +if (atags.length > 0){ + atags.each(function(){ + var el = $(this); + if(el.attr("href")){ + var url = "http://" + window.location.host + el.attr("href"); + uri = new URL(url); + if(uri.searchParams.get("page")){ + $(this).attr("href","/<%= locale.to_s %>/admin/registered_sites?page=" + uri.searchParams.get("page")); + }else{ + $(this).attr("href","/<%= locale.to_s %>/admin/registered_sites"); + } + } + }) +} \ No newline at end of file diff --git a/app/views/admin/registered_sites/index.html.erb b/app/views/admin/registered_sites/index.html.erb index f95a4da..65d2e2b 100644 --- a/app/views/admin/registered_sites/index.html.erb +++ b/app/views/admin/registered_sites/index.html.erb @@ -1,9 +1,4 @@ <%= render_filter @filter_fields, "index_table" %> <%= render 'index'%> - - <%= - content_tag :div, class: "bottomnav clearfix" do - content_tag :div, paginate(@registeredsites), class: "pagination pagination-centered" - end -%> \ No newline at end of file + \ No newline at end of file