diff --git a/app/views/authors/_index.html.erb b/app/views/authors/_index.html.erb index 2033cd3..b01423f 100644 --- a/app/views/authors/_index.html.erb +++ b/app/views/authors/_index.html.erb @@ -1,6 +1,6 @@ -<%= render 'layouts/initials' %> -<%= will_paginate class: "center" %> +<%= render'layouts/filter' %> +<%= will_paginate class: "center" %> @@ -13,6 +13,4 @@ <% end %>
Name
- <%= will_paginate class: "center" %> -<%= render 'layouts/perpage' %> diff --git a/app/views/books/_index.html.erb b/app/views/books/_index.html.erb index 634492d..89ffd06 100644 --- a/app/views/books/_index.html.erb +++ b/app/views/books/_index.html.erb @@ -1,15 +1,10 @@ -
-
-

Filter

-
-
-<% isLatest = session[:sort] == "latest" %> -<%= link_to "Latest", url_for(sort: (isLatest ? "alpha" : "latest")), class: "btn btn-default btn-sm " + (isLatest ? " active" : ""), remote: true %> -<%= render'layouts/initials' %> -
-
-<%= will_paginate class: "center" %> +<% content_for :latest_filter do + isLatest = session[:sort] == "latest" %> + <%= link_to "Latest", url_for(sort: (isLatest ? "alpha" : "latest")), class: "btn btn-default btn-sm " + (isLatest ? " active" : ""), remote: true %> +<% end %> +<%= render'layouts/filter' %> +<%= will_paginate class: "center" %> @@ -33,6 +28,4 @@ <% end %>
Name
- <%= will_paginate class: "center" %> -<%= render'layouts/perpage' %> diff --git a/app/views/layouts/_filter.html.erb b/app/views/layouts/_filter.html.erb new file mode 100644 index 0000000..c9a2247 --- /dev/null +++ b/app/views/layouts/_filter.html.erb @@ -0,0 +1,12 @@ +
+
+ <%= link_to "#filterContent", data: { toggle: "collapse" } do %> +

Filter

+ <% end %> +
+
+ <%= yield(:latest_filter) %> + <%= render'layouts/initials' %> + <%= render'layouts/perpage' %> +
+
diff --git a/app/views/layouts/_initials.html.erb b/app/views/layouts/_initials.html.erb index 651863d..cfb6ff6 100644 --- a/app/views/layouts/_initials.html.erb +++ b/app/views/layouts/_initials.html.erb @@ -1,6 +1,6 @@ <% initials = ['0'] + ('A'..'Z').to_a %>
-