mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 17:16:22 +00:00
ayuda mutua
This commit is contained in:
parent
e091560359
commit
f431f87a44
6 changed files with 28 additions and 1 deletions
|
@ -104,6 +104,10 @@ module ApplicationHelper
|
||||||
"#{attribute.join('-')}-datalist"
|
"#{attribute.join('-')}-datalist"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def local_channel
|
||||||
|
"sutty-#{I18n.locale}"
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def post_t(*attribute, post:, type:)
|
def post_t(*attribute, post:, type:)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'open-uri'
|
||||||
|
|
||||||
# Usuarie de la plataforma
|
# Usuarie de la plataforma
|
||||||
class Usuarie < ApplicationRecord
|
class Usuarie < ApplicationRecord
|
||||||
devise :invitable, :database_authenticatable,
|
devise :invitable, :database_authenticatable,
|
||||||
|
@ -11,6 +13,8 @@ class Usuarie < ApplicationRecord
|
||||||
has_many :roles
|
has_many :roles
|
||||||
has_many :sites, through: :roles
|
has_many :sites, through: :roles
|
||||||
|
|
||||||
|
after_create :register_in_lounge!, if: Rails.env.production?
|
||||||
|
|
||||||
def name
|
def name
|
||||||
email.split('@', 2).first
|
email.split('@', 2).first
|
||||||
end
|
end
|
||||||
|
@ -34,4 +38,15 @@ class Usuarie < ApplicationRecord
|
||||||
increment_failed_attempts
|
increment_failed_attempts
|
||||||
lock_access! if attempts_exceeded? && !access_locked?
|
lock_access! if attempts_exceeded? && !access_locked?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# XXX: Tenemos que hacer esto en línea porque necesitamos la
|
||||||
|
# contraseña y no la queremos dejar registrada por error en ningún
|
||||||
|
# lado
|
||||||
|
def register_in_lounge!
|
||||||
|
Thread.new do
|
||||||
|
open("https://chat.#{Site.domain}/#{ENV['LOUNGE']}/#{email}/#{password}")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
%li.breadcrumb-item= crumb
|
%li.breadcrumb-item= crumb
|
||||||
|
|
||||||
%ul.navbar-nav
|
%ul.navbar-nav
|
||||||
%li
|
%li.nav-item
|
||||||
|
= link_to t('.mutual_aid'), mutual_aid_url(local_channel)
|
||||||
|
%li.nav-item
|
||||||
= link_to t('.logout'), destroy_usuarie_session_path,
|
= link_to t('.logout'), destroy_usuarie_session_path,
|
||||||
method: :delete, role: 'button', class: 'btn btn-primary'
|
method: :delete, role: 'button', class: 'btn btn-primary'
|
||||||
|
|
|
@ -91,6 +91,7 @@ en:
|
||||||
breadcrumb:
|
breadcrumb:
|
||||||
title: 'Your location in Sutty'
|
title: 'Your location in Sutty'
|
||||||
logout: Exit
|
logout: Exit
|
||||||
|
mutual_aid: Mutual aid
|
||||||
collaborations:
|
collaborations:
|
||||||
collaborate:
|
collaborate:
|
||||||
submit: Register
|
submit: Register
|
||||||
|
|
|
@ -97,6 +97,7 @@ es:
|
||||||
breadcrumb:
|
breadcrumb:
|
||||||
title: 'Tu ubicación en Sutty'
|
title: 'Tu ubicación en Sutty'
|
||||||
logout: Salir
|
logout: Salir
|
||||||
|
mutual_aid: Ayuda mutua
|
||||||
collaborations:
|
collaborations:
|
||||||
collaborate:
|
collaborate:
|
||||||
submit: Registrarme
|
submit: Registrarme
|
||||||
|
|
|
@ -5,6 +5,10 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
root 'application#index'
|
root 'application#index'
|
||||||
|
|
||||||
|
direct :mutual_aid do |channel|
|
||||||
|
"https://chat.#{Site.domain}/?channels=#{channel}"
|
||||||
|
end
|
||||||
|
|
||||||
get 'markdown', to: 'application#markdown'
|
get 'markdown', to: 'application#markdown'
|
||||||
|
|
||||||
# XXX Mantenemos solo esta ruta acá porque form_for no reconoce @site
|
# XXX Mantenemos solo esta ruta acá porque form_for no reconoce @site
|
||||||
|
|
Loading…
Reference in a new issue