From 765c8c31d74b941f2647753caf333c4df020b842 Mon Sep 17 00:00:00 2001 From: Meutel Date: Sat, 15 Aug 2015 16:04:35 +0200 Subject: [PATCH] series of author --- app/controllers/authors_controller.rb | 2 +- app/views/authors/_series.html.erb | 7 ++++++- config/locales/en.yml | 3 +++ config/locales/fr.yml | 3 +++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/controllers/authors_controller.rb b/app/controllers/authors_controller.rb index 166a326..82ed596 100644 --- a/app/controllers/authors_controller.rb +++ b/app/controllers/authors_controller.rb @@ -36,7 +36,7 @@ class AuthorsController < ApplicationController end def series - @author = Author.find(params[:id]) + @series = Serie.find_by_sql(["select distinct s.* from series s left outer join books_series_link bsl on bsl.series = s.id left outer join books_authors_link bal on bal.book = bsl.book where bal.author = ?", params[:id]]) respond_to do |format| format.html format.js diff --git a/app/views/authors/_series.html.erb b/app/views/authors/_series.html.erb index 1333ed7..4327e63 100644 --- a/app/views/authors/_series.html.erb +++ b/app/views/authors/_series.html.erb @@ -1 +1,6 @@ -TODO +

<%= t(:author_serie, count: @series.count) %>

+ diff --git a/config/locales/en.yml b/config/locales/en.yml index 476433d..a041d7f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -50,6 +50,9 @@ en: author_coauthor: one: "Co-Author" other: "Co-Authors" + author_serie: + one: "Serie" + other: "Series" will_paginate: previous_label: "← Previous" next_label: "Next →" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 047e267..4ecac83 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -50,6 +50,9 @@ fr: author_coauthor: one: "Co-Auteur" other: "Co-Auteurs" + author_serie: + one: "Serie" + other: "Series" will_paginate: previous_label: "← Précédent" next_label: "Suivant →"