lato 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/lato/application_controller.rb +38 -4
- data/app/views/lato/errors/error.html.erb +16 -0
- data/app/views/lato/errors/not_found.html.erb +12 -0
- data/config/routes.rb +2 -0
- data/lib/lato/version.rb +1 -1
- metadata +3 -5
- data/app/assets/images/lato/user-150x150.jpg +0 -0
- data/app/assets/images/lato/user-300x300.jpg +0 -0
- data/app/assets/images/lato/user-600x600.jpg +0 -0
- data/app/assets/images/lato/user-900x900.jpg +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 617a6a9833946efc6beec01f4727fc13341a2c1993e03e82dcc82a07b7971779
|
4
|
+
data.tar.gz: 16670fad7ed0c70aeb2458ff7a0f82e26ee989f4e53f4a1dbe873e8bfae5c897
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15b916ded489425afa8fed3d3af9160324dc2836a37a101e191c3fb5076940b960e7d1898ef7899690ac2a1e993bd39f8c799534f93e01819bf823f8ee3cfca0
|
7
|
+
data.tar.gz: e801ceb370f8bd980c2d95a8d57fe60064767c502e4745f20b5f458ddf10b5ea293fdad61d7b8d07609ade0378de9a51c21d70453246020202914cc7bc69eb0d
|
@@ -4,6 +4,8 @@ module Lato
|
|
4
4
|
include Lato::Layoutable
|
5
5
|
include Lato::Componentable
|
6
6
|
|
7
|
+
around_action :catch_exceptions
|
8
|
+
|
7
9
|
before_action :override_request_remote_ip
|
8
10
|
before_action :set_default_locale
|
9
11
|
|
@@ -12,6 +14,14 @@ module Lato
|
|
12
14
|
redirect_to @session.valid? ? session_root_path : lato.authentication_signin_path
|
13
15
|
end
|
14
16
|
|
17
|
+
def not_found
|
18
|
+
respond_to_with_not_found
|
19
|
+
end
|
20
|
+
|
21
|
+
def error
|
22
|
+
respond_to_with_error
|
23
|
+
end
|
24
|
+
|
15
25
|
def switch_locale
|
16
26
|
I18n.locale = params[:locale]
|
17
27
|
@session.user.update(locale: params[:locale]) if @session.valid?
|
@@ -35,17 +45,41 @@ module Lato
|
|
35
45
|
I18n.locale = @session.user.locale || I18n.default_locale
|
36
46
|
end
|
37
47
|
|
48
|
+
def respond_to_redirect_same_page(notice = nil)
|
49
|
+
respond_to do |format|
|
50
|
+
format.html { redirect_to request.referer, notice: notice }
|
51
|
+
format.json { render json: {} }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
38
55
|
def respond_to_with_not_found
|
56
|
+
hide_sidebar
|
39
57
|
respond_to do |format|
|
40
|
-
format.html { render
|
58
|
+
format.html { render 'lato/errors/not_found', status: :not_found }
|
41
59
|
format.json { render json: {}, status: :not_found }
|
42
60
|
end
|
43
61
|
end
|
44
62
|
|
45
|
-
def
|
63
|
+
def respond_to_with_error(exception = nil)
|
64
|
+
@exception = Rails.env.production? ? nil : exception
|
65
|
+
|
66
|
+
hide_sidebar
|
46
67
|
respond_to do |format|
|
47
|
-
format.html {
|
48
|
-
format.json { render json: {} }
|
68
|
+
format.html { render 'lato/errors/error', status: :internal_server_error }
|
69
|
+
format.json { render json: { error: @exception&.message || 'Internal server error' }, status: :internal_server_error }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def catch_exceptions
|
74
|
+
yield
|
75
|
+
rescue => exception
|
76
|
+
Rails.logger.error(exception.message)
|
77
|
+
Rails.logger.error(exception.backtrace.join("\n"))
|
78
|
+
|
79
|
+
if exception.is_a?(ActiveRecord::RecordNotFound)
|
80
|
+
respond_to_with_not_found
|
81
|
+
else
|
82
|
+
respond_to_with_error(exception)
|
49
83
|
end
|
50
84
|
end
|
51
85
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<div class="w-100 h-100 d-flex justify-content-center align-items-center" style="min-height: calc(100vh - 54px - 2rem)">
|
2
|
+
<div class="card w-100" style="max-width: 600px">
|
3
|
+
<div class="card-header">
|
4
|
+
<h1 class="fs-3 mb-0 text-center">Internal server error</h1>
|
5
|
+
</div>
|
6
|
+
<div class="card-body text-center">
|
7
|
+
<p class="lead">Please try again later or contact the administrator.</p>
|
8
|
+
<a href="<%= lato.root_path %>" class="btn btn-primary">Go to homepage</a>
|
9
|
+
</div>
|
10
|
+
<% if @exception %>
|
11
|
+
<div class="card-body bg-light text-center">
|
12
|
+
<%= @exception.message %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
16
|
+
</div>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div class="w-100 h-100 d-flex justify-content-center align-items-center" style="min-height: calc(100vh - 54px - 2rem)">
|
2
|
+
<div class="card w-100" style="max-width: 600px">
|
3
|
+
<div class="card-header">
|
4
|
+
<h1 class="fs-3 mb-0 text-center">Page not found</h1>
|
5
|
+
</div>
|
6
|
+
<div class="card-body text-center">
|
7
|
+
<p class="lead">The page you are looking for does not exist.</p>
|
8
|
+
<p class="lead">You may have mistyped the address or the page may have moved.</p>
|
9
|
+
<a href="<%= lato.root_path %>" class="btn btn-primary">Go to homepage</a>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
</div>
|
data/config/routes.rb
CHANGED
data/lib/lato/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregorio Galante
|
@@ -105,10 +105,6 @@ files:
|
|
105
105
|
- README.md
|
106
106
|
- Rakefile
|
107
107
|
- app/assets/config/lato_manifest.js
|
108
|
-
- app/assets/images/lato/user-150x150.jpg
|
109
|
-
- app/assets/images/lato/user-300x300.jpg
|
110
|
-
- app/assets/images/lato/user-600x600.jpg
|
111
|
-
- app/assets/images/lato/user-900x900.jpg
|
112
108
|
- app/assets/javascripts/lato/application.js
|
113
109
|
- app/assets/javascripts/lato/controllers/application.js
|
114
110
|
- app/assets/javascripts/lato/controllers/index.js
|
@@ -171,6 +167,8 @@ files:
|
|
171
167
|
- app/views/lato/components/_operation.html.erb
|
172
168
|
- app/views/lato/components/_page_head.html.erb
|
173
169
|
- app/views/lato/components/_sidebar_nav_item.html.erb
|
170
|
+
- app/views/lato/errors/error.html.erb
|
171
|
+
- app/views/lato/errors/not_found.html.erb
|
174
172
|
- app/views/lato/mailer/invitation/invite_mail.html.erb
|
175
173
|
- app/views/lato/mailer/user/email_verification_mail.html.erb
|
176
174
|
- app/views/lato/mailer/user/password_update_mail.html.erb
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|