From 18ffb15da90ae742db550a8f967233f5ef774b3c Mon Sep 17 00:00:00 2001 From: echarp Date: Sun, 21 Apr 2019 18:09:31 +0200 Subject: [PATCH] =?UTF-8?q?Contextual=20tags=20is=20translated,=20for=20li?= =?UTF-8?q?nux=20presentation=20day=20and=20libre=20en=20f=C3=AAte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 --- app/views/events/show.html.haml | 12 +----------- app/views/pages/_search.haml | 16 +--------------- app/views/tags/_context.html.haml | 13 +++++++++++++ app/views/tags/show.html.haml | 12 +----------- config/locales/views/en.yml | 1 + config/locales/views/fr.yml | 2 ++ 7 files changed, 19 insertions(+), 40 deletions(-) create mode 100644 app/views/tags/_context.html.haml diff --git a/.gitignore b/.gitignore index 29092d34..d79bc687 100644 --- a/.gitignore +++ b/.gitignore @@ -95,8 +95,5 @@ capybara-*html # vendor/extensions dummy applications. vendor/extensions/**/spec/dummy -# exuberant-ctags -tags - # session secret config/initializers/secret_token.rb diff --git a/app/views/events/show.html.haml b/app/views/events/show.html.haml index 37d56786..44d3d540 100644 --- a/app/views/events/show.html.haml +++ b/app/views/events/show.html.haml @@ -1,16 +1,6 @@ - set_event_meta -- if @event.tags.any? { |t| t.name.include? 'libre-en-fete' } - Cet événement s'inscrit dans le cadre de - %a(href='https://www.libre-en-fete.net') - = image_tag 'lef.png', width: '180', height: '60', alt: 'Libre en Fete', - style: 'vertical-align: middle' -- elsif @event.tags.any? { |t| t.name.include? 'linux-presentation-day' } - Cet événement s'inscrit dans le cadre de - %a(href='http://www.linux-presentation-day.org') - = image_tag 'linux-presentation-day.png', - width: '150', height: '75', alt: 'Linux presentation day', - style: 'vertical-align: middle' += render partial: '/tags/context', locals: { tags: @event.tag_list } %h2 - if @event.locality? diff --git a/app/views/pages/_search.haml b/app/views/pages/_search.haml index 6d89d029..5faf7611 100644 --- a/app/views/pages/_search.haml +++ b/app/views/pages/_search.haml @@ -1,21 +1,7 @@ - if action_name == 'index' && controller_name != 'tags' .digest - if params[:tag].present? - %span.tag - - if params[:tag].include? 'libre-en-fete' - %a(href='https://www.libre-en-fete.net') - = image_tag 'lef.png', width: '180', height: '60', - alt: 'Libre en Fete', style: 'vertical-align: middle' - - elsif params[:tag].include? 'linux-presentation-day' - %a(href='http://www.linux-presentation-day.org') - = image_tag 'linux-presentation-day.png', - width: '150', height: '75', alt: 'Linux presentation day', - style: 'vertical-align: middle' - - else - %em.fa.fa-tag - = params[:tag] - %a(href="?tag=") - %em.fa.fa-times + = render partial: '/tags/context', locals: { tags: params[:tag] } - if params[:near].present? && params[:near][:location].present? && params[:near][:distance].present? %span.near diff --git a/app/views/tags/_context.html.haml b/app/views/tags/_context.html.haml new file mode 100644 index 00000000..5f3fb78c --- /dev/null +++ b/app/views/tags/_context.html.haml @@ -0,0 +1,13 @@ +-# Used in pages header, event.show and tag.show + +- if tags.include? 'libre-en-fete' + = t '.link' if action_name == 'show' + %a(href='https://www.libre-en-fete.net') + = image_tag 'lef.png', width: '180', height: '60', alt: 'Libre en Fête', + style: 'vertical-align: middle' + +- elsif tags.include? 'linux-presentation-day' + = t '.link' if action_name == 'show' + %a(href='http://www.linux-presentation-day.org') + = image_tag 'linux-presentation-day.png', width: '150', height: '75', + alt: 'Linux presentation day', style: 'vertical-align: middle' diff --git a/app/views/tags/show.html.haml b/app/views/tags/show.html.haml index 0e5f7058..6108df15 100644 --- a/app/views/tags/show.html.haml +++ b/app/views/tags/show.html.haml @@ -1,14 +1,4 @@ -- if params[:id].include? 'libre-en-fete' - Ces événements s'inscrivent dans le cadre de - %a(href='https://www.libre-en-fete.net') - = image_tag 'lef.png', width: '180', height: '60', alt: 'Libre en Fete', - style: 'vertical-align: middle' -- elsif params[:id].include? 'linux-presentation-day' - Ces événements s'inscrivent dans le cadre de - %a(href='http://www.linux-presentation-day.org') - = image_tag 'linux-presentation-day.png', - width: '150', height: '75', alt: 'Linux presentation day', - style: 'vertical-align: middle' += render partial: '/tags/context', locals: { tags: params[:id] } %h2 %em.fa.fa-tag diff --git a/config/locales/views/en.yml b/config/locales/views/en.yml index b97f488e..58371035 100644 --- a/config/locales/views/en.yml +++ b/config/locales/views/en.yml @@ -160,6 +160,7 @@ it more readable or agreable." zero: one: one event other: "%{count} events" + context: This event is part of moderations: index: title: Events to moderate diff --git a/config/locales/views/fr.yml b/config/locales/views/fr.yml index 63357c84..b4ca524b 100644 --- a/config/locales/views/fr.yml +++ b/config/locales/views/fr.yml @@ -173,6 +173,8 @@ l’évènement pour la rendre plus complète, plus lisible ou plus attrayante." zero: one: Un événement other: "%{count} événements" + context: + link: Cet évènement s'inscrit dans le cadre de moderations: index: title: Événements à modérer