From 66c0eb43f1f6691d951c38e54eb628e0c9a8b90a Mon Sep 17 00:00:00 2001 From: aifeelit Date: Thu, 3 Nov 2022 21:37:57 -0500 Subject: [PATCH] exception for view --- .../exceptions/_not_found_topics.html.erb | 24 +++++++++++++ app/views/exceptions/not_found.html.erb | 35 +++++++++++++++++++ app/views/exceptions/read_only.html.erb | 1 + 3 files changed, 60 insertions(+) create mode 100644 app/views/exceptions/_not_found_topics.html.erb create mode 100644 app/views/exceptions/not_found.html.erb create mode 100644 app/views/exceptions/read_only.html.erb diff --git a/app/views/exceptions/_not_found_topics.html.erb b/app/views/exceptions/_not_found_topics.html.erb new file mode 100644 index 00000000..83612293 --- /dev/null +++ b/app/views/exceptions/_not_found_topics.html.erb @@ -0,0 +1,24 @@ +
+ <% if @top_viewed.count > 0 %> + + <% end %> + <% if @recent.count > 0 %> +
+

<%= t 'page_not_found.recent_topics' %>

+ <% @recent.each do |t| %> +
+ <%= link_to t.title, t.relative_url %><%= category_badge(t.category) %> +
+ <% end %> + " class="btn btn-default"><%= t 'page_not_found.see_more' %>… +
+ <% end %> +
diff --git a/app/views/exceptions/not_found.html.erb b/app/views/exceptions/not_found.html.erb new file mode 100644 index 00000000..c2b06f4d --- /dev/null +++ b/app/views/exceptions/not_found.html.erb @@ -0,0 +1,35 @@ +<% content_for :title do %><%= @page_title %> - <%= SiteSetting.title %><% end %> + +
+

<%= @title %>

+ + <%- if !@current_user %> + " class='btn btn-primary'><%= SvgSprite.raw_svg('fa-user') %><%= I18n.t('log_in') %> + <%- end %> + + <%- if @group&.allow_membership_requests %> + <%= SvgSprite.raw_svg('user-plus') %> <%= I18n.t('not_in_group.request_membership') %> + <%- elsif @group&.public_admission %> + <%= SvgSprite.raw_svg('user-plus') %> <%= I18n.t('not_in_group.join_group') %> + <%- end %> +
+ +<%= build_plugin_html 'server:not-found-before-topics' %> + +<%= @topics_partial %> + +<%- unless @hide_search%> +
+ +
+ + <%= preload_script('onpopstate-handler') %> +<%- end %> diff --git a/app/views/exceptions/read_only.html.erb b/app/views/exceptions/read_only.html.erb new file mode 100644 index 00000000..eb0c0e55 --- /dev/null +++ b/app/views/exceptions/read_only.html.erb @@ -0,0 +1 @@ +

<%= t('read_only_mode_enabled') %>