From cb8032d9e10fd5ed8cba3355cabdb6189bddc96a Mon Sep 17 00:00:00 2001 From: f Date: Sun, 9 May 2021 12:59:33 -0300 Subject: [PATCH 1/8] usar loaf para configurar las breadcrumbs --- Gemfile | 1 + Gemfile.lock | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index 63b921c2..3f100e6b 100644 --- a/Gemfile +++ b/Gemfile @@ -48,6 +48,7 @@ gem 'jekyll-commonmark' gem 'jekyll-images' gem 'jekyll-include-cache' gem 'sutty-liquid' +gem 'loaf' gem 'lockbox' gem 'mini_magick' gem 'mobility' diff --git a/Gemfile.lock b/Gemfile.lock index 5c1d0627..e80d3ccf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -338,6 +338,8 @@ GEM rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) + loaf (0.10.0) + railties (>= 3.2) lockbox (0.6.4) lograge (0.11.2) actionpack (>= 4) @@ -691,6 +693,7 @@ DEPENDENCIES jekyll-include-cache letter_opener listen (>= 3.0.5, < 3.2) + loaf lockbox lograge memory_profiler From 0a5908d02d871eeea42390144b35e92603dc26fe Mon Sep 17 00:00:00 2001 From: f Date: Sun, 9 May 2021 13:02:09 -0300 Subject: [PATCH 2/8] eliminar las migas de pan casero --- app/views/devise/confirmations/new.haml | 2 -- app/views/devise/invitations/edit.haml | 2 -- app/views/devise/invitations/new.haml | 2 -- app/views/devise/passwords/edit.haml | 2 -- app/views/devise/passwords/new.haml | 2 -- app/views/devise/registrations/edit.haml | 2 -- app/views/devise/registrations/new.haml | 2 -- app/views/devise/sessions/new.haml | 2 -- app/views/devise/unlocks/new.haml | 2 -- app/views/i18n/edit.haml | 7 ------- app/views/layouts/_breadcrumb.haml | 21 +++++++-------------- app/views/layouts/application.html.haml | 1 + app/views/posts/edit.haml | 7 ------- app/views/posts/index.haml | 7 ------- app/views/posts/new.haml | 6 ------ app/views/posts/show.haml | 6 ------ app/views/sites/edit.haml | 3 --- app/views/sites/fetch.haml | 3 --- app/views/sites/index.haml | 2 -- app/views/sites/new.haml | 3 --- app/views/usuaries/index.haml | 5 ----- app/views/usuaries/invite.haml | 6 ------ 22 files changed, 8 insertions(+), 87 deletions(-) delete mode 100644 app/views/i18n/edit.haml diff --git a/app/views/devise/confirmations/new.haml b/app/views/devise/confirmations/new.haml index b1080788..59568cb7 100644 --- a/app/views/devise/confirmations/new.haml +++ b/app/views/devise/confirmations/new.haml @@ -1,5 +1,3 @@ -= render 'layouts/breadcrumb', crumbs: nil - = content_for :body do - 'black-bg' diff --git a/app/views/devise/invitations/edit.haml b/app/views/devise/invitations/edit.haml index b8bb4315..565429a8 100644 --- a/app/views/devise/invitations/edit.haml +++ b/app/views/devise/invitations/edit.haml @@ -1,5 +1,3 @@ -= render 'layouts/breadcrumb', crumbs: nil - = content_for :body do - 'black-bg' diff --git a/app/views/devise/invitations/new.haml b/app/views/devise/invitations/new.haml index 8a0e318e..44ceec2e 100644 --- a/app/views/devise/invitations/new.haml +++ b/app/views/devise/invitations/new.haml @@ -1,5 +1,3 @@ -= render 'layouts/breadcrumb', crumbs: nil - = content_for :body do - 'black-bg' diff --git a/app/views/devise/passwords/edit.haml b/app/views/devise/passwords/edit.haml index d5e0778c..7f7b16fb 100644 --- a/app/views/devise/passwords/edit.haml +++ b/app/views/devise/passwords/edit.haml @@ -1,5 +1,3 @@ -= render 'layouts/breadcrumb', crumbs: nil - = content_for :body do - 'black-bg' diff --git a/app/views/devise/passwords/new.haml b/app/views/devise/passwords/new.haml index 75e22859..3c80b8a0 100644 --- a/app/views/devise/passwords/new.haml +++ b/app/views/devise/passwords/new.haml @@ -1,5 +1,3 @@ -= render 'layouts/breadcrumb', crumbs: nil - = content_for :body do - 'black-bg' diff --git a/app/views/devise/registrations/edit.haml b/app/views/devise/registrations/edit.haml index ece85540..1db0329c 100644 --- a/app/views/devise/registrations/edit.haml +++ b/app/views/devise/registrations/edit.haml @@ -1,5 +1,3 @@ -= render 'layouts/breadcrumb', - crumbs: [link_to(t('.index'), sites_path), t('.title')] = content_for :body do - 'black-bg' diff --git a/app/views/devise/registrations/new.haml b/app/views/devise/registrations/new.haml index 92a44aec..cb6ff0d1 100644 --- a/app/views/devise/registrations/new.haml +++ b/app/views/devise/registrations/new.haml @@ -1,5 +1,3 @@ -= render 'layouts/breadcrumb', crumbs: nil - = content_for :body do - 'black-bg' diff --git a/app/views/devise/sessions/new.haml b/app/views/devise/sessions/new.haml index 2826be44..b5223e5f 100644 --- a/app/views/devise/sessions/new.haml +++ b/app/views/devise/sessions/new.haml @@ -1,5 +1,3 @@ -= render 'layouts/breadcrumb', crumbs: nil - = content_for :body do - 'black-bg' diff --git a/app/views/devise/unlocks/new.haml b/app/views/devise/unlocks/new.haml index af5bf50b..ac511115 100644 --- a/app/views/devise/unlocks/new.haml +++ b/app/views/devise/unlocks/new.haml @@ -1,5 +1,3 @@ -= render 'layouts/breadcrumb', crumbs: nil - = content_for :body do - 'black-bg' diff --git a/app/views/i18n/edit.haml b/app/views/i18n/edit.haml deleted file mode 100644 index 3e44af6f..00000000 --- a/app/views/i18n/edit.haml +++ /dev/null @@ -1,7 +0,0 @@ -= render 'layouts/breadcrumb', - crumbs: [link_to(t('sites.index.title'), sites_path), - link_to(@site.name, site_path(@site)), - t('i18n.index'), - t('i18n.edit')] - -= render 'i18n/form' diff --git a/app/views/layouts/_breadcrumb.haml b/app/views/layouts/_breadcrumb.haml index 01765d0d..29201b0e 100644 --- a/app/views/layouts/_breadcrumb.haml +++ b/app/views/layouts/_breadcrumb.haml @@ -3,21 +3,14 @@ = inline_svg_tag 'sutty.svg', class: 'black', aria: true, title: t('svg.sutty.title'), desc: t('svg.sutty.desc') - - if crumbs - %nav{ aria: { label: t('.title') }, role: 'navigation' } - %ol.breadcrumb - %li.breadcrumb-item - = link_to edit_usuarie_registration_path, - data: { toggle: 'tooltip' }, - title: t('help.usuarie.edit') do - = current_usuarie.email - - - crumbs.compact.each do |crumb| - - if crumb == crumbs.last - %li.breadcrumb-item.active{ aria: { current: 'page' } } - = crumb + %nav{ aria: { label: t('.title') } } + %ol.breadcrumb + - breadcrumb_trail do |crumb| + %li.breadcrumb-item{ class: crumb.current? ? 'active' : '' } + - if crumb.current? + %span{ aria: { current: 'page' } }= crumb.name - else - %li.breadcrumb-item= crumb + %span= link_to crumb.name, crumb.url - if current_usuarie %ul.navbar-nav diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 891d635c..85d5ab22 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -20,6 +20,7 @@ %body{ class: yield(:body) } .container-fluid#sutty + = render 'layouts/breadcrumb' = yield - if flash[:js] .js-flash.d-none{ data: flash[:js] } diff --git a/app/views/posts/edit.haml b/app/views/posts/edit.haml index 282d9d05..6ec252fe 100644 --- a/app/views/posts/edit.haml +++ b/app/views/posts/edit.haml @@ -1,10 +1,3 @@ -= render 'layouts/breadcrumb', - crumbs: [link_to(t('sites.index.title'), sites_path), - link_to(@site.name, site_posts_path(@site)), - link_to(t('posts.index'), site_posts_path(@site)), - link_to(@post.title.value, site_post_path(@site, @post.id)), - t('posts.edit')] - .row.justify-content-center .col-md-8 = render 'posts/form', site: @site, post: @post diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index b2f3f661..291945ae 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -1,10 +1,3 @@ -= render 'layouts/breadcrumb', - crumbs: [link_to(t('sites.index.title'), sites_path), - @site.name, - link_to(t('posts.index'), - site_posts_path(@site)), - @category_name] - %main.row %aside.menu.col-md-3 %h1= link_to @site.title, @site.url diff --git a/app/views/posts/new.haml b/app/views/posts/new.haml index adcc843d..6ec252fe 100644 --- a/app/views/posts/new.haml +++ b/app/views/posts/new.haml @@ -1,9 +1,3 @@ -= render 'layouts/breadcrumb', - crumbs: [link_to(t('sites.index.title'), sites_path), - @site.name, - link_to(t('posts.index'), - site_posts_path(@site)), t('posts.new')] - .row.justify-content-center .col-md-8 = render 'posts/form', site: @site, post: @post diff --git a/app/views/posts/show.haml b/app/views/posts/show.haml index 9dd4faa0..9d6f37cd 100644 --- a/app/views/posts/show.haml +++ b/app/views/posts/show.haml @@ -1,9 +1,3 @@ -= render 'layouts/breadcrumb', - crumbs: [link_to(t('sites.index.title'), sites_path), - @site.name, - link_to(t('posts.index'), site_posts_path(@site)), - @post.title.value] - - dir = t("locales.#{@locale}.dir") .row.justify-content-center .col-md-8 diff --git a/app/views/sites/edit.haml b/app/views/sites/edit.haml index cc5977cf..4ae7308d 100644 --- a/app/views/sites/edit.haml +++ b/app/views/sites/edit.haml @@ -1,6 +1,3 @@ -= render 'layouts/breadcrumb', - crumbs: [link_to(t('sites.index.title'), sites_path), - t('.title', site: @site.name)] .row.justify-content-center .col-md-8 %h1= t('.title', site: @site.name) diff --git a/app/views/sites/fetch.haml b/app/views/sites/fetch.haml index 6a16e2e0..f5d049c8 100644 --- a/app/views/sites/fetch.haml +++ b/app/views/sites/fetch.haml @@ -1,6 +1,3 @@ -= render 'layouts/breadcrumb', - crumbs: [link_to(t('sites.index.title'), sites_path), t('.title')] - .row.justify-content-center .col-md-8#pull %h1= t('.title') diff --git a/app/views/sites/index.haml b/app/views/sites/index.haml index 07ea670a..dfcc2203 100644 --- a/app/views/sites/index.haml +++ b/app/views/sites/index.haml @@ -1,5 +1,3 @@ -= render 'layouts/breadcrumb', crumbs: [t('sites.index.title')] - %main.row %aside.col-md-3 %h1= t('.title') diff --git a/app/views/sites/new.haml b/app/views/sites/new.haml index fa724421..68c17882 100644 --- a/app/views/sites/new.haml +++ b/app/views/sites/new.haml @@ -1,6 +1,3 @@ -= render 'layouts/breadcrumb', - crumbs: [link_to(t('sites.index.title'), sites_path), t('.title')] - .row.justify-content-center .col-md-8 %h1= t('.title') diff --git a/app/views/usuaries/index.haml b/app/views/usuaries/index.haml index c3c6c3b4..c0eedefd 100644 --- a/app/views/usuaries/index.haml +++ b/app/views/usuaries/index.haml @@ -1,8 +1,3 @@ -= render 'layouts/breadcrumb', - crumbs: [link_to(t('sites.index.title'), sites_path), - link_to(@site.name, @site), - t('.title')] - .row .col %h1= t('.title') diff --git a/app/views/usuaries/invite.haml b/app/views/usuaries/invite.haml index 62552e70..919ae92b 100644 --- a/app/views/usuaries/invite.haml +++ b/app/views/usuaries/invite.haml @@ -1,11 +1,5 @@ - invite_as = t("usuaries.invite_as.#{params[:invite_as]}") -= render 'layouts/breadcrumb', - crumbs: [link_to(t('sites.index.title'), sites_path), - @site.name, - link_to(t('posts.index'), site_usuaries_path(@site)), - t('.title', invite_as: invite_as)] - .row .col %h1= t('.title', invite_as: invite_as) From 88051425ae18ca29b4641a00151acfadf1beec13 Mon Sep 17 00:00:00 2001 From: f Date: Sun, 9 May 2021 13:08:18 -0300 Subject: [PATCH 3/8] =?UTF-8?q?agregar=20migas=20de=20pan=20comunes=20y=20?= =?UTF-8?q?en=20cada=20acci=C3=B3=C3=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit las migas que van dentro de cada acción son strings vacías porque no las estamos vinculando a nada, así que nos ahorramos el proceso. --- app/controllers/posts_controller.rb | 36 ++++++++++++-------------- app/controllers/sites_controller.rb | 9 +++++++ app/controllers/usuaries_controller.rb | 7 +++++ 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index a4b47a16..57c6348a 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -7,6 +7,11 @@ class PostsController < ApplicationController before_action :authenticate_usuarie! + # TODO: Traer los comunes desde ApplicationController + breadcrumb -> { current_usuarie.email }, :edit_usuarie_registration_path + breadcrumb 'sites.index', :sites_path, match: :exact + breadcrumb -> { site.title }, -> { site_posts_path(site, locale: locale) }, match: :exact + # Las URLs siempre llevan el idioma actual o el de le usuarie def default_url_options { locale: params[:locale] || current_usuarie&.lang || I18n.locale } @@ -43,44 +48,34 @@ class PostsController < ApplicationController end def show - @site = find_site - @post = @site.posts(lang: locale).find params[:id] - - authorize @post - @locale = locale - - fresh_when @post + authorize post + breadcrumb post.title.value, '' + fresh_when post end # Genera una previsualización del artículo. - # - # TODO: No todos los artículos tienen previsualización! def preview - @site = find_site - @post = @site.posts(lang: locale).find params[:post_id] + authorize post - authorize @post - - render html: @post.render + render html: post.render end def new authorize Post - @site = find_site - @post = @site.posts.build(lang: locale, layout: params[:layout]) - @locale = locale + @post = site.posts.build(lang: locale, layout: params[:layout]) + + breadcrumb I18n.t('loaf.breadcrumbs.posts.new', layout: @post.layout.humanized_name.downcase), '' end def create authorize Post - @site = find_site - service = PostService.new(site: @site, + service = PostService.new(site: site, usuarie: current_usuarie, params: params) @post = service.create if @post.persisted? - @site.touch + site.touch forget_content redirect_to site_post_path(@site, @post) @@ -96,6 +91,7 @@ class PostsController < ApplicationController authorize @post @locale = locale + breadcrumb @post.title.value, site_post_path(@site, @post, locale: locale), match: :exact end def update diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index d7d2f9f6..f3114d9a 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -7,6 +7,9 @@ class SitesController < ApplicationController before_action :authenticate_usuarie! + breadcrumb -> { current_usuarie.email }, :edit_usuarie_registration_path + breadcrumb 'sites.index', :sites_path, match: :exact + # Ver un listado de sitios def index authorize Site @@ -24,6 +27,8 @@ class SitesController < ApplicationController end def new + breadcrumb 'sites.new', :new_site_path + @site = Site.new authorize @site @@ -43,6 +48,10 @@ class SitesController < ApplicationController def edit authorize site + + breadcrumb site.title, site_posts_path(site), match: :exact + breadcrumb 'sites.edit', site_path(site) + SiteService.new(site: site).build_deploys end diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index 71deee91..fdfa66a8 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -7,12 +7,19 @@ class UsuariesController < ApplicationController include Pundit before_action :authenticate_usuarie! + # TODO: Traer los comunes desde ApplicationController + breadcrumb -> { current_usuarie.email }, :edit_usuarie_registration_path + breadcrumb 'sites.index', :sites_path, match: :exact + breadcrumb -> { site.title }, -> { site_posts_path(site, locale: locale) }, match: :exact + # Mostrar todes les usuaries e invitades de un sitio def index @site = find_site site_usuarie = SiteUsuarie.new(@site, current_usuarie) authorize site_usuarie + breadcrumb 'usuaries.index', '' + @policy = policy(site_usuarie) end From 8fe343ae45338d6434671ea103cf34aaf853c5ff Mon Sep 17 00:00:00 2001 From: f Date: Sun, 9 May 2021 13:10:00 -0300 Subject: [PATCH 4/8] hay migas que van dentro de sus vistas porque modificar el controlador de devise solo para agregar la miga de pan es demasiado trabajo --- app/views/devise/registrations/edit.haml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/devise/registrations/edit.haml b/app/views/devise/registrations/edit.haml index 1db0329c..6a25da65 100644 --- a/app/views/devise/registrations/edit.haml +++ b/app/views/devise/registrations/edit.haml @@ -1,3 +1,4 @@ +- breadcrumb 'sites.index', sites_path = content_for :body do - 'black-bg' From a9da4b3f2c3ef3a298dd4b75ec18752f39538dc3 Mon Sep 17 00:00:00 2001 From: f Date: Sun, 9 May 2021 13:11:15 -0300 Subject: [PATCH 5/8] =?UTF-8?q?ya=20que=20estaba,=20un=20poco=20de=20refac?= =?UTF-8?q?torizaci=C3=B3n=20para=20no=20escribir=20tantas=20@?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit memoizamos site y post cuando podemos --- app/controllers/posts_controller.rb | 57 +++++++++++++------------- app/controllers/usuaries_controller.rb | 7 +++- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 57c6348a..e8ceeebf 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -85,31 +85,24 @@ class PostsController < ApplicationController end def edit - @site = find_site - @post = @site.posts(lang: locale).find params[:id] - - authorize @post - - @locale = locale - breadcrumb @post.title.value, site_post_path(@site, @post, locale: locale), match: :exact + authorize post + breadcrumb post.title.value, site_post_path(site, post, locale: locale), match: :exact + breadcrumb 'posts.edit', '' end def update - @site = find_site - @post = @site.posts(lang: locale).find params[:id] + authorize post - authorize @post - - service = PostService.new(site: @site, - post: @post, + service = PostService.new(site: site, + post: post, usuarie: current_usuarie, params: params) if service.update.persisted? - @site.touch + site.touch forget_content - redirect_to site_post_path(@site, @post) + redirect_to site_post_path(site, post) else render 'posts/edit' end @@ -117,34 +110,30 @@ class PostsController < ApplicationController # Eliminar artículos def destroy - @site = find_site - @post = @site.posts(lang: locale).find params[:id] + authorize post - authorize @post - - service = PostService.new(site: @site, - post: @post, + service = PostService.new(site: site, + post: post, usuarie: current_usuarie, params: params) # TODO: Notificar si se pudo o no service.destroy - @site.touch - redirect_to site_posts_path(@site) + site.touch + redirect_to site_posts_path(site) end # Reordenar los artículos def reorder - @site = find_site - authorize @site + authorize site - service = PostService.new(site: @site, + service = PostService.new(site: site, usuarie: current_usuarie, params: params) service.reorder - @site.touch - redirect_to site_posts_path(@site) + site.touch + redirect_to site_posts_path(site) end # Devuelve el idioma solicitado a través de un parámetro, validando @@ -155,7 +144,7 @@ class PostsController < ApplicationController # solicite a le usuarie crear el nuevo idioma y que esto lo agregue al # _config.yml del sitio en lugar de mezclar idiomas. def locale - @site&.locales&.find(-> { I18n.locale }) do |l| + @locale ||= site&.locales&.find(-> { I18n.locale }) do |l| l.to_s == params[:locale] end end @@ -165,4 +154,14 @@ class PostsController < ApplicationController def forget_content flash[:js] = { target: 'editor', action: 'forget-content', keys: (params[:storage_keys] || []).to_json } end + + private + + def site + @site ||= find_site + end + + def post + @post ||= site.posts(lang: locale).find(params[:post_id] || params[:id]) + end end diff --git a/app/controllers/usuaries_controller.rb b/app/controllers/usuaries_controller.rb index fdfa66a8..6d02a35a 100644 --- a/app/controllers/usuaries_controller.rb +++ b/app/controllers/usuaries_controller.rb @@ -14,8 +14,7 @@ class UsuariesController < ApplicationController # Mostrar todes les usuaries e invitades de un sitio def index - @site = find_site - site_usuarie = SiteUsuarie.new(@site, current_usuarie) + site_usuarie = SiteUsuarie.new(site, current_usuarie) authorize site_usuarie breadcrumb 'usuaries.index', '' @@ -163,4 +162,8 @@ class UsuariesController < ApplicationController 'invitade' end end + + def site + @site ||= find_site + end end From 1a4d1b13f932fe045966479283e3836d72c38279 Mon Sep 17 00:00:00 2001 From: f Date: Sun, 9 May 2021 13:11:50 -0300 Subject: [PATCH 6/8] traducciones --- config/locales/en.yml | 11 +++++++++++ config/locales/es.yml | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index 192a57c6..7e7f2646 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -579,3 +579,14 @@ en: local_invalid: "format is incorrect" not_allowed: "that email provider is not welcome here" server_not_available: "remote email server not available" + loaf: + breadcrumbs: + sites: + index: 'My sites' + new: 'Create' + edit: 'Configure' + posts: + new: 'New %{layout}' + edit: 'Editing' + usuaries: + index: 'Users' diff --git a/config/locales/es.yml b/config/locales/es.yml index 4cdca67e..c9c42c60 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -608,3 +608,14 @@ es: local_invalid: "el formato es incorrecto" not_allowed: "no es bienvenida" server_not_available: "el proveedor no está disponible" + loaf: + breadcrumbs: + sites: + index: 'Mis sitios' + new: 'Crear' + edit: 'Configurar' + posts: + new: 'Nuevo %{layout}' + edit: 'Editando' + usuaries: + index: 'Usuaries' From c2b150df121b11cb11ad0aa4bda12e3eb059afc7 Mon Sep 17 00:00:00 2001 From: f Date: Sun, 9 May 2021 13:12:06 -0300 Subject: [PATCH 7/8] migas responsivas --- app/assets/stylesheets/application.scss | 7 +++++++ app/views/layouts/_breadcrumb.haml | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 0a215c48..5886a2a7 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -355,6 +355,13 @@ $bezier: cubic-bezier(0.75, 0, 0.25, 1); .text-column-#{$size} { column-count: $size; } + + .line-clamp-#{$size} { + overflow: hidden; + display: -webkit-box; + -webkit-line-clamp: $size; + -webkit-box-orient: vertical; + } } /* diff --git a/app/views/layouts/_breadcrumb.haml b/app/views/layouts/_breadcrumb.haml index 29201b0e..c4920bc7 100644 --- a/app/views/layouts/_breadcrumb.haml +++ b/app/views/layouts/_breadcrumb.haml @@ -4,13 +4,13 @@ title: t('svg.sutty.title'), desc: t('svg.sutty.desc') %nav{ aria: { label: t('.title') } } - %ol.breadcrumb + %ol.breadcrumb.m-0.flex-wrap - breadcrumb_trail do |crumb| %li.breadcrumb-item{ class: crumb.current? ? 'active' : '' } - if crumb.current? - %span{ aria: { current: 'page' } }= crumb.name + %span.line-clamp-1{ aria: { current: 'page' } }= crumb.name - else - %span= link_to crumb.name, crumb.url + %span.line-clamp-1= link_to crumb.name, crumb.url - if current_usuarie %ul.navbar-nav From f3fcf11da3155f01208f5205ef94791e42a7abbc Mon Sep 17 00:00:00 2001 From: f Date: Sun, 9 May 2021 13:12:22 -0300 Subject: [PATCH 8/8] =?UTF-8?q?acomodar=20la=20secci=C3=B3n=20de=20usuarie?= =?UTF-8?q?s=20al=20resto=20del=20sitio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/usuaries/index.haml | 37 ++++++++++++++++------------------ app/views/usuaries/invite.haml | 6 ++---- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/app/views/usuaries/index.haml b/app/views/usuaries/index.haml index c0eedefd..124fb04b 100644 --- a/app/views/usuaries/index.haml +++ b/app/views/usuaries/index.haml @@ -1,27 +1,24 @@ -.row - .col +.row.justify-content-center + .col.col-md-8 %h1= t('.title') -.row - .col -# Una tabla de usuaries y otra de invitades, con acciones - %i[usuaries invitades].each do |u| - %h2 - = t(".#{u}") - .btn-group{ role: 'group', 'aria-label': t('.actions') } - - if @policy.invite? - = link_to t('.invite'), - site_usuaries_invite_path(@site, invite_as: u.to_s), - class: 'btn', - data: { toggle: 'tooltip' }, - title: t('.help.invite', invite_as: u.to_s) - - if policy(Collaboration.new(@site)).collaborate? - = link_to t('.public_invite'), - site_collaborate_path(@site), - class: 'btn', - data: { toggle: 'tooltip' }, - title: t('.help.public_invite') - %p= t(".help.#{u}") + %h2.mt-5= t(".#{u}") + .btn-group{ role: 'group', 'aria-label': t('.actions') } + - if @policy.invite? + = link_to t('.invite'), + site_usuaries_invite_path(@site, invite_as: u.to_s), + class: 'btn', + data: { toggle: 'tooltip' }, + title: t('.help.invite', invite_as: u.to_s) + - if policy(Collaboration.new(@site)).collaborate? + = link_to t('.public_invite'), + site_collaborate_path(@site), + class: 'btn', + data: { toggle: 'tooltip' }, + title: t('.help.public_invite') + %p.lead= t(".help.#{u}") %table.table.table-condensed %tbody - @site.send(u).each do |cuenta| diff --git a/app/views/usuaries/invite.haml b/app/views/usuaries/invite.haml index 919ae92b..26eb5039 100644 --- a/app/views/usuaries/invite.haml +++ b/app/views/usuaries/invite.haml @@ -1,11 +1,9 @@ - invite_as = t("usuaries.invite_as.#{params[:invite_as]}") -.row - .col +.row.justify-content-center + .col.col-md-8 %h1= t('.title', invite_as: invite_as) -.row - .col = form_with url: site_usuaries_invite_path(@site), local: true do |f| = f.hidden_field :invited_as, value: params[:invite_as].singularize .form-group