Add Site settings > General (#133)

This commit is contained in:
Riccardo Graziosi
2022-07-18 10:47:54 +02:00
committed by GitHub
parent bdc4004e4a
commit 35831b9801
99 changed files with 2405 additions and 281 deletions

View File

@@ -16,20 +16,16 @@ module App
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
def name
ENV["APP_NAME"]
def multi_tenancy?
ENV["MULTI_TENANCY"] == "true"
end
def email_confirmation?
ENV["EMAIL_CONFIRMATION"] == "yes"
end
def show_logo?
ENV["SHOW_LOGO"] == "yes"
ENV["EMAIL_CONFIRMATION"] == "true"
end
def posts_per_page
ENV["POSTS_PER_PAGE"].to_i
15
end
end
end

View File

@@ -1,6 +1,9 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# For subdomains in localhost
config.action_dispatch.tld_length = 0
# For Devise
config.action_mailer.default_url_options = { host: 'localhost:3000' }

View File

@@ -5,7 +5,6 @@
# Set up default environment variables
ENV["EMAIL_CONFIRMATION"] = "no"
ENV["POSTS_PER_PAGE"] = "15"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

View File

@@ -12,19 +12,19 @@ Devise.setup do |config|
# ==> Controller configuration
# Configure the parent class to the devise controllers.
# config.parent_controller = 'DeviseController'
# config.parent_controller = 'ApplicationController'
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
config.mailer_sender = 'notifications@astuto.io'
# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
# Configure the parent class responsible to send e-mails.
# config.parent_mailer = 'ActionMailer::Base'
config.parent_mailer = 'ApplicationMailer'
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and
@@ -166,12 +166,12 @@ Devise.setup do |config|
# ==> Configuration for :validatable
# Range for password length.
config.password_length = 6..128
# config.password_length = 6..128
# Email regex used to validate email formats. It simply asserts that
# one (and only one) @ exists in the given string. This is mainly
# to give user feedback and not to assert the e-mail validity.
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
# config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this

View File

@@ -0,0 +1,6 @@
RESERVED_SUBDOMAINS = [
'showcase',
'login',
'help',
'playground'
]

View File

@@ -2,7 +2,7 @@ en:
common:
forms:
auth:
email: 'Email address'
email: 'Email'
full_name: 'Full name'
password: 'Password'
password_confirmation: 'Password confirmation'
@@ -38,6 +38,7 @@ en:
cancel: 'Cancel'
create: 'Create'
update: 'Save'
confirm: 'Confirm'
datetime:
now: 'just now'
minutes:
@@ -49,6 +50,19 @@ en:
days:
one: '1 day ago'
other: '%{count} days ago'
signup:
page_title: 'Create your feedback space'
step1:
title: '1. Create user account'
email_auth: 'Register with email'
step2:
title: '2. Create feedback space'
site_name: 'Site name'
subdomain: 'Subdomain'
create_button: 'Create feedback space'
step3:
title: "You're almost done!"
message: "Check your email %{email} to activate your new feedback space %{subdomain}!"
header:
menu:
site_settings: 'Site settings'
@@ -57,6 +71,11 @@ en:
log_in: 'Log in / Sign up'
roadmap:
title: 'Roadmap'
pending_tenant:
title: 'Verify your email address'
message: 'We''ve sent an email with an activation link to the email you provided during registration. Click on that link to activate this feedback space!'
blocked_tenant:
title: 'This feedback space has been blocked'
board:
new_post:
submit_button: 'Submit feedback'
@@ -103,6 +122,7 @@ en:
site_settings:
menu:
title: 'Site settings'
general: 'General'
boards: 'Boards'
post_statuses: 'Statuses'
roadmap: 'Roadmap'
@@ -110,6 +130,17 @@ en:
info_box:
up_to_date: 'All changes saved'
error: 'An error occurred: %{message}'
dirty: 'Changes not saved'
general:
title: 'General'
site_name: 'Site name'
site_logo: 'Site logo'
brand_setting: 'Display'
brand_setting_both: 'Both name and logo'
brand_setting_name: 'Name only'
brand_setting_logo: 'Logo only'
brand_setting_none: 'None'
locale: 'Language'
boards:
title: 'Boards'
empty: 'There are no boards. Create one below!'
@@ -127,7 +158,7 @@ en:
title: 'Roadmap'
title2: 'Not in roadmap'
empty: 'The roadmap is empty.'
help: 'You can add statuses to the roadmap by dragging them from the section below. If you instead want to create a new status or change their order, go to Site settings -> Statuses.'
help: 'You can add statuses to the roadmap by dragging them from the section below. If you instead want to create a new status or change their order, go to Site settings > Statuses.'
users:
title: 'Users'
block: 'Block'
@@ -141,23 +172,40 @@ en:
status_active: 'Active'
status_blocked: 'Blocked'
status_deleted: 'Deleted'
user_mailer:
opening_greeting: 'Hello!'
closing_greeting: 'Have a great day!'
learn_more: 'Click here to learn more'
unsubscribe: 'Annoyed? You can turn off notifications here'
notify_post_owner:
subject: '[%{app_name}] New comment on %{post}'
body: 'There is a new comment by %{user} on your post %{post}'
notify_comment_owner:
subject: '[%{app_name}] New reply on your comment from %{post}'
body: 'There is a new reply by %{user} on your comment from post %{post}'
notify_followers_of_post_update:
subject: '[%{app_name}] New update for post %{post}'
body: "There is a new update on the post you're following %{post}"
notify_followers_of_post_status_change:
subject: '[%{app_name}] Status change on post %{post}'
body: "The post you're following %{post} has a new status"
mailers:
devise:
welcome_greeting: 'Welcome to %{site_name}, %{email}!'
opening_greeting: 'Hello %{email}!'
confirmation_instructions:
body: 'You can confirm your account email through the link below:'
action: 'Confirm my account'
email_changed:
body: "We're contacting you to notify you that your email is being changed to %{email}."
body2: "We're contacting you to notify you that your email has been changed to %{email}."
password_change:
body: "We're contacting you to notify you that your password has been changed."
reset_password:
body: 'Someone has requested a link to change your password. You can do this through the link below.'
body2: "If you didn't request this, please ignore this email."
body3: "Your password won't change until you access the link above and create a new one."
action: 'Change my password'
user:
opening_greeting: 'Hello!'
closing_greeting: 'Have a great day!'
learn_more: 'Click here to learn more'
unsubscribe: 'Annoyed? You can turn off notifications here'
notify_post_owner:
subject: '[%{app_name}] New comment on %{post}'
body: 'There is a new comment by %{user} on your post %{post}'
notify_comment_owner:
subject: '[%{app_name}] New reply on your comment from %{post}'
body: 'There is a new reply by %{user} on your comment from post %{post}'
notify_followers_of_post_update:
subject: '[%{app_name}] New update for post %{post}'
body: "There is a new update on the post you're following %{post}"
notify_followers_of_post_status_change:
subject: '[%{app_name}] Status change on post %{post}'
body: "The post you're following %{post} has a new status"
backend:
errors:
unauthorized: 'You are not authorized'

View File

@@ -2,7 +2,7 @@ it:
common:
forms:
auth:
email: 'Indirizzo email'
email: 'Email'
full_name: 'Nome e cognome'
password: 'Password'
password_confirmation: 'Conferma password'
@@ -38,6 +38,7 @@ it:
cancel: 'Annulla'
create: 'Crea'
update: 'Salva'
confirm: 'Conferma'
datetime:
now: 'adesso'
minutes:
@@ -49,6 +50,19 @@ it:
days:
one: '1 giorno fa'
other: '%{count} giorni fa'
signup:
page_title: 'Crea il tuo spazio di feedback'
step1:
title: '1. Crea account utente'
email_auth: 'Registrati con indirizzo email'
step2:
title: '2. Crea spazio di feedback'
site_name: 'Nome del sito'
subdomain: 'Sottodominio'
create_button: 'Crea spazio feedback'
step3:
title: 'Hai quasi finito!'
message: "Controlla la tua email %{email} per attivare il tuo nuovo spazio di feedback %{subdomain}!"
header:
menu:
site_settings: 'Impostazioni sito'
@@ -57,6 +71,11 @@ it:
log_in: 'Accedi / Registrati'
roadmap:
title: 'Roadmap'
pending_tenant:
title: 'Verifica il tuo indirizzo email'
message: 'Abbiamo mandato una email con un link di attivazione all''indirizzo email che hai specificato in fase di registrazione. Clicca su quel link per attivare questo spazio di feedback!'
blocked_tenant:
title: 'This feedback space has been blocked'
board:
new_post:
submit_button: 'Invia feedback'
@@ -103,6 +122,7 @@ it:
site_settings:
menu:
title: 'Impostazioni sito'
general: 'Generali'
boards: 'Bacheche'
post_statuses: 'Stati'
roadmap: 'Roadmap'
@@ -110,6 +130,17 @@ it:
info_box:
up_to_date: 'Tutte le modifiche sono state salvate'
error: 'Si è verificato un errore: %{message}'
dirty: 'Modifiche non salvate'
general:
title: 'Generale'
site_name: 'Nome del sito'
site_logo: 'Logo del sito'
brand_setting: 'Mostra'
brand_setting_both: 'Sia nome che logo'
brand_setting_name: 'Solo nome'
brand_setting_logo: 'Solo logo'
brand_setting_none: 'Nessuno'
locale: 'Lingua'
boards:
title: 'Bacheche'
empty: 'Non ci sono bacheche. Creane una qua sotto!'
@@ -141,23 +172,40 @@ it:
status_active: 'Attivo'
status_blocked: 'Bloccato'
status_deleted: 'Eliminato'
user_mailer:
opening_greeting: 'Ciao!'
closing_greeting: 'Buona giornata!'
learn_more: 'Clicca qui per saperne di più'
unsubscribe: 'Non vuoi più ricevere notifiche? Clicca qui'
notify_post_owner:
subject: '[%{app_name}] Nuovo commento al tuo post %{post}'
body: '%{user} ha commentato il tuo post %{post}'
notify_comment_owner:
subject: '[%{app_name}] Risposta al tuo commento nel post %{post}'
body: '%{user} ha risposto al tuo commento nel post %{post}'
notify_followers_of_post_update:
subject: '[%{app_name}] Nuovo aggiornamento per il post %{post}'
body: "C'è un nuovo aggiornamento sul post che stai seguendo %{post}"
notify_followers_of_post_status_change:
subject: '[%{app_name}] Aggiornamento stato per il post %{post}'
body: "Il post che segui %{post} ha un nuovo stato"
mailers:
devise:
welcome_greeting: 'Benvenuto su %{site_name}, %{email}!'
opening_greeting: 'Ciao %{email}!'
confirmation_instructions:
body: 'Puoi confermare il tuo account cliccando il link qua sotto:'
action: 'Conferma il mio account'
email_changed:
body: "Ti contattiamo per segnalarti che la tua email sta per essere modificata in %{email}."
body2: "Ti contattiamo per segnalarti che la tua email è stata modificata in %{email}."
password_change:
body: "Ti contattiamo per segnalarti che la tua password è stata modificata."
reset_password:
body: 'Qualcuno ha richiesto un link per modificare la tua password. Puoi modificare la tua password cliccando sul link qua sotto.'
body2: "Se non sei stato tu a richiedere la modifica, ti preghiamo di ignorare questa email."
body3: "La tua password non sarà modificata finché non cliccherai sul link qua sopra e ne creerai una nuova."
action: 'Cambia la mia password'
user:
opening_greeting: 'Ciao!'
closing_greeting: 'Buona giornata!'
learn_more: 'Clicca qui per saperne di più'
unsubscribe: 'Non vuoi più ricevere notifiche? Clicca qui'
notify_post_owner:
subject: '[%{app_name}] Nuovo commento al tuo post %{post}'
body: '%{user} ha commentato il tuo post %{post}'
notify_comment_owner:
subject: '[%{app_name}] Risposta al tuo commento nel post %{post}'
body: '%{user} ha risposto al tuo commento nel post %{post}'
notify_followers_of_post_update:
subject: '[%{app_name}] Nuovo aggiornamento per il post %{post}'
body: "C'è un nuovo aggiornamento sul post che stai seguendo %{post}"
notify_followers_of_post_status_change:
subject: '[%{app_name}] Aggiornamento stato per il post %{post}'
body: "Il post che segui %{post} ha un nuovo stato"
backend:
errors:
unauthorized: 'Non sei autorizzato'
@@ -166,4 +214,4 @@ it:
board:
update_order: 'Si è verificato un errore durante il riordinamento delle bacheche'
post_status:
update_order: 'Si è verificato un errore durante il riordinamento degli stati'
update_order: 'Si è verificato un errore durante il riordinamento degli stati'

View File

@@ -1,32 +1,53 @@
Rails.application.routes.draw do
root to: 'static_pages#roadmap'
get '/roadmap', to: 'static_pages#roadmap'
if Rails.application.multi_tenancy?
constraints subdomain: 'showcase' do
root to: 'static_pages#showcase', as: :showcase
end
constraints subdomain: 'login' do
get '/signup', to: 'tenants#new'
resource :tenants, only: [:create]
end
end
constraints subdomain: /.*/ do
root to: 'static_pages#roadmap'
get '/roadmap', to: 'static_pages#roadmap'
get '/pending-tenant', to: 'static_pages#pending_tenant'
get '/blocked-tenant', to: 'static_pages#blocked_tenant'
devise_for :users, :controllers => {
:registrations => 'registrations',
:sessions => 'sessions'
}
resources :tenants, only: [:show, :update]
resources :users, only: [:index, :update]
devise_for :users, :controllers => { :registrations => 'registrations' }
resources :users, only: [:index, :update]
resources :posts, only: [:index, :create, :show, :update, :destroy] do
resource :follows, only: [:create, :destroy]
resources :follows, only: [:index]
resource :likes, only: [:create, :destroy]
resources :likes, only: [:index]
resources :comments, only: [:index, :create, :update, :destroy]
resources :post_status_changes, only: [:index]
end
resources :posts, only: [:index, :create, :show, :update, :destroy] do
resource :follows, only: [:create, :destroy]
resources :follows, only: [:index]
resource :likes, only: [:create, :destroy]
resources :likes, only: [:index]
resources :comments, only: [:index, :create, :update, :destroy]
resources :post_status_changes, only: [:index]
end
resources :boards, only: [:index, :create, :update, :destroy, :show] do
patch 'update_order', on: :collection
end
resources :boards, only: [:index, :create, :update, :destroy, :show] do
patch 'update_order', on: :collection
end
resources :post_statuses, only: [:index, :create, :update, :destroy] do
patch 'update_order', on: :collection
end
namespace :site_settings do
get 'general'
get 'boards'
get 'post_statuses'
get 'roadmap'
get 'users'
resources :post_statuses, only: [:index, :create, :update, :destroy] do
patch 'update_order', on: :collection
end
namespace :site_settings do
get 'general'
get 'boards'
get 'post_statuses'
get 'roadmap'
get 'users'
end
end
end