From 5e02d061d133ac333342c9329301a9b37977337c Mon Sep 17 00:00:00 2001 From: f Date: Thu, 6 Sep 2018 16:49:37 -0300 Subject: [PATCH] agregar un menu para poder filtrar por categoria --- Gemfile | 2 +- Gemfile.lock | 12 ++++++------ app/views/posts/index.haml | 16 +++++++++++++--- config/locales/en.yml | 2 +- config/locales/es.yml | 2 ++ 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index f6b2a2b9..51a4b183 100644 --- a/Gemfile +++ b/Gemfile @@ -34,7 +34,7 @@ gem 'commonmarker' gem 'email_address' gem 'rails_warden' gem 'haml-rails' -gem 'bootstrap', '~> 4.0.0.beta3' +gem 'bootstrap', '~> 4.0.0' gem 'jekyll' gem 'jquery-rails' gem 'font-awesome-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 09bb96a7..b2bf8f7f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,7 +43,7 @@ GEM airbrussh (1.3.0) sshkit (>= 1.6.1, != 1.7.0) arel (8.0.0) - autoprefixer-rails (8.3.0) + autoprefixer-rails (9.1.4) execjs bcrypt_pbkdf (1.0.0) bindex (0.5.0) @@ -111,7 +111,7 @@ GEM activesupport (>= 4.0, < 6) execjs (2.7.0) fastimage (2.1.3) - ffi (1.9.23) + ffi (1.9.25) font-awesome-rails (4.7.0.4) railties (>= 3.2, < 6.0) forwardable-extended (2.6.0) @@ -188,7 +188,7 @@ GEM mini_portile2 (~> 2.3.0) pathutil (0.16.1) forwardable-extended (~> 2.6) - popper_js (1.12.9) + popper_js (1.14.3) pry (0.11.3) coderay (~> 1.1.0) method_source (~> 0.9.0) @@ -236,7 +236,7 @@ GEM sexp_processor (~> 4.9) rubyzip (1.2.1) safe_yaml (1.0.4) - sass (3.5.6) + sass (3.5.7) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) @@ -303,7 +303,7 @@ PLATFORMS DEPENDENCIES bcrypt_pbkdf - bootstrap (~> 4.0.0.beta3) + bootstrap (~> 4.0.0) capistrano capistrano-bundler capistrano-passenger @@ -340,4 +340,4 @@ DEPENDENCIES whenever BUNDLED WITH - 1.16.1 + 1.16.3 diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 1c6ed644..9870a469 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -21,9 +21,19 @@ = link_to template.id.camelize, new_site_post_path(@site, lang: @lang, template: template.id), class: 'dropdown-item' - - @site.translations.each do |l| - = link_to t("i18n.#{l}"), site_posts_path(@site, category: @category, lang: l), - class: 'btn btn-info' + - @site.translations.each do |l| + = link_to t("i18n.#{l}"), site_posts_path(@site, category: @category, lang: l), + class: 'btn btn-info' + .btn-group.pull-right + = link_to t('posts.categories'), site_posts_path(@site, lang: @lang), class: 'btn btn-secondary' + %button.btn.btn-secondary.dropdown-toggle.dropdown-toggle-split{data: { toggle: 'split' }, + aria: { haspopup: 'true', expanded: 'false' }} + %span.sr-only= t('posts.dropdown') + .dropdown-menu + - @site.categories.each do |c| + = link_to c.split(':').first, + site_posts_path(@site, lang: @lang, category: c), + class: (params[:category] == c) ? 'dropdown-item active' : 'dropdown-item' .row .col diff --git a/config/locales/en.yml b/config/locales/en.yml index fdc0e7bc..9eb0d3f5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -150,6 +150,7 @@ en: order: 'Order' new: 'New post' dropdown: 'Toggle dropdown' + categories: 'Everything' index: 'Posts' edit: 'Edit' save: 'Save' @@ -158,7 +159,6 @@ en: title: 'Title' tags: 'Tags' tags_help: 'Comma separated!' - categories: 'Categories' tags: 'Tags' slug: 'Slug' slug_help: 'This is the name of the article on the URL, ie. /title/. diff --git a/config/locales/es.yml b/config/locales/es.yml index 46a5943e..a31f0084 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -146,6 +146,8 @@ es: order: 'posición' date: 'fecha' order: 'Posición' + categories: 'Todos' + dropdown: 'Desplegar el menú' new: 'Empezar un artículo nuevo' index: 'Artículos' edit: 'Editar'