split up the app

This commit is contained in:
Ole-Morten Duesund 2025-06-06 23:16:10 +02:00
commit 7c1c314b70
4 changed files with 513 additions and 450 deletions

60
views/index.erb Normal file
View file

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="<%= language %>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>No as a Service</title>
<link rel="stylesheet" href="/css/styles.css">
</head>
<body>
<div class="container">
<h1>No as a Service</h1>
<p class="subtitle">The definitive multilingual API for negative responses</p>
<div class="language-info">
Currently in: <strong><%= language_name %></strong>
<% if language == 'no' %><span class="nordic-flag">🇳🇴</span><% end %>
<% if language == 'sv' %><span class="nordic-flag">🇸🇪</span><% end %>
<% if language == 'da' %><span class="nordic-flag">🇩🇰</span><% end %>
<% if language == 'is' %><span class="nordic-flag">🇮🇸</span><% end %>
<% if language == 'fi' %><span class="nordic-flag">🇫🇮</span><% end %>
<% if language == 'fo' %><span class="nordic-flag">🇫🇴</span><% end %>
</div>
<div class="logo-container">
<div class="logo" onclick="logoClick()">
</div>
</div>
<div class="no-response">
<%= no_response %>
</div>
<div class="controls">
<button class="refresh-btn" onclick="location.reload()">
Get Another No
</button>
<select class="language-selector" onchange="changeLanguage(this.value)">
<% available_languages.each do |lang| %>
<option value="<%= lang[:code] %>" <%= 'selected' if lang[:code] == language %>>
<%= lang[:name] %>
</option>
<% end %>
</select>
</div>
<div class="api-info">
<h3>API Usage</h3>
<p>JSON API: <code>GET /api/no</code> or <code>GET /api/no/:lang</code></p>
<p>Languages: <code>GET /languages</code></p>
<p>URL Parameter: <code>?lang=<%= language %></code></p>
<p>Accept-Language header supported</p>
<p>Health Check: <code>GET /health</code></p>
</div>
</div>
<script src="/js/scripts.js"></script>
</body>
</html>