From 76771541e9e769f1a98df1b634bf46c553d6e927 Mon Sep 17 00:00:00 2001 From: Meutel Date: Tue, 4 Aug 2015 18:32:09 +0200 Subject: [PATCH] style filter --- app/assets/stylesheets/application.css | 6 ++++++ app/views/books/_index.html.erb | 16 +++++++++++++--- app/views/layouts/_filter.html.erb | 11 +++++++---- app/views/layouts/_initials.html.erb | 2 +- app/views/layouts/_perpage.html.erb | 2 +- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index f9cd5b3..6861b54 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -13,3 +13,9 @@ *= require_tree . *= require_self */ +a .filterToggle:before { + content: "\e113"; +} +a.collapsed .filterToggle:before { + content: "\e114"; +} diff --git a/app/views/books/_index.html.erb b/app/views/books/_index.html.erb index 89ffd06..2737350 100644 --- a/app/views/books/_index.html.erb +++ b/app/views/books/_index.html.erb @@ -1,6 +1,16 @@ -<% 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 %> +<% opts = { data: { url: url_for, remote: true, method: :get } } +content_for :latest_filter do %> +
+ <%= label_tag "sort", "Sort by" %> + + +
<% end %> <%= render'layouts/filter' %> diff --git a/app/views/layouts/_filter.html.erb b/app/views/layouts/_filter.html.erb index 4cd18d8..bdc5076 100644 --- a/app/views/layouts/_filter.html.erb +++ b/app/views/layouts/_filter.html.erb @@ -1,20 +1,23 @@
- <%= link_to "#filterContent", data: { toggle: "collapse" } do %> -

Filter

+ <%= link_to "#filterContent", { class: "collapsed", data: { toggle: "collapse" } } do %> +

+

<% end %>
<%= render'layouts/initials' %> - <%= render'layouts/perpage' %> <%= yield(:latest_filter) %> <%= form_tag({}, {method: :get, remote: true}) do %>
- <%= button_tag "Seach", class: "btn btn-default" %> + <%= button_tag "Search", class: "btn btn-default" %> <%= search_field_tag(:term, @preference.term, placeholder: "Search for...", class: "form-control") %>
<% end %> + <%= render'layouts/perpage' %>
diff --git a/app/views/layouts/_initials.html.erb b/app/views/layouts/_initials.html.erb index f5810d6..2772661 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 %>
-