diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2024-03-13 18:03:43 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <msabate@suse.com> | 2024-03-13 18:03:43 +0100 |
| commit | a7791635aa98f012d35f97c3c5288494bbb28e38 (patch) | |
| tree | bad987e6b4d10ad2f7cd02e40658d464907595ee /app/views/layouts | |
| download | operum-a7791635aa98f012d35f97c3c5288494bbb28e38.tar.gz operum-a7791635aa98f012d35f97c3c5288494bbb28e38.zip | |
Initial commit
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'app/views/layouts')
| -rw-r--r-- | app/views/layouts/_errors.html.erb | 13 | ||||
| -rw-r--r-- | app/views/layouts/action_text/contents/_content.html.erb | 3 | ||||
| -rw-r--r-- | app/views/layouts/application.html.erb | 78 |
3 files changed, 94 insertions, 0 deletions
diff --git a/app/views/layouts/_errors.html.erb b/app/views/layouts/_errors.html.erb new file mode 100644 index 0000000..9e5ce38 --- /dev/null +++ b/app/views/layouts/_errors.html.erb @@ -0,0 +1,13 @@ +<% if model.errors.size.positive? %> + <div class="notice"> + <% if model.errors.size == 1 %> + <span><%= model.errors.first.full_message %>.</span> + <% else %> + <ul> + <% model.errors.each do |error| %> + <li><%= error.full_message %>.</li> + <% end %> + </ul> + <% end %> + </div> +<% end %> diff --git a/app/views/layouts/action_text/contents/_content.html.erb b/app/views/layouts/action_text/contents/_content.html.erb new file mode 100644 index 0000000..9e3c0d0 --- /dev/null +++ b/app/views/layouts/action_text/contents/_content.html.erb @@ -0,0 +1,3 @@ +<div class="trix-content"> + <%= yield -%> +</div> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 0000000..6042f43 --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<html> + <head> + <title><%= ENV.fetch('OPERUM_BASE_TITLE', 'Operum') %></title> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <%= csrf_meta_tags %> + <%= csp_meta_tag %> + + <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> + <%= javascript_importmap_tags %> + </head> + + <body> + <% if current_user && @searches %> + <header data-controller="header"> + <nav> + <a class="<%= 'current' if current_user.last_search_id.nil? %>" href="/"><%= I18n.t('searches.home') %></a> + <% Search.find_each do |s| %> + <a class="<%= 'current' if current_user.last_search_id == s.id %>" href="<%= search_path(s) %>"><%= s.name %></a> + <% end %> + <a id="toggle-hidden-global-menu" href="#" data-action="header#toggle"><i id="header-chevron" class="gg-chevron-down"></i></a> + </nav> + + <div id="hidden-nav" class="hidden"> + <div class="flex-wrap"> + <span><%= I18n.t('general.create').capitalize %>: </span> + <%= link_to I18n.t('searches.object'), new_search_path %> + <%= link_to I18n.t('things.object'), new_thing_path %> + </div> + + <div class="flex-wrap"> + <span><%= I18n.t('searches.title') %>: </span> + <% if @search&.id %> + <%= link_to I18n.t('general.edit'), edit_search_path(@search) %> + <%= link_to I18n.t('general.delete'), search_path(@search), data: { turbo_confirm: I18n.t('general.sure'), turbo_method: :delete } %> + <% end %> + + <%= link_to I18n.t('searches.export.action'), new_search_exports_path(current_user.last_search_id ? current_user.last_search_id : '0') %> + </div> + + <div class="flex-wrap"> + <span><%= I18n.t('general.list').capitalize %>: </span> + <%= link_to I18n.t('tags.title').downcase, tags_path %> + <%= link_to I18n.t('searches.shared.title').downcase, shared_searches_path %> + </div> + </div> + </header> + <% end %> + + <main> + <% if flash[:notice] %> + <div class="notice"> + <span><%= flash[:notice] %>.</span> + </div> + <% end %> + + <% if flash[:alert] %> + <div class="notice"> + <span><%= flash[:alert] %>.</span> + </div> + <% end %> + + <%= yield %> + </main> + + <footer> + <p> + <%= I18n.t('layout.created-by') %> <a href="http://jo.mssola.com/">Miquel Sabaté Solà</a> + <br> + <%= I18n.t('layout.this-page-license') %> <a href="/license">AGPLv3</a> (<a href="https://github.com/mssola/operum"><%= I18n.t('layout.source-code') %></a>) + <% if current_user %> + <br> + <%= link_to I18n.t('sessions.sign-out'), sessions_path, data: { turbo_method: :delete } %> + <% end %> + </p> + </footer> + </body> +</html> |
