aboutsummaryrefslogtreecommitdiff
path: root/app/views/layouts/application.html.erb
blob: 422270d4fb4e0f4fa2c99ce1b5d01ff429bfde23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html lang="<%= I18n.default_locale %>">
  <head>
    <title><%= ENV.fetch('OPERUM_BASE_TITLE', 'Operum') %></title>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="author" content="Miquel Sabaté Solà">

    <meta name="description" content="<%= I18n.t('meta.description') %>">
    <% if I18n.default_locale == :ca %>
      <meta property="og:locale" content="ca_ES" />
    <% else %>
      <meta property="og:locale" content="en_US" />
    <% end %>
    <meta property="og:url" content="https://github.com/mssola/operum" />
    <meta property="og:title" content="<%= ENV.fetch('OPERUM_BASE_TITLE', 'Operum') %>" />
    <meta property="og:description" content="<%= I18n.t('meta.description') %>" />

    <link rel="alternate" hreflang="<%= I18n.default_locale %>" href="<%= request.base_url %>">

    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>

    <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
    <%= javascript_importmap_tags %>

    <!-- favicon -->
    <link rel="icon" href="/favicon.ico" sizes="16x16">
    <link rel="icon" href="/favicon-32x32.png" sizes="32x32" type="image/png">
    <link rel="apple-touch-icon" href="/apple-touch-icon.png">
    <link rel="manifest" href="/manifest.webmanifest">
  </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>
          <% @searches.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>