Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added paper judge forms and finished rails app

  • Loading branch information...
commit 6531055a12c9fc8d0b7f5072de80e2d102b357a0 1 parent e20a40f
@toddtreece authored
Showing with 14,287 additions and 16 deletions.
  1. +83 −0 admin/app/controllers/awards_controller.rb
  2. +2 −0  admin/app/helpers/awards_helper.rb
  3. +2 −0  admin/app/models/award.rb
  4. +26 −0 admin/app/views/awards/_form.html.erb
  5. +13 −0 admin/app/views/awards/_sidebar.html.erb
  6. +19 −0 admin/app/views/awards/edit.html.erb
  7. +48 −0 admin/app/views/awards/index.html.erb
  8. +18 −0 admin/app/views/awards/new.html.erb
  9. +34 −0 admin/app/views/awards/show.html.erb
  10. +1 −0  admin/app/views/bot_types/_sidebar.html.erb
  11. +5 −0 admin/app/views/bots/_form.html.erb
  12. +1 −0  admin/app/views/bots/_sidebar.html.erb
  13. +5 −0 admin/app/views/bots/show.html.erb
  14. +1 −0  admin/app/views/heats/_sidebar.html.erb
  15. +1 −6 admin/app/views/laps/_form.html.erb
  16. +1 −0  admin/app/views/laps/_sidebar.html.erb
  17. +0 −5 admin/app/views/laps/show.html.erb
  18. +1 −0  admin/app/views/team_members/_sidebar.html.erb
  19. +1 −0  admin/app/views/teams/_sidebar.html.erb
  20. +1 −0  admin/app/views/views/_sidebar.html.erb
  21. +3 −3 admin/config/database.yml
  22. +2 −0  admin/config/routes.rb
  23. +15 −0 admin/db/migrate/20110420223957_create_awards.rb
  24. +9 −0 admin/db/migrate/20110421163612_remove_heat_id_from_laps.rb
  25. +9 −0 admin/db/migrate/20110421225346_add_pass_to_bots.rb
  26. +10 −2 admin/db/schema.rb
  27. +11 −0 admin/test/fixtures/awards.yml
  28. +49 −0 admin/test/functional/awards_controller_test.rb
  29. +8 −0 admin/test/unit/award_test.rb
  30. +4 −0 admin/test/unit/helpers/awards_helper_test.rb
  31. +4,727 −0 forms/heat assignments.ai
  32. +4,449 −0 forms/official results.ai
  33. +4,728 −0 forms/time card.ai
View
83 admin/app/controllers/awards_controller.rb
@@ -0,0 +1,83 @@
+class AwardsController < ApplicationController
+ # GET /awards
+ # GET /awards.xml
+ def index
+ @awards = Award.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @awards }
+ end
+ end
+
+ # GET /awards/1
+ # GET /awards/1.xml
+ def show
+ @award = Award.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @award }
+ end
+ end
+
+ # GET /awards/new
+ # GET /awards/new.xml
+ def new
+ @award = Award.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @award }
+ end
+ end
+
+ # GET /awards/1/edit
+ def edit
+ @award = Award.find(params[:id])
+ end
+
+ # POST /awards
+ # POST /awards.xml
+ def create
+ @award = Award.new(params[:award])
+
+ respond_to do |format|
+ if @award.save
+ format.html { redirect_to(@award, :notice => 'Award was successfully created.') }
+ format.xml { render :xml => @award, :status => :created, :location => @award }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @award.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /awards/1
+ # PUT /awards/1.xml
+ def update
+ @award = Award.find(params[:id])
+
+ respond_to do |format|
+ if @award.update_attributes(params[:award])
+ format.html { redirect_to(@award, :notice => 'Award was successfully updated.') }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @award.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /awards/1
+ # DELETE /awards/1.xml
+ def destroy
+ @award = Award.find(params[:id])
+ @award.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(awards_url) }
+ format.xml { head :ok }
+ end
+ end
+end
View
2  admin/app/helpers/awards_helper.rb
@@ -0,0 +1,2 @@
+module AwardsHelper
+end
View
2  admin/app/models/award.rb
@@ -0,0 +1,2 @@
+class Award < ActiveRecord::Base
+end
View
26 admin/app/views/awards/_form.html.erb
@@ -0,0 +1,26 @@
+
+ <div class="group">
+ <%= f.label :teams_id, t("activerecord.attributes.award.teams_id", :default => "Teams"), :class => :label %>
+ <%= f.text_field :teams_id, :class => 'text_field' %>
+ <span class="description">Ex: a simple text</span>
+ </div>
+
+ <div class="group">
+ <%= f.label :award, t("activerecord.attributes.award.award", :default => "Award"), :class => :label %>
+ <%= f.text_field :award, :class => 'text_field' %>
+ <span class="description">Ex: a simple text</span>
+ </div>
+
+ <div class="group">
+ <%= f.label :judge, t("activerecord.attributes.award.judge", :default => "Judge"), :class => :label %>
+ <%= f.text_field :judge, :class => 'text_field' %>
+ <span class="description">Ex: a simple text</span>
+ </div>
+
+<div class="group navform wat-cf">
+ <button class="button" type="submit">
+ <%= image_tag("web-app-theme/icons/tick.png", :alt => "#{t("web-app-theme.save", :default => "Save")}") %> <%= t("web-app-theme.save", :default => "Save") %>
+ </button>
+ <span class="text_button_padding"><%= t("web-app-theme.or", :default => "or") %></span>
+ <%= link_to t("web-app-theme.cancel", :default => "Cancel"), awards_path, :class => "text_button_padding link_button" %>
+</div>
View
13 admin/app/views/awards/_sidebar.html.erb
@@ -0,0 +1,13 @@
+<div class="block">
+ <h3>Links</h3>
+ <ul class="navigation">
+ <li><a href="/awards">Awards</a></li>
+ <li><a href="/bots">Bots</a></li>
+ <li><a href="/bot_types">Bot Types</a></li>
+ <li><a href="/heats">Heats</a></li>
+ <li><a href="/laps">Laps</a></li>
+ <li><a href="/teams">Teams</a></li>
+ <li><a href="/team_members">Team Members</a></li>
+ <li><a href="/views">Views</a></li>
+ </ul>
+</div>
View
19 admin/app/views/awards/edit.html.erb
@@ -0,0 +1,19 @@
+<div class="block">
+ <div class="secondary-navigation">
+ <ul class="wat-cf">
+ <li class="first"><%= link_to "#{t("web-app-theme.list", :default => "List")}", awards_path %></li>
+ <li><%= link_to "#{t("web-app-theme.new", :default => "New")}", new_award_path %></li>
+ <li class="active"><%= link_to "#{t("web-app-theme.edit", :default => "Edit")}", edit_award_path %></li>
+ </ul>
+ </div>
+ <div class="content">
+ <h2 class="title"><%= t("web-app-theme.edit", :default => "Edit") %> Award</h2>
+ <div class="inner">
+ <%= form_for @award, :url => award_path(@award), :html => { :class => :form } do |f| -%>
+ <%= render :partial => "form", :locals => {:f => f} %>
+ <% end -%>
+ </div>
+ </div>
+</div>
+
+<% content_for :sidebar, render(:partial => 'sidebar') -%>
View
48 admin/app/views/awards/index.html.erb
@@ -0,0 +1,48 @@
+<div class="block">
+ <div class="secondary-navigation">
+ <ul class="wat-cf">
+ <li class="first active"><%= link_to "#{t("web-app-theme.list", :default => "List")}", awards_path %></li>
+ <li><%= link_to "#{t("web-app-theme.new", :default => "New")}", new_award_path %></li>
+ </ul>
+ </div>
+ <div class="content">
+ <h2 class="title"><%= t("web-app-theme.all", :default => "All") %> Awards</h2>
+ <div class="inner">
+ <table class="table">
+ <tr>
+ <th class="first">ID</th>
+ <th>
+ <%= t("activerecord.attributes.award.teams_id", :default => t("activerecord.labels.teams_id", :default => "Teams_id")) %>
+ </th>
+ <th><%= t("web-app-theme.created_at", :default => "Created at") %></th>
+ <th class="last">&nbsp;</th>
+ </tr>
+ <% @awards.each do |award| -%>
+ <tr class="<%= cycle("odd", "even") %>">
+ <td>
+ <%= award.id %>
+ </td>
+ <td>
+ <%= link_to award.teams_id, award_path(award) %>
+ </td>
+ <td>
+ <%= award.created_at %>
+ </td>
+ <td class="last">
+ <%= link_to "#{t("web-app-theme.show", :default => "Show")}", award_path(award) %> |
+ <%= link_to "#{t("web-app-theme.edit", :default => "Edit")}", edit_award_path(award) %> |
+ <%= link_to "#{t("web-app-theme.delete", :default => "Delete")}", award_path(award), :method => :delete, :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}" %>
+ </td>
+ </tr>
+ <% end -%>
+ </table>
+ <div class="actions-bar wat-cf">
+ <div class="actions">
+ </div>
+
+ </div>
+ </div>
+ </div>
+</div>
+
+<% content_for :sidebar, render(:partial => 'sidebar') -%>
View
18 admin/app/views/awards/new.html.erb
@@ -0,0 +1,18 @@
+<div class="block">
+ <div class="secondary-navigation">
+ <ul class="wat-cf">
+ <li class="first"><%= link_to "#{t("web-app-theme.list", :default => "List")}", awards_path %></li>
+ <li class="active"><%= link_to "#{t("web-app-theme.new", :default => "New")}", new_award_path %></li>
+ </ul>
+ </div>
+ <div class="content">
+ <h2 class="title"><%= t("web-app-theme.new", :default => "New")%> Award</h2>
+ <div class="inner">
+ <%= form_for :award, :url => awards_path, :html => { :class => :form } do |f| -%>
+ <%= render :partial => "form", :locals => {:f => f} %>
+ <% end -%>
+ </div>
+ </div>
+</div>
+
+<% content_for :sidebar, render(:partial => 'sidebar') -%>
View
34 admin/app/views/awards/show.html.erb
@@ -0,0 +1,34 @@
+<div class="block">
+ <div class="secondary-navigation">
+ <ul class="wat-cf">
+ <li class="first"><%= link_to "#{t("web-app-theme.list", :default => "List")}", awards_path %></li>
+ <li><%= link_to "#{t("web-app-theme.new", :default => "New")}", new_award_path %></li>
+ <li class="active"><%= link_to "#{t("web-app-theme.show", :default => "Show")}", award_path %></li>
+ </ul>
+ </div>
+ <div class="content">
+ <div class="inner">
+
+ <p>
+ <b><%= t("activerecord.attributes.award.teams_id", :default => t("activerecord.labels.teams_id", :default => "Teams")) %>:</b>
+ <%= @award.teams_id %>
+ </p>
+
+ <p>
+ <b><%= t("activerecord.attributes.award.award", :default => t("activerecord.labels.award", :default => "Award")) %>:</b>
+ <%= @award.award %>
+ </p>
+
+ <p>
+ <b><%= t("activerecord.attributes.award.judge", :default => t("activerecord.labels.judge", :default => "Judge")) %>:</b>
+ <%= @award.judge %>
+ </p>
+ <div class="wat-cf">
+ <%= link_to image_tag("web-app-theme/icons/application_edit.png", :alt => "#{t("web-app-theme.edit", :default=> "Edit")}") + " " + t("web-app-theme.edit", :default=> "Edit"), edit_award_path(@award), :class => "button" %>
+ <%= link_to image_tag("web-app-theme/icons/cross.png", :alt => "#{t("web-app-theme.delete", :default=> "Delete")}") + " " + t("web-app-theme.delete", :default => "Delete"), award_path(@award), :method => "delete", :class => "button", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}" %>
+ </div>
+ </div>
+ </div>
+</div>
+
+<% content_for :sidebar, render(:partial => 'sidebar') -%>
View
1  admin/app/views/bot_types/_sidebar.html.erb
@@ -1,6 +1,7 @@
<div class="block">
<h3>Links</h3>
<ul class="navigation">
+ <li><a href="/awards">Awards</a></li>
<li><a href="/bots">Bots</a></li>
<li><a href="/bot_types">Bot Types</a></li>
<li><a href="/heats">Heats</a></li>
View
5 admin/app/views/bots/_form.html.erb
@@ -13,6 +13,11 @@
<%= f.label :heats_id, t("activerecord.attributes.bot.heats_id", :default => "Heat"), :class => :label %>
<%= f.select :heats_id, Heat.all.map { |heat| [heat.id, heat.id] } %>
</div>
+
+ <div class="group">
+ <%= f.label :pass, t("activerecord.attributes.bot.pass", :default => "Pass"), :class => :label %>
+ <%= f.check_box :pass, :class => 'check_box' %>
+ </div>
<div class="group navform wat-cf">
<button class="button" type="submit">
View
1  admin/app/views/bots/_sidebar.html.erb
@@ -1,6 +1,7 @@
<div class="block">
<h3>Links</h3>
<ul class="navigation">
+ <li><a href="/awards">Awards</a></li>
<li><a href="/bots">Bots</a></li>
<li><a href="/bot_types">Bot Types</a></li>
<li><a href="/heats">Heats</a></li>
View
5 admin/app/views/bots/show.html.erb
@@ -23,6 +23,11 @@
<b><%= t("activerecord.attributes.bot.heats_id", :default => t("activerecord.labels.heats_id", :default => "Heats")) %>:</b>
<%= @bot.heats_id %>
</p>
+
+ <p>
+ <b><%= t("activerecord.attributes.bot.pass", :default => t("activerecord.labels.pass", :default => "Pass")) %>:</b>
+ <%= @bot.pass %>
+ </p>
<div class="wat-cf">
<%= link_to image_tag("web-app-theme/icons/application_edit.png", :alt => "#{t("web-app-theme.edit", :default=> "Edit")}") + " " + t("web-app-theme.edit", :default=> "Edit"), edit_bot_path(@bot), :class => "button" %>
<%= link_to image_tag("web-app-theme/icons/cross.png", :alt => "#{t("web-app-theme.delete", :default=> "Delete")}") + " " + t("web-app-theme.delete", :default => "Delete"), bot_path(@bot), :method => "delete", :class => "button", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}" %>
View
1  admin/app/views/heats/_sidebar.html.erb
@@ -1,6 +1,7 @@
<div class="block">
<h3>Links</h3>
<ul class="navigation">
+ <li><a href="/awards">Awards</a></li>
<li><a href="/bots">Bots</a></li>
<li><a href="/bot_types">Bot Types</a></li>
<li><a href="/heats">Heats</a></li>
View
7 admin/app/views/laps/_form.html.erb
@@ -5,13 +5,8 @@
</div>
<div class="group">
- <%= f.label :heats_id, t("activerecord.attributes.lap.heats_id", :default => "Heat"), :class => :label %>
- <%= f.select :heats_id, Heat.all.map { |heat| [heat.id, heat.id] } %>
- </div>
-
- <div class="group">
<%= f.label :lap_time, t("activerecord.attributes.lap.lap_time", :default => "Lap time"), :class => :label %>
- <%= f.time_select :lap_time, :class => 'time_select' %>
+ <%= f.text_field :lap_time, :class => 'text_field' %>
</div>
<div class="group">
View
1  admin/app/views/laps/_sidebar.html.erb
@@ -1,6 +1,7 @@
<div class="block">
<h3>Links</h3>
<ul class="navigation">
+ <li><a href="/awards">Awards</a></li>
<li><a href="/bots">Bots</a></li>
<li><a href="/bot_types">Bot Types</a></li>
<li><a href="/heats">Heats</a></li>
View
5 admin/app/views/laps/show.html.erb
@@ -15,11 +15,6 @@
</p>
<p>
- <b><%= t("activerecord.attributes.lap.heats_id", :default => t("activerecord.labels.heats_id", :default => "Heats")) %>:</b>
- <%= @lap.heats_id %>
- </p>
-
- <p>
<b><%= t("activerecord.attributes.lap.lap_time", :default => t("activerecord.labels.lap_time", :default => "Lap time")) %>:</b>
<%= @lap.lap_time %>
</p>
View
1  admin/app/views/team_members/_sidebar.html.erb
@@ -1,6 +1,7 @@
<div class="block">
<h3>Links</h3>
<ul class="navigation">
+ <li><a href="/awards">Awards</a></li>
<li><a href="/bots">Bots</a></li>
<li><a href="/bot_types">Bot Types</a></li>
<li><a href="/heats">Heats</a></li>
View
1  admin/app/views/teams/_sidebar.html.erb
@@ -1,6 +1,7 @@
<div class="block">
<h3>Links</h3>
<ul class="navigation">
+ <li><a href="/awards">Awards</a></li>
<li><a href="/bots">Bots</a></li>
<li><a href="/bot_types">Bot Types</a></li>
<li><a href="/heats">Heats</a></li>
View
1  admin/app/views/views/_sidebar.html.erb
@@ -1,6 +1,7 @@
<div class="block">
<h3>Links</h3>
<ul class="navigation">
+ <li><a href="/awards">Awards</a></li>
<li><a href="/bots">Bots</a></li>
<li><a href="/bot_types">Bot Types</a></li>
<li><a href="/heats">Heats</a></li>
View
6 admin/config/database.yml
@@ -13,7 +13,7 @@ development:
pool: 5
username: avc
password: avc2011
- host: 192.168.10.224
+ host: 192.168.2.242
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
@@ -26,7 +26,7 @@ test:
pool: 5
username: avc
password: avc2011
- host: 192.168.10.224
+ host: 192.168.2.242
production:
adapter: mysql2
@@ -36,4 +36,4 @@ production:
pool: 5
username: avc
password: avc2011
- host: 192.168.10.224
+ host: 192.168.2.242
View
2  admin/config/routes.rb
@@ -1,4 +1,6 @@
Admin::Application.routes.draw do
+ resources :awards
+
resources :views
resources :teams
View
15 admin/db/migrate/20110420223957_create_awards.rb
@@ -0,0 +1,15 @@
+class CreateAwards < ActiveRecord::Migration
+ def self.up
+ create_table :awards do |t|
+ t.integer :teams_id
+ t.integer :award
+ t.string :judge
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :awards
+ end
+end
View
9 admin/db/migrate/20110421163612_remove_heat_id_from_laps.rb
@@ -0,0 +1,9 @@
+class RemoveHeatIdFromLaps < ActiveRecord::Migration
+ def self.up
+ remove_column :laps, :heats_id
+ end
+
+ def self.down
+ add_column :laps, :heats_id, :integer
+ end
+end
View
9 admin/db/migrate/20110421225346_add_pass_to_bots.rb
@@ -0,0 +1,9 @@
+class AddPassToBots < ActiveRecord::Migration
+ def self.up
+ add_column :bots, :pass, :boolean
+ end
+
+ def self.down
+ remove_column :bots, :pass
+ end
+end
View
12 admin/db/schema.rb
@@ -10,7 +10,15 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110419232451) do
+ActiveRecord::Schema.define(:version => 20110421225346) do
+
+ create_table "awards", :force => true do |t|
+ t.integer "teams_id"
+ t.integer "award"
+ t.string "judge"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
create_table "bot_types", :force => true do |t|
t.string "name"
@@ -24,6 +32,7 @@
t.integer "heats_id"
t.datetime "created_at"
t.datetime "updated_at"
+ t.boolean "pass"
end
create_table "heats", :force => true do |t|
@@ -34,7 +43,6 @@
create_table "laps", :force => true do |t|
t.integer "bots_id"
- t.integer "heats_id"
t.time "lap_time"
t.integer "corners_completed"
t.boolean "disqualified"
View
11 admin/test/fixtures/awards.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+one:
+ teams_id: 1
+ award: 1
+ judge: MyString
+
+two:
+ teams_id: 1
+ award: 1
+ judge: MyString
View
49 admin/test/functional/awards_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class AwardsControllerTest < ActionController::TestCase
+ setup do
+ @award = awards(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:awards)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create award" do
+ assert_difference('Award.count') do
+ post :create, :award => @award.attributes
+ end
+
+ assert_redirected_to award_path(assigns(:award))
+ end
+
+ test "should show award" do
+ get :show, :id => @award.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, :id => @award.to_param
+ assert_response :success
+ end
+
+ test "should update award" do
+ put :update, :id => @award.to_param, :award => @award.attributes
+ assert_redirected_to award_path(assigns(:award))
+ end
+
+ test "should destroy award" do
+ assert_difference('Award.count', -1) do
+ delete :destroy, :id => @award.to_param
+ end
+
+ assert_redirected_to awards_path
+ end
+end
View
8 admin/test/unit/award_test.rb
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class AwardTest < ActiveSupport::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end
View
4 admin/test/unit/helpers/awards_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class AwardsHelperTest < ActionView::TestCase
+end
View
4,727 forms/heat assignments.ai
4,727 additions, 0 deletions not shown
View
4,449 forms/official results.ai
4,449 additions, 0 deletions not shown
View
4,728 forms/time card.ai
4,728 additions, 0 deletions not shown
Please sign in to comment.
Something went wrong with that request. Please try again.