diff --git a/app/views/layouts/_breadcrumb.haml b/app/views/layouts/_breadcrumb.haml new file mode 100644 index 0000000..2eed3d4 --- /dev/null +++ b/app/views/layouts/_breadcrumb.haml @@ -0,0 +1,7 @@ +%nav{'aria-label': 'breadcrumb', role: 'navigation'} + %ol.breadcrumb + - crumbs.each do |crumb| + - if crumb == crumbs.last + %li.breadcrumb-item.active{'aria-current': 'page'}= crumb + - else + %li.breadcrumb-item= crumb diff --git a/app/views/posts/edit.haml b/app/views/posts/edit.haml index f327f1b..d9e13dc 100644 --- a/app/views/posts/edit.haml +++ b/app/views/posts/edit.haml @@ -1,3 +1,13 @@ +.row + .col + = render 'layouts/breadcrumb', + crumbs: [ link_to(t('sites.index'), sites_path), + @site.name, + link_to(t('posts.index'), + site_posts_path(@site)), + link_to(@post.title, site_post_path(@site, @post)), + t('posts.edit')] + .row .col = render 'posts/form' diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 98a2d9b..c089698 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -1,3 +1,6 @@ +.row + .col + = render 'layouts/breadcrumb', crumbs: [ link_to(t('sites.index'), sites_path), @site.name, t('posts.index') ] .row .col %h1= @site.name diff --git a/app/views/posts/new.haml b/app/views/posts/new.haml index f327f1b..41c2722 100644 --- a/app/views/posts/new.haml +++ b/app/views/posts/new.haml @@ -1,3 +1,6 @@ +.row + .col + = render 'layouts/breadcrumb', crumbs: [ link_to(t('sites.index'), sites_path), @site.name, link_to(t('posts.index'), site_posts_path(@site)), t('posts.new') ] .row .col = render 'posts/form' diff --git a/app/views/posts/show.haml b/app/views/posts/show.haml index 174cbee..15aa853 100644 --- a/app/views/posts/show.haml +++ b/app/views/posts/show.haml @@ -1,3 +1,12 @@ +.row + .col + = render 'layouts/breadcrumb', + crumbs: [ link_to(t('sites.index'), sites_path), + @site.name, + link_to(t('posts.index'), + site_posts_path(@site)), + @post.title ] + .row .col %h1= @post.title diff --git a/app/views/sites/index.haml b/app/views/sites/index.haml index 9558789..6e175b7 100644 --- a/app/views/sites/index.haml +++ b/app/views/sites/index.haml @@ -1,7 +1,13 @@ -%h1= t('sites.title') -%table.table.table-striped.table-condensed - %tbody - - @sites.each do |site| - %tr - %td= link_to site.name, site_path(site) +.row + .col + = render 'layouts/breadcrumb', crumbs: [ t('sites.index') ] +.row + .col + %h1= t('sites.title') + + %table.table.table-striped.table-condensed + %tbody + - @sites.each do |site| + %tr + %td= link_to site.name, site_path(site) diff --git a/config/locales/en.yml b/config/locales/en.yml index 1de8119..8bed5c1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -7,9 +7,11 @@ en: submit: 'Log in' sites: title: 'Sites' + index: 'Sites' footer: powered_by: 'is developed by' posts: + index: 'Posts' edit: 'Edit' save: 'Save' date: 'Publication date' diff --git a/config/locales/es.yml b/config/locales/es.yml index 7f19b02..21914f5 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -7,9 +7,11 @@ es: submit: 'Ingresar' sites: title: 'Sitios' + index: 'Sitios' footer: powered_by: 'es desarrollada por' posts: + index: 'Artículos' edit: 'Editar' save: 'Guardar' date: 'Fecha de publicación'