Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 2 commits
  • 18 files changed
  • 0 commit comments
  • 1 contributor
View
5 Gemfile
@@ -10,6 +10,11 @@ gem 'coffee-script'
gem 'haml'
+# Admin interface
+gem 'activeadmin'
+gem 'meta_search'
+
+
# Gems used only for assets and not required
# in production environments by default.
group :assets do
View
38 Gemfile.lock
@@ -15,6 +15,15 @@ GEM
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.3)
+ activeadmin (0.3.4)
+ devise (>= 1.1.2)
+ fastercsv
+ formtastic (< 2.0.0)
+ inherited_resources (< 1.3.0)
+ kaminari (>= 0.12.4)
+ meta_search (>= 0.9.2)
+ rails (>= 3.0.0)
+ sass (>= 3.1.0)
activemodel (3.1.3)
activesupport (= 3.1.3)
builder (~> 3.0.0)
@@ -30,6 +39,7 @@ GEM
activesupport (3.1.3)
multi_json (~> 1.0)
arel (2.2.1)
+ bcrypt-ruby (3.0.1)
builder (3.0.0)
capybara (1.1.2)
mime-types (>= 1.16)
@@ -58,27 +68,50 @@ GEM
cucumber (>= 1.1.1)
nokogiri (>= 1.5.0)
database_cleaner (0.7.0)
+ devise (1.5.2)
+ bcrypt-ruby (~> 3.0)
+ orm_adapter (~> 0.0.3)
+ warden (~> 1.1)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.2.9)
multi_json (~> 1.0)
+ fastercsv (1.5.4)
ffi (1.0.11)
+ formtastic (1.2.4)
+ actionpack (>= 2.3.7)
+ activesupport (>= 2.3.7)
+ i18n (~> 0.4)
gherkin (2.6.8)
json (>= 1.4.6)
haml (3.1.4)
+ has_scope (0.5.1)
hike (1.2.1)
i18n (0.6.0)
+ inherited_resources (1.2.2)
+ has_scope (~> 0.5.0)
+ responders (~> 0.6.0)
jquery-rails (1.0.19)
railties (~> 3.0)
thor (~> 0.14)
json (1.6.3)
+ kaminari (0.12.4)
+ rails (>= 3.0.0)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
+ meta_search (1.1.1)
+ actionpack (~> 3.1.0)
+ activerecord (~> 3.1.0)
+ activesupport (~> 3.1.0)
+ polyamorous (~> 0.5.0)
mime-types (1.17.2)
multi_json (1.0.4)
nokogiri (1.5.0)
+ orm_adapter (0.0.5)
+ polyamorous (0.5.0)
+ activerecord (~> 3.0)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
@@ -107,6 +140,7 @@ GEM
rake (0.9.2.2)
rdoc (3.11)
json (~> 1.4)
+ responders (0.6.4)
rspec (2.7.0)
rspec-core (~> 2.7.0)
rspec-expectations (~> 2.7.0)
@@ -147,6 +181,8 @@ GEM
uglifier (1.1.0)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
+ warden (1.1.0)
+ rack (>= 1.0)
xpath (0.1.4)
nokogiri (~> 1.3)
@@ -154,6 +190,7 @@ PLATFORMS
ruby
DEPENDENCIES
+ activeadmin
capybara
coffee-rails (~> 3.1.1)
coffee-script
@@ -161,6 +198,7 @@ DEPENDENCIES
database_cleaner
haml
jquery-rails
+ meta_search
rails (= 3.1.3)
rspec-rails
sass-rails (~> 3.1.5)
View
3 app/assets/javascripts/people.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
View
3 app/assets/stylesheets/people.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the people controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
View
56 app/assets/stylesheets/scaffolds.css.scss
@@ -0,0 +1,56 @@
+body {
+ background-color: #fff;
+ color: #333;
+ font-family: verdana, arial, helvetica, sans-serif;
+ font-size: 13px;
+ line-height: 18px; }
+
+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;
+ &:visited {
+ color: #666; }
+ &:hover {
+ color: #fff;
+ background-color: #000; } }
+
+div {
+ &.field, &.actions {
+ margin-bottom: 10px; } }
+
+#notice {
+ color: green; }
+
+.field_with_errors {
+ padding: 2px;
+ background-color: red;
+ display: table; }
+
+#error_explanation {
+ width: 450px;
+ border: 2px solid red;
+ padding: 7px;
+ padding-bottom: 0;
+ margin-bottom: 20px;
+ background-color: #f0f0f0;
+ h2 {
+ text-align: left;
+ font-weight: bold;
+ padding: 5px 5px 5px 15px;
+ font-size: 12px;
+ margin: -7px;
+ margin-bottom: 0px;
+ background-color: #c00;
+ color: #fff; }
+ ul li {
+ font-size: 12px;
+ list-style: square; } }
View
83 app/controllers/people_controller.rb
@@ -0,0 +1,83 @@
+class PeopleController < ApplicationController
+ # GET /people
+ # GET /people.json
+ def index
+ @people = Person.order(:last_name)
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @people }
+ end
+ end
+
+ # GET /people/1
+ # GET /people/1.json
+ def show
+ @person = Person.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @person }
+ end
+ end
+
+ # GET /people/new
+ # GET /people/new.json
+ def new
+ @person = Person.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @person }
+ end
+ end
+
+ # GET /people/1/edit
+ def edit
+ @person = Person.find(params[:id])
+ end
+
+ # POST /people
+ # POST /people.json
+ def create
+ @person = Person.new(params[:person])
+
+ respond_to do |format|
+ if @person.save
+ format.html { redirect_to @person, notice: 'Person was successfully created.' }
+ format.json { render json: @person, status: :created, location: @person }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @person.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /people/1
+ # PUT /people/1.json
+ def update
+ @person = Person.find(params[:id])
+
+ respond_to do |format|
+ if @person.update_attributes(params[:person])
+ format.html { redirect_to @person, notice: 'Person was successfully updated.' }
+ format.json { head :ok }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @person.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /people/1
+ # DELETE /people/1.json
+ def destroy
+ @person = Person.find(params[:id])
+ @person.destroy
+
+ respond_to do |format|
+ format.html { redirect_to people_url }
+ format.json { head :ok }
+ end
+ end
+end
View
2 app/helpers/people_helper.rb
@@ -0,0 +1,2 @@
+module PeopleHelper
+end
View
2 app/models/person.rb
@@ -0,0 +1,2 @@
+class Person < ActiveRecord::Base
+end
View
25 app/views/people/_form.html.erb
@@ -0,0 +1,25 @@
+<%= form_for(@person) do |f| %>
+ <% if @person.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@person.errors.count, "error") %> prohibited this person from being saved:</h2>
+
+ <ul>
+ <% @person.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :first_name %><br />
+ <%= f.text_field :first_name %>
+ </div>
+ <div class="field">
+ <%= f.label :last_name %><br />
+ <%= f.text_field :last_name %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
View
6 app/views/people/edit.html.erb
@@ -0,0 +1,6 @@
+<h1>Editing person</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @person %> |
+<%= link_to 'Back', people_path %>
View
25 app/views/people/index.html.erb
@@ -0,0 +1,25 @@
+<h1>Listing people</h1>
+
+<table>
+ <tr>
+ <th>First name</th>
+ <th>Last name</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+<% @people.each do |person| %>
+ <tr>
+ <td><%= person.first_name %></td>
+ <td><%= person.last_name %></td>
+ <td><%= link_to 'Show', person %></td>
+ <td><%= link_to 'Edit', edit_person_path(person) %></td>
+ <td><%= link_to 'Destroy', person, confirm: 'Are you sure?', method: :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New Person', new_person_path %>
View
5 app/views/people/new.html.erb
@@ -0,0 +1,5 @@
+<h1>New person</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', people_path %>
View
15 app/views/people/show.html.erb
@@ -0,0 +1,15 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>First name:</b>
+ <%= @person.first_name %>
+</p>
+
+<p>
+ <b>Last name:</b>
+ <%= @person.last_name %>
+</p>
+
+
+<%= link_to 'Edit', edit_person_path(@person) %> |
+<%= link_to 'Back', people_path %>
View
2 config/routes.rb
@@ -1,4 +1,6 @@
Work::Application.routes.draw do
+ resources :people
+
# The priority is based upon order of creation:
# first created -> highest priority.
View
10 db/migrate/20111205052702_create_people.rb
@@ -0,0 +1,10 @@
+class CreatePeople < ActiveRecord::Migration
+ def change
+ create_table :people do |t|
+ t.string :first_name
+ t.string :last_name
+
+ t.timestamps
+ end
+ end
+end
View
23 db/schema.rb
@@ -0,0 +1,23 @@
+# encoding: UTF-8
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20111205052702) do
+
+ create_table "people", :force => true do |t|
+ t.string "first_name"
+ t.string "last_name"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+end
View
38 features/maintain_people.feature
@@ -0,0 +1,38 @@
+Feature: Maintain People
+
+ As a Participation Committee admin
+ I want to view and revise who's eligible to use this application
+ So that we can hold everyone to the right level of commitment
+
+ *NOTE:* Direct adding and editing of people is _probably_ an interim feature.
+ We will set up automatic integration with Pete Pages's directory at
+ http://www.eastlakecommons.org in a later iteration.
+
+ Background:
+ # Given I am a Participation Committee administrator (TODO)
+ Given the following people:
+ | first name | last name |
+ | Bones | Fannon |
+ | Pete | Pages |
+ | Rachel | Slatkin |
+ | Steve | Eley |
+ | Zöey | Fortuin |
+
+
+ Scenario: View All People
+ (Sorting is by last name by default)
+
+ When I go to the people listing
+ Then I should see in order:
+ | Steve Eley |
+ | Bones Fannon |
+ | Zöey Fortuin |
+ | Pete Pages |
+ | Rachel Slatkin |
+
+
+
+
+
+
+
View
16 features/step_definitions/people_steps.rb
@@ -0,0 +1,16 @@
+Given /^the following people:$/ do |people|
+ people.hashes.each do |person|
+ Person.create first_name: person['first name'],
+ last_name: person['last name']
+ end
+end
+
+When /^I go to the people listing$/ do
+ visit "/people"
+end
+
+Then /^I should see in order:$/ do |list|
+ match_string = list.raw.flatten.join('.*').gsub(/\s/, '.*')
+ match = Regexp.new(match_string, Regexp::MULTILINE)
+ page.text.should =~ match
+end

No commit comments for this range

Something went wrong with that request. Please try again.