Added a new site wide design and some other bits and pieces.
author<mako@atdot.cc> <>
Wed, 16 Aug 2006 20:57:38 +0000 (16:57 -0400)
committer<mako@atdot.cc> <>
Wed, 16 Aug 2006 20:57:38 +0000 (16:57 -0400)
app/controllers/site_controller.rb [new file with mode: 0644]
app/helpers/site_helper.rb [new file with mode: 0644]
app/views/layouts/election.rhtml [deleted file]
app/views/layouts/vb.rhtml [new file with mode: 0644]
app/views/site/index.rhtml [new file with mode: 0644]
config/routes.rb
public/index.html [deleted file]
public/stylesheets/scaffold.css [deleted file]
public/stylesheets/vb.css [new file with mode: 0644]
test/functional/site_controller_test.rb [new file with mode: 0644]

diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb
new file mode 100644 (file)
index 0000000..6e77b48
--- /dev/null
@@ -0,0 +1,6 @@
+class SiteController < ApplicationController
+  layout 'vb'
+
+  def index
+  end
+end
diff --git a/app/helpers/site_helper.rb b/app/helpers/site_helper.rb
new file mode 100644 (file)
index 0000000..c879486
--- /dev/null
@@ -0,0 +1,2 @@
+module SiteHelper
+end
diff --git a/app/views/layouts/election.rhtml b/app/views/layouts/election.rhtml
deleted file mode 100644 (file)
index fbac7a9..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<html>
-<head>
-  <title>Elections: <%= controller.action_name %></title>
-  <%= javascript_include_tag "prototype", "effects" %>
-  <%= stylesheet_link_tag 'scaffold' %>
-</head>
-<body>
-
-<p style="color: green"><%= flash[:notice] %></p>
-
-<%= @content_for_layout %>
-
-</body>
-</html>
diff --git a/app/views/layouts/vb.rhtml b/app/views/layouts/vb.rhtml
new file mode 100644 (file)
index 0000000..1161c7f
--- /dev/null
@@ -0,0 +1,50 @@
+<% %>
+<html>
+    <head>
+        <title><%= @page_title || "VotingBooth" %></title>
+        <%= stylesheet_link_tag "vb", :media => "all" %>
+        <%= javascript_include_tag "prototype", "effects", "dragdrop", "controls" %>
+    </head>
+    <body>
+        <div id="top">
+           <% if @page_title %>
+              <h3><%= @page_title %></h3>  
+           <% else %>
+             <h3>Voting Booth<br />
+             <font size="-1">Preferential Voting on the Web</font></h3>
+          <% end %>
+
+           <div id="links">
+             <% if session[:user] %>
+               Welcome <strong><%= session[:user].login.capitalize %></strong>
+             <% else %>
+               <%= link_to("Login",:controller => "account", :action => "login") %>/<%= link_to("Sign up", :controller => "account", :action => "signup")%>
+             <% end %> |
+         
+             <%= link_to("Home", :controller => "site", :action => "index")%> |
+             <%= link_to("Browse", :controller => "site", :action => "index")%> |
+
+             <% if session[:user] %>
+               <%= link_to("Logout", :controller => "account", :action => "logout") %>  |
+             <% end %>
+             
+            <%= link_to("Help/About", :controller => "site", :action => "about") %>
+           </div>
+        </div>
+        
+        <% if @flash[:notice]%>
+          <div id="notice"><%= @flash[:notice] %></div>
+        <% end%>
+
+        <div id="main">
+          <%= @content_for_layout %>
+        </div>
+
+       <hr />
+        <div id="footer">(C) 2006 |
+         <%= link_to "MIT Media Lab", "http://www.media.mit.edu" %> and
+         <a href="http://mako.cc">Benjamin Mako Hill</a>
+       </div>
+
+    </body>
+</html>
diff --git a/app/views/site/index.rhtml b/app/views/site/index.rhtml
new file mode 100644 (file)
index 0000000..e4ef59c
--- /dev/null
@@ -0,0 +1,23 @@
+<% %>
+
+<table width="auto" padding="5px">
+<tr>
+<td width="47%" valign="top">
+<h2>Voters</h2>
+
+<p>Please enter your password/token to log in and vote:</p>
+
+<%= form_tag :controller => 'voter', :action => 'index' %>
+<%= text_field :vote, :password %>
+<%= submit_tag "Log In" %>
+<%= end_form_tag %>
+</td>
+
+<td width="6%"></td>
+
+<td width="47%" valign="top">
+<h2>Vote Administrators</h2>
+
+</td>
+</tr>
+</table>
index 0b6d80a1740d11abc8c19e2f71fdfe483707aa76..c9beb55e174dca775d5d5976e19e085a57c32c70 100644 (file)
@@ -8,7 +8,7 @@ ActionController::Routing::Routes.draw do |map|
 
   # You can have the root of your site routed by hooking up '' 
   # -- just remember to delete public/index.html.
-  # map.connect '', :controller => "welcome"
+  map.connect '', :controller => "site"
 
   # Allow downloading Web Service WSDL as a file with an extension
   # instead of a file named 'wsdl'
diff --git a/public/index.html b/public/index.html
deleted file mode 100644 (file)
index d780f8e..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-  <title>Rails: Welcome on board</title>
-  <style>
-    body { background-color: #fff; color: #333; }
-
-    body, p, ol, ul, td {
-      font-family: verdana, arial, helvetica, sans-serif;
-      font-size:   12px;
-      line-height: 18px;
-    }
-
-    li {
-      margin-bottom: 7px;
-    }
-
-    pre {
-      background-color: #eee;
-      padding: 10px;
-      font-size: 11px;
-    }
-
-    a { color: #000; }
-    a:visited { color: #666; }
-    a:hover { color: #fff; background-color:#000; }
-  </style>
-</head>
-<body>
-
-<h1>Congratulations, you've put Ruby on Rails!</h1>
-
-<p><b>Before you move on</b>, verify that the following conditions have been met:</p>
-
-<ol>
-  <li>The log and public directories must be writable to the web server (<code>chmod -R 775 log</code> and <code>chmod -R 775 public</code>).
-  <li>
-    The shebang line in the public/dispatch* files must reference your Ruby installation. <br/>
-    You might need to change it to <code>#!/usr/bin/env ruby</code> or point directly at the installation.
-  </li>
-  <li>
-    Rails on Apache needs to have the cgi handler and mod_rewrite enabled.  <br/>
-    Somewhere in your httpd.conf, you should have:<br/>
-    <code>AddHandler cgi-script .cgi</code><br/>
-    <code>LoadModule rewrite_module     libexec/httpd/mod_rewrite.so</code><br/>
-    <code>AddModule mod_rewrite.c</code>
-  </li>
-</ol>
-
-<p>Take the following steps to get started:</p>
-
-<ol>
-  <li>Create empty development and test databases for your application.<br/>
-    <small>Recommendation: Use *_development and *_test names, such as basecamp_development and basecamp_test</small><br/>
-    <small>Warning: Don't point your test database at your development database, it'll destroy the latter on test runs!</small>
-  <li>Edit config/database.yml with your database settings.
-  <li>Create controllers and models using the generator in <code>script/generate</code> <br/>
-    <small>Help: Run the generator with no arguments for documentation</small>
-  <li>See all the tests run by running <code>rake</code>.
-  <li>Develop your Rails application!
-  <li>Setup Apache with <a href="http://www.fastcgi.com">FastCGI</a> (and <a href="http://raa.ruby-lang.org/list.rhtml?name=fcgi">Ruby bindings</a>), if you need better performance
-  <li>Remove the dispatches you don't use (so if you're on FastCGI, delete/move dispatch.rb, dispatch.cgi and gateway.cgi)</li>
-</ol>
-
-<p>
-  Trying to setup a default page for Rails using Routes? You'll have to delete this file (public/index.html) to get under way. Then define a new route in <tt>config/routes.rb</tt> of the form:
-  <pre>  map.connect '', :controller => 'wiki/page', :action => 'show', :title => 'Welcome'</pre>
-</p>
-
-<p>
-  Having problems getting up and running? First try debugging it yourself by looking at the log files. <br/>
-  Then try the friendly Rails community <a href="http://www.rubyonrails.org">on the web</a> or <a href="http://www.rubyonrails.org/show/IRC">on IRC</a>
-  (<a href="irc://irc.freenode.net/#rubyonrails">FreeNode#rubyonrails</a>).
-</p>
-
-</body>
-</html>
diff --git a/public/stylesheets/scaffold.css b/public/stylesheets/scaffold.css
deleted file mode 100644 (file)
index de2ccc5..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-body { background-color: #fff; color: #333; }
-
-body, p, ol, ul, td {
-  font-family: verdana, arial, helvetica, sans-serif;
-  font-size:   13px;
-  line-height: 18px;
-}
-
-pre {
-  background-color: #eee;
-  padding: 10px;
-  font-size: 11px;
-}
-
-a { color: #000; }
-a:visited { color: #666; }
-a:hover { color: #fff; background-color:#000; }
-
-.fieldWithErrors {
-  padding: 2px;
-  background-color: red;
-  display: table;
-}
-
-#ErrorExplanation {
-  width: 400px;
-  border: 2px solid red;
-  padding: 7px;
-  padding-bottom: 12px;
-  margin-bottom: 20px;
-  background-color: #f0f0f0;
-}
-
-#ErrorExplanation h2 {
-  text-align: left;
-  font-weight: bold;
-  padding: 5px 5px 5px 15px;
-  font-size: 12px;
-  margin: -7px;
-  background-color: #c00;
-  color: #fff;
-}
-
-#ErrorExplanation p {
-  color: #333;
-  margin-bottom: 0;
-  padding: 5px;
-}
-
-#ErrorExplanation ul li {
-  font-size: 12px;
-  list-style: square;
-}
-
-div.uploadStatus {
-  margin: 5px;
-}
-
-div.progressBar {
-  margin: 5px;
-}
-
-div.progressBar div.border {
-  background-color: #fff;
-  border: 1px solid grey;
-  width: 100%;
-}
-
-div.progressBar div.background {
-  background-color: #333;
-  height: 18px;
-  width: 0%;
-}
-
diff --git a/public/stylesheets/vb.css b/public/stylesheets/vb.css
new file mode 100644 (file)
index 0000000..79800a8
--- /dev/null
@@ -0,0 +1,108 @@
+body   {       
+       font-size:      1em;
+       font-weight:    normal;
+       word-spacing:   normal;
+       letter-spacing: normal;
+       text-transform: none;
+       font-family:    Myriad Web, Geneva, Arial, Helvetica, sans-serif;
+       font-size-adjust:       .48;
+}      
+p, blockquote, ul, ol, dl, dd, li, dir, menu {}
+
+h1, h2, h3, h4 {
+    border-bottom: 1px solid #009999;
+    text-shadow: #999999 0.2em 0.2em 3px;
+
+}
+a:link { font-weight: bold; color: #066; text-decoration: underline; } 
+a:visited { color: #066; text-decoration: underline; }
+a:hover { color: #FFFFFF; text-decoration: none; background: #0063DC; }
+a:active { color: #FFFFFF; text-decoration: none; background: #0259C4; }
+
+#loginbox {
+  padding: 10px;
+  border: 1px solid;
+  width: 400px;
+  text-align: left;
+}
+
+#ErrorExplanation {
+  width: 400px;
+  border: 2px solid 'red';
+  padding: 7px;
+  padding-bottom: 12px;
+  margin-bottom: 20px;
+  background-color: #f0f0f0;
+}
+
+#ErrorExplanation h2 {
+  text-align: left;
+  font-weight: bold;
+  padding: 5px 5px 5px 15px;
+  font-size: 12px;
+  margin: -7px;
+  background-color: #c00;
+  color: #fff;
+}
+
+#ErrorExplanation p {
+  color: #333;
+  margin-bottom: 0;
+  padding: 5px;
+}
+
+#ErrorExplanation ul li {
+  font-size: 12px;
+  list-style: square;
+}
+
+
+
+#top { margin : 0px;
+       padding : 3px;
+       font-weight: normal;
+       background: #009999;
+       color: #FFFFFF;
+       
+}
+
+#top h3 { font-size: 30px; }
+
+#links { text-align : right;
+         margin-right: 50px; }
+#links a { color: #EAFFD0; }
+#links a:visited { font-weight: bold; }
+
+.ListLine0 {
+       background:  #e0f8f8;
+       
+}
+.ListLine1 {
+       background: #cccccc;
+       
+}
+
+#main { margin: 30px; }
+
+#notice { background: #FFFBB3; 
+                       text-align: left;
+                       font-weight: bold;
+                       border: 2px dotted 'red';
+                       margin-top: 10px;
+                       margin-left: 50px;
+                       padding: 5px 5px 5px 15px;
+                       width: 85%; }
+
+#footer { text-align: center;
+          font-size: 12px;
+          color: #464646; }
+
+#footer a { font-weight: normal; }
+       
+#subtext { 
+       text-align: center;
+       font-size: 12px;
+       font-weight: bold;
+       
+}
+
diff --git a/test/functional/site_controller_test.rb b/test/functional/site_controller_test.rb
new file mode 100644 (file)
index 0000000..69b9348
--- /dev/null
@@ -0,0 +1,18 @@
+require File.dirname(__FILE__) + '/../test_helper'
+require 'site_controller'
+
+# Re-raise errors caught by the controller.
+class SiteController; def rescue_action(e) raise e end; end
+
+class SiteControllerTest < Test::Unit::TestCase
+  def setup
+    @controller = SiteController.new
+    @request    = ActionController::TestRequest.new
+    @response   = ActionController::TestResponse.new
+  end
+
+  # Replace this with your real tests.
+  def test_truth
+    assert true
+  end
+end

Benjamin Mako Hill || Want to submit a patch?