added some simple styles to make it nicer
parent
47f8741592
commit
c0c82e5395
2
app.rb
2
app.rb
|
|
@ -20,7 +20,7 @@ class App < Roda
|
||||||
r.post "create" do
|
r.post "create" do
|
||||||
url = r.params['url']
|
url = r.params['url']
|
||||||
if nil == links.filter(:url => url).first
|
if nil == links.filter(:url => url).first
|
||||||
code = SecureRandom.urlsafe_base64 5
|
code = SecureRandom.urlsafe_base64 4
|
||||||
links.insert(url: url, code: code)
|
links.insert(url: url, code: code)
|
||||||
end
|
end
|
||||||
@new_link = 'http://' + request.env['HTTP_HOST'] + '/' + links.filter(:url => url).first[:code]
|
@new_link = 'http://' + request.env['HTTP_HOST'] + '/' + links.filter(:url => url).first[:code]
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,10 @@
|
||||||
<title><%= @page_title || "URL Shortener" %></title>
|
<title><%= @page_title || "URL Shortener" %></title>
|
||||||
<link rel="icon" href="data:,">
|
<link rel="icon" href="data:,">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body style="background: #FEFEFE; font-family: Helvetica, sans-serif;">
|
||||||
<h1>URL Shortener</h1>
|
<main style="max-width: 30rem; min-width: 18rem; border: 2px solid #111111; border-radius: 20px; margin: auto; padding: 1rem; margin-top: 5rem; text-align: center;">
|
||||||
<%== yield %>
|
<h1>URL Shortener</h1>
|
||||||
|
<%== yield %>
|
||||||
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue