Skip to content

Commit

Permalink
Email without all that unnecessary junk. It's simple!
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Keen committed Mar 31, 2010
0 parents commit 5a2cc8c
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config.ru
@@ -0,0 +1,8 @@
require 'rubygems'
require 'sinatra'

set :run, false
set :environment, ENV['RACK_ENV']

require 'simple'
run Sinatra::Application
Binary file added public/.DS_Store
Binary file not shown.
64 changes: 64 additions & 0 deletions public/css/master.css
@@ -0,0 +1,64 @@
body {
font-family:Helvetica, Arial, sans-serif;
text-align:center;
padding:5em 2em 2em;
}
h1 {
font-size:3em;
padding-bottom:0.3em;
}
h1 a {
color:#EEE;
text-decoration:none;
}
h1 a:hover {
color:#DDD;
}
h3 {
font-size:3em;
padding:0;
margin-bottom:0.6em;
}
label {
font-size:2.0em;
color:#333;
position:relative;
left:-0.5em;
}
input[type=email] {
font-size:1.0em;
padding:10px;
}
input[type=submit] {
font-size:1.5em;
background-color:#ECECEA;
color:#333;
padding:2px 5px;
border-radius:5px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
}
p {
height:4.2em;
position:relative;
}

form.error input[type=email] {
border:2px solid red;
}

form.error span {
font-size:1em;
font-weight:normal;
position:absolute;
top:1.5em;
font-style:italic;
color:red;
}

footer, footer a {
color:#EEE;
}
footer a:hover {
color:#CCC;
}
26 changes: 26 additions & 0 deletions simple.rb
@@ -0,0 +1,26 @@
require 'rubygems'
require 'sinatra'
require 'erb'
require 'action_mailer'

helpers do
include Rack::Utils
end

get '/' do
erb :index
end

get '/send'
redirect '/'
end

post '/send' do
if params[:email] =~ /@/
@success = true;
else
@errors = "<span>Invalid email address</span>"
end
erb :index
end

37 changes: 37 additions & 0 deletions views/index.erb
@@ -0,0 +1,37 @@
<!DOCTYPE html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Simple Email</title>
<link rel="stylesheet" href="/css/master.css" type="text/css" media="screen" charset="utf-8">
</head>
<body>
<% if @success %>
<h3>Sent! So simple!</h3>
<% else %>

<h1><a href="/">Simple Email</a></h1>

<form action="send" method="post" accept-charset="utf-8" class="<%= "error" if @errors %>">
<p>
<!-- From: Unnecessary. It's always you. -->

<label>To:
<input type="email" name="email"/>
</label>
<%= @errors %>

<!-- Subject: "News", "Hi", <no subject>. Pointless. Take it out. -->
<!-- Body: I'm not writing bloated software here. This email system is simple. -->

<!-- Submit button: Unncessary. C'mon people. Hit return. -->
</p>
</form>
<% end %>
<footer>
<p>
<!-- Very necessary. I'm hoping to crack the 5-subscriber glass ceiling. -->
&copy; 2010 <a href="http://keen.me">keen.me</a> | <a href="http://twitter.com/jeffxl">@jeffxl</a>
</p>
</footer>
</body>
</html>

0 comments on commit 5a2cc8c

Please sign in to comment.