diff --git a/Capfile b/Capfile index 0f81c16..da85f9d 100644 --- a/Capfile +++ b/Capfile @@ -16,7 +16,11 @@ require 'capistrano/deploy' # https://github.com/capistrano/passenger # require 'capistrano/rails' -require 'capistrano/rbenv' + +stage = ARGV.first +if stage == 'staging' # Sorry, production is not ready yet + require 'capistrano/rbenv' +end # Load custom tasks from `lib/capistrano/tasks` if you have any defined Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 364c77d..b24eb34 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -895,3 +895,15 @@ form .checkbox input[type="checkbox"] { } } } + +.errors { + padding: 3em; + + h3 { + margin-left: auto; + margin-right: auto; + max-width: 75%; + padding: 1em; + line-height: 1.6em; + } +} \ No newline at end of file diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb new file mode 100644 index 0000000..479fe79 --- /dev/null +++ b/app/controllers/errors_controller.rb @@ -0,0 +1,9 @@ +class ErrorsController < ApplicationController + def not_found + render status: 404 + end + + def internal_server_error + render status: 500 + end +end diff --git a/app/views/errors/internal_server_error.html.erb b/app/views/errors/internal_server_error.html.erb new file mode 100644 index 0000000..24030fb --- /dev/null +++ b/app/views/errors/internal_server_error.html.erb @@ -0,0 +1,5 @@ +
+

<%= t('.title') %>

+

<%= t('.description') %>

+

<%= link_to t('global.home'), root_path, class: 'btn btn-default' %>

+
\ No newline at end of file diff --git a/app/views/errors/not_found.html.erb b/app/views/errors/not_found.html.erb new file mode 100644 index 0000000..24030fb --- /dev/null +++ b/app/views/errors/not_found.html.erb @@ -0,0 +1,5 @@ +
+

<%= t('.title') %>

+

<%= t('.description') %>

+

<%= link_to t('global.home'), root_path, class: 'btn btn-default' %>

+
\ No newline at end of file diff --git a/config/application.rb b/config/application.rb index 0617d3e..97613f1 100644 --- a/config/application.rb +++ b/config/application.rb @@ -25,5 +25,8 @@ module Timeoverflow # Do not swallow errors in after_commit/after_rollback callbacks. config.active_record.raise_in_transactional_callbacks = true + + # This tells Rails to serve error pages from the app itself, rather than using static error pages in public/ + config.exceptions_app = self.routes end end diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 75d47b0..a07718d 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -65,7 +65,7 @@ ca: identity_document: DNI last_sign_in_at: Data darrera connexió notifications: Rebre notificacions - organization: + organization: Organització phone: Telèfon registration_date: Data d'alta registration_number: Codi d'usuari @@ -127,7 +127,7 @@ ca: sing_out: Desconnectar menus: offers_by_tag_link: - tags: + tags: Etiquetes navbar: admin: Administrar administration: Administració @@ -246,8 +246,8 @@ ca: remember_me: Recorda'm sign_in: Entrar user: - signed_in: - signed_out: + signed_in: Has iniciat sessió + signed_out: Has tancat la sessió shared: links: didnt_receive_confirmation_instructions: Tornar a enviar correu de confirmació @@ -265,6 +265,9 @@ ca: send_paranoid_instructions: Si el teu compte existeix, rebràs un correu amb instruccions de com desbloquejar el teu compte en uns minuts. unlocked: El teu compte ha estat desbloquejat. Si us plau, entra per continuar. errors: + internal_server_error: + description: 'Ho sentim, sembla que hi ha un error en aquesta consulta. Una notificació s''ha enviat directament al equip tècnic, ho resoldrem tant aviat com sigui possible. ' + title: Error intern de servidor messages: already_confirmed: ja has estat confirmat, prova a entrar-hi confirmation_period_expired: necessita confirmar-se en %{period}, si us plau, sol·licita-la de nou @@ -274,6 +277,9 @@ ca: not_saved: one: 'un error impedeix que aquest %{resource} es desi:' other: 'hi ha %{count} errors que impedeixen que aquest %{resource} es desi:' + not_found: + description: La pàgina que cerques no existeix. Potser la adreça està equivocada o la pàgina s'ha mogut. + title: No s'ha trobat global: add_new: Crear nou all: Tot @@ -289,6 +295,7 @@ ca: edit: Modificar filter: Filtre give_time: Transferir temps + home: Inici information: Informació locales_header: canviar llengua member_count: 'Nombre d''usuaris:' @@ -306,7 +313,7 @@ ca: actions: Accions inquiries: edit: - submit: + submit: Canviar demanda index: new_inquiry: Nova demanda new: @@ -337,7 +344,7 @@ ca: text_donation_link: 1€ al mes offers: edit: - submit: + submit: Canviar Oferta index: by_category: Per categoria by_tag: Per etiqueta @@ -493,10 +500,13 @@ ca: give_time: Donar Temps a index: actions: Accions - active_warning: Vas a canviar l'estat del compte de l'usuari %{username} - cancel_warning: Vas a eliminar del banc a l'usuari %{username} + active_warning: Estàs a punt de canviar l'estat de l'usuari %{username} + active_warning_angular: Vas a canviar l'estat del compte de l'usuari {{username}} + cancel_warning: Estàs a punt d'esborrar el compte de l'usuari %{username} + cancel_warning_angular: Vas a eliminar del banc a l'usuari {{username}} create: Crear nou usuari - manage_warning: Vas a canviar els permisos de l'usuari %{username} + manage_warning: Estàs a punt de canviar els permisos de l'usuari %{username} + manage_warning_angular: Vas a canviar els permisos de l'usuari {{username}} user_created: Usuari %{uid} %{name} guardat new: cancel: Cancel·lar diff --git a/config/locales/en.yml b/config/locales/en.yml index 2e26b68..b092103 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -221,20 +221,20 @@ en: registrations: destroyed: Bye! Your account was successfully cancelled. We hope to see you again soon. edit: - cancel_account: - current_password: - edit_user: - help_current_password: - help_password: - password: - password_confirmation: - unhappy: - update: + cancel_account: + current_password: + edit_user: + help_current_password: + help_password: + password: + password_confirmation: + unhappy: + update: new: - password: - password_confirmation: - sign_me_up: - sign_up: + password: + password_confirmation: + sign_me_up: + sign_up: signed_up: Welcome! You have signed up successfully. signed_up_but_inactive: You have signed up successfully. However, we could not sign you in because your account is not yet activated. signed_up_but_locked: You have signed up successfully. However, we could not sign you in because your account is locked. @@ -265,6 +265,9 @@ en: send_paranoid_instructions: If your account exists, you will receive an email with instructions about how to unlock it in a few minutes. unlocked: Your account has been unlocked successfully. Please sign in to continue. errors: + internal_server_error: + description: We're sorry, there seems to be an error with this request. A notification has automatically been sent to us, and we will resolve this as soon as possible. + title: Internal server error messages: already_confirmed: was already confirmed, please try signing in confirmation_period_expired: needs to be confirmed within %{period}, please request a new one @@ -274,6 +277,9 @@ en: not_saved: one: '1 error prohibited this %{resource} from being saved:' other: "%{count} errors prohibited this %{resource} from being saved:" + not_found: + description: The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved. + title: Not found global: add_new: Create new all: All @@ -289,6 +295,7 @@ en: edit: Update filter: Filter give_time: Time transfer + home: Home information: Information locales_header: change language member_count: 'Number of users:' @@ -321,14 +328,14 @@ en: report: report_title: REPORT locales: - ar: + ar: ca: Catalan en: English es: Spanish - eu: - fr: - gl: - pt: + eu: + fr: + gl: + pt: pt-BR: Portuguese mailers_globals: footer: @@ -494,9 +501,12 @@ en: index: actions: Actions active_warning: You are going to change user account status for %{username} + active_warning_angular: You are going to change user account status for {{username}} cancel_warning: You are going to delete account from the Time Bank for user %{username} + cancel_warning_angular: You are going to delete account from the Time Bank for user {{username}} create: Create new user manage_warning: You are going to change privileges for user %{username} + manage_warning_angular: You are going to change privileges for user {{username}} user_created: User %{uid} %{name} saved new: cancel: Cancel @@ -530,8 +540,8 @@ en: manage_warning: You are going to change privileges for user %{user} views: pagination: - first: - last: - next: - previous: - truncate: + first: + last: + next: + previous: + truncate: diff --git a/config/locales/es.yml b/config/locales/es.yml index e4098b6..0499f3a 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -65,7 +65,7 @@ es: identity_document: DNI last_sign_in_at: Fecha último login notifications: Recibir notificaciones - organization: + organization: Organización phone: Teléfono registration_date: Fecha de alta registration_number: Código de usuario @@ -127,7 +127,7 @@ es: sing_out: Desconectar menus: offers_by_tag_link: - tags: + tags: Etiquetas navbar: admin: Administrar administration: Administración @@ -246,8 +246,8 @@ es: remember_me: Recordarme sign_in: Entrar user: - signed_in: - signed_out: + signed_in: Has iniciado la sesión + signed_out: Has cerrado la sesión shared: links: didnt_receive_confirmation_instructions: Volver a enviar correo de confirmación @@ -265,6 +265,9 @@ es: send_paranoid_instructions: Si tu cuenta existe, recibirás un correo con instrucciones de como desbloquearla en unos minutos. unlocked: Tu cuenta ha sido desbloqueada. Por favor, entra para continuar. errors: + internal_server_error: + description: Lo sentimos, parece que hay un error en esta consulta. Una notificación se ha enviado automáticamente al departamento técnico y lo resolveremos lo antes posible. + title: Error interno de servidor messages: already_confirmed: ya fue confirmado, por favor prueba a entrar confirmation_period_expired: necesita confirmarse en %{period}, por favor, solicita uno nuevo @@ -274,6 +277,9 @@ es: not_saved: one: '1 error impide que este %{resource} se guarde:' other: "%{count} errores impiden que este %{resource} se guarde:" + not_found: + description: La página que estás buscando no existe. Quizás la dirección no es correcta o la página ha sido movida. + title: No se encontró global: add_new: Crear nuevo all: Todo @@ -289,6 +295,7 @@ es: edit: Modificar filter: Filtro give_time: Transferir tiempo + home: Inicio information: Información locales_header: cambiar idioma member_count: 'Número de usuarios:' @@ -493,10 +500,13 @@ es: give_time: Dar Tiempo a index: actions: Acciones - active_warning: Va a cambiar el estado de la cuenta del usuario %{username} - cancel_warning: Va a eliminar del banco al usuario %{username} + active_warning: Estás a punto de cambiar el estado del usuario %{username} + active_warning_angular: Va a cambiar el estado de la cuenta del usuario {{username}} + cancel_warning: Estás a punto de borrar la cuenta al usuario %{username} + cancel_warning_angular: Va a eliminar del banco al usuario {{username}} create: Crear nuevo usuario - manage_warning: Va a cambiar los privilegios del usuario %{username} + manage_warning: Estás a punto de cambiar los permisos del usuario %{username} + manage_warning_angular: Va a cambiar los privilegios del usuario {{username}} user_created: Usuario %{uid} %{name} guardado new: cancel: Cancelar diff --git a/config/locales/eu.yml b/config/locales/eu.yml index f257638..b08c0dd 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -271,6 +271,9 @@ eu: send_paranoid_instructions: Zure imeila existitzen bada, segidan iritsiko zaizu , zure kontua nola desbloqueatu argituko dizun imeila unlocked: Zure kontua desblokeatua izan da. Sartu jarraitzeko. errors: + internal_server_error: + description: + title: messages: already_confirmed: Baieztatu izan da , Saiatu sartzen. confirmation_period_expired: "%{period}an baieztatzea beharrezkoa da. Eskatu berria." @@ -280,6 +283,9 @@ eu: not_saved: one: Arazo batek ez du uzten %{resource} gorde dadin. other: "%{count} arazok ez dute uzten %{resource} gorde dadin" + not_found: + description: + title: global: add_new: Berria sortu all: Dena. @@ -295,10 +301,11 @@ eu: edit: Aldaketak egin filter: Iragazkia give_time: Denbora eman + home: information: Informazioa locales_header: Hizkuntza aldatu member_count: Erabiltzaile zenbakia - more: Gehiago ikusi + more: 'Gehiago ikusi ' movements: Mugimenduak promote: Administratzaile bihurtu reason: Arrazoia @@ -374,9 +381,9 @@ eu: banner-button: Sartzea eskatzen du banner-subtitle: Martxan jartzen edo erakustaldi bat eginez lagunduko dizugu banner-title: Denbora banku bat al zara? - donate-text: komunitate askori babesteko asmotan ADBdt elakrteak , TimeOverflow plataforma eskaintzen die Denbora Banku guztiei. Hausnar ezazu %{donate_link} mantenu eta berritze lanetarako laguntzeko. + donate-text: komunitate askori babesteko asmotan ADBdt elkarteak , TimeOverflow plataforma eskaintzen die Denbora Banku guztiei. Hausnar ezazu %{donate_link} mantenu eta berritze lanetan laguntzeko. donate-title: Laguntzan parte hartu - donate_link: Hilean €1 eman + donate_link: Hilean €1 ematea empower-adbdt: ADBdt empower-adbdt-title: Denbora Bankuen garapenerako elkartea empower-coopdevs: CoopDevs @@ -385,8 +392,8 @@ eu: empower-github-title: Github empower-showmap: Mapa ikusi empower-showmap-title: Denbora bankuak - empower-text-1: TimeOveflow denbora bankuentzat diseinaturik dago — %{showmap_link}. Bere helburua ahuek bultztzea da. - empower-text-2: "%{abdt_link} a eta %{coopdevs_link}ren elkarlanari esker , TimeOverflow sofwarea eskain diezaiekegu hala behar duten denbora banku guztiei, era libre eta dohakoan." + empower-text-1: TimeOveflow denbora bankuentzat diseinaturik dago — %{showmap_link}. Bere helburua hauek bultzatzea da. + empower-text-2: "%{abdt_link} eta %{coopdevs_link}ren elkarlanari esker , TimeOverflow softwarea eskain diezaiekegu, hala behar duten denbora banku guztiei, era libre eta dohakoan." empower-text-3: TimeOverflowren oinarrizko kodea, eskuragarri dago, open source lizentziapean eta hemen %{github_link} jaits daiteke empower-title: Denbora bankuak enpoderatuz feature-group-1: Denbora bankuaren kudeaketa administrazio profilen bidez. @@ -398,8 +405,8 @@ eu: feature-text-5: Eskaintza eta eskariak argitaratu feature-text-6: Beste erabiltzaileei orduak ordaindu subtitle: TimeOverflow librea dohakoa eta kolaborazio bidezkoa da - title: Software hau denentzat da - title2: Denbora bankuak + title: Denbora bankuek diseinaturiko softwarea, + title2: Denbora bankuentzat posts: show: info: "%{type} %{organization}koaren datuak ikusteko, hau egin behar duzu" @@ -499,9 +506,12 @@ eu: give_time: honi denbora eman index: actions: Ekintzak + active_warning: active_warning_angular: " {{username}} erabiltzailearen kontuaren egoera, aldatuko duzu." + cancel_warning: cancel_warning_angular: " {{username}} erabiltzailea D bankutik ezabatuko duzu." create: Erabiltzaile berria sortu + manage_warning: manage_warning_angular: " {{username}} erabiltzailearen onurak, aldatuko diztuzu" user_created: "%{uid} %{name} erabiltzailea gorde da" new: diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index fbcf7a8..307aea3 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -265,6 +265,9 @@ pt-BR: send_paranoid_instructions: Se tua conta existe, você receberá um e-mail com instruções de como desbloqueá-la em alguns minutos. unlocked: Tua conta foi desbloqueada. Por favor, entre para continuar. errors: + internal_server_error: + description: + title: messages: already_confirmed: já foi confirmado, por favor tente entrar confirmation_period_expired: É necessário se confirmar em %{period}, por favor, solicite um novo @@ -274,6 +277,9 @@ pt-BR: not_saved: one: '1 erro impede que este %{resource} se guarde:' other: "%{count} erros impedem que este %{resource} se guarde:" + not_found: + description: + title: global: add_new: Criar novo all: Tudo @@ -289,6 +295,7 @@ pt-BR: edit: Modificar filter: Filtro give_time: Transferir tempo + home: information: Informação locales_header: Trocar idioma member_count: 'Número de usuários:' @@ -493,10 +500,13 @@ pt-BR: give_time: Dar Tempo a index: actions: Ações - active_warning: Mudará o estado da conta do usuário %{username} - cancel_warning: Eliminará o usuário do banco %{username} + active_warning: + active_warning_angular: Mudará o estado da conta do usuário {{username}} + cancel_warning: + cancel_warning_angular: Eliminará o usuário do banco {{username}} create: Criar novo usuário - manage_warning: Mudará os privilégios do usuário %{username} + manage_warning: + manage_warning_angular: Mudará os privilégios do usuário {{username}} user_created: Usuário %{uid} %{name} guardado new: cancel: Cancelar diff --git a/config/routes.rb b/config/routes.rb index 409c521..480f87f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -78,4 +78,6 @@ Rails.application.routes.draw do end end + match '/404', to: 'errors#not_found', via: :all + match '/500', to: 'errors#internal_server_error', via: :all end diff --git a/config/unicorn.rb b/config/unicorn.rb new file mode 100644 index 0000000..68fc501 --- /dev/null +++ b/config/unicorn.rb @@ -0,0 +1,29 @@ +app_path = File.expand_path(File.dirname(__FILE__) + '/..') + +worker_processes 2 + +listen 8080, tcp_nopush: true + +working_directory app_path + +pid app_path + '/tmp/unicorn.pid' + +stderr_path '/var/www/timeoverflow/shared/log/unicorn.err.log' +stdout_path '/var/www/timeoverflow/shared/log/unicorn.std.log' + +# Load the app up before forking +# Combine Ruby 2.0.0+ with "preload_app true" for memory savings +preload_app true + +before_fork do |server, worker| + # the following is highly recomended for Rails + "preload_app true" + # as there's no need for the master process to hold a connection + defined?(ActiveRecord::Base) and + ActiveRecord::Base.connection.disconnect! +end + +after_fork do |server, worker| + # the following is *required* for Rails + "preload_app true" + defined?(ActiveRecord::Base) and + ActiveRecord::Base.establish_connection +end diff --git a/public/404.html b/public/404.html deleted file mode 100644 index 9a48320..0000000 --- a/public/404.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - -
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

-
- - diff --git a/public/422.html b/public/422.html deleted file mode 100644 index 83660ab..0000000 --- a/public/422.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - -
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

-
- - diff --git a/public/500.html b/public/500.html deleted file mode 100644 index f3648a0..0000000 --- a/public/500.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - -
-

We're sorry, but something went wrong.

-
- -