From a2fa16eb435d979543b50b4e844810609dde0f08 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 16 Feb 2019 15:28:06 -0300 Subject: [PATCH] WIP: lxs invitadxs solo pueden cargar la primera plantilla --- app/views/posts/index.haml | 20 +++++++++++--------- config/locales/en.yml | 1 + config/locales/es.yml | 1 + 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index b511e7b..aeef09b 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -14,16 +14,18 @@ = link_to t('posts.new'), new_site_post_path(@site, lang: @lang), class: 'btn btn-success' - else - = link_to t('posts.new'), new_site_post_path(@site, lang: @lang, template: @site.templates.first.id), + = link_to t('posts.new_with_template', template: @site.templates.first.id.humanize), + new_site_post_path(@site, lang: @lang, template: @site.templates.first.id), class: 'btn btn-success' - %button.btn.btn-success.dropdown-toggle.dropdown-toggle-split{data: { toggle: 'split' }, - aria: { haspopup: 'true', expanded: 'false' }} - %span.sr-only= t('posts.dropdown') - .dropdown-menu - - @site.templates.each do |template| - = link_to template.id.camelize, - new_site_post_path(@site, lang: @lang, template: template.id), - class: 'dropdown-item' + - if policy(Post).usuaria? + %button.btn.btn-success.dropdown-toggle.dropdown-toggle-split{data: { toggle: 'split' }, + aria: { haspopup: 'true', expanded: 'false' }} + %span.sr-only= t('posts.dropdown') + .dropdown-menu + - @site.templates.each do |template| + = link_to template.id.humanize, + 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' diff --git a/config/locales/en.yml b/config/locales/en.yml index e13ba5b..cb1d690 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -171,6 +171,7 @@ en: date: 'date' order: 'Order' new: 'New post' + new_with_template: 'New %{template}' dropdown: 'Toggle dropdown' categories: 'Everything' index: 'Posts' diff --git a/config/locales/es.yml b/config/locales/es.yml index 119dcb4..f1bdb21 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -178,6 +178,7 @@ es: categories: 'Todos' dropdown: 'Desplegar el menú' new: 'Empezar un artículo nuevo' + new_with_template: 'Comenzar %{template}' index: 'Artículos' edit: 'Editar' draft: en revisión