Initial commit

This commit is contained in:
2013-10-08 22:10:03 -07:00
commit 5a94d69b3d
73 changed files with 1287 additions and 0 deletions

0
app/assets/images/.keep Normal file
View File

View File

@@ -0,0 +1,16 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .

View File

@@ -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://coffeescript.org/

View File

@@ -0,0 +1,13 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/

View File

@@ -0,0 +1,69 @@
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 File

@@ -0,0 +1,3 @@
// Place all the styles related to the Spaces controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,5 @@
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
end

View File

View File

@@ -0,0 +1,74 @@
class SpacesController < ApplicationController
before_action :set_space, only: [:show, :edit, :update, :destroy]
# GET /spaces
# GET /spaces.json
def index
@spaces = Space.all
end
# GET /spaces/1
# GET /spaces/1.json
def show
end
# GET /spaces/new
def new
@space = Space.new
end
# GET /spaces/1/edit
def edit
end
# POST /spaces
# POST /spaces.json
def create
@space = Space.new(space_params)
respond_to do |format|
if @space.save
format.html { redirect_to @space, notice: 'Space was successfully created.' }
format.json { render action: 'show', status: :created, location: @space }
else
format.html { render action: 'new' }
format.json { render json: @space.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /spaces/1
# PATCH/PUT /spaces/1.json
def update
respond_to do |format|
if @space.update(space_params)
format.html { redirect_to @space, notice: 'Space was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @space.errors, status: :unprocessable_entity }
end
end
end
# DELETE /spaces/1
# DELETE /spaces/1.json
def destroy
@space.destroy
respond_to do |format|
format.html { redirect_to spaces_url }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_space
@space = Space.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def space_params
params.require(:space).permit(:name, :type, :address, :hours, :phone, :email, :website, :description)
end
end

View File

@@ -0,0 +1,2 @@
module ApplicationHelper
end

View File

@@ -0,0 +1,2 @@
module SpacesHelper
end

0
app/mailers/.keep Normal file
View File

0
app/models/.keep Normal file
View File

View File

2
app/models/space.rb Normal file
View File

@@ -0,0 +1,2 @@
class Space < ActiveRecord::Base
end

View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Arizonacollab</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>

View File

@@ -0,0 +1,49 @@
<%= form_for(@space) do |f| %>
<% if @space.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@space.errors.count, "error") %> prohibited this space from being saved:</h2>
<ul>
<% @space.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %><br>
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :type %><br>
<%= f.text_field :type %>
</div>
<div class="field">
<%= f.label :address %><br>
<%= f.text_field :address %>
</div>
<div class="field">
<%= f.label :hours %><br>
<%= f.text_field :hours %>
</div>
<div class="field">
<%= f.label :phone %><br>
<%= f.text_field :phone %>
</div>
<div class="field">
<%= f.label :email %><br>
<%= f.text_field :email %>
</div>
<div class="field">
<%= f.label :website %><br>
<%= f.text_field :website %>
</div>
<div class="field">
<%= f.label :description %><br>
<%= f.text_area :description %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>

View File

@@ -0,0 +1,6 @@
<h1>Editing space</h1>
<%= render 'form' %>
<%= link_to 'Show', @space %> |
<%= link_to 'Back', spaces_path %>

View File

@@ -0,0 +1,41 @@
<h1>Listing spaces</h1>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Address</th>
<th>Hours</th>
<th>Phone</th>
<th>Email</th>
<th>Website</th>
<th>Description</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<% @spaces.each do |space| %>
<tr>
<td><%= space.name %></td>
<td><%= space.type %></td>
<td><%= space.address %></td>
<td><%= space.hours %></td>
<td><%= space.phone %></td>
<td><%= space.email %></td>
<td><%= space.website %></td>
<td><%= space.description %></td>
<td><%= link_to 'Show', space %></td>
<td><%= link_to 'Edit', edit_space_path(space) %></td>
<td><%= link_to 'Destroy', space, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Space', new_space_path %>

View File

@@ -0,0 +1,4 @@
json.array!(@spaces) do |space|
json.extract! space, :name, :type, :address, :hours, :phone, :email, :website, :description
json.url space_url(space, format: :json)
end

View File

@@ -0,0 +1,5 @@
<h1>New space</h1>
<%= render 'form' %>
<%= link_to 'Back', spaces_path %>

View File

@@ -0,0 +1,44 @@
<p id="notice"><%= notice %></p>
<p>
<strong>Name:</strong>
<%= @space.name %>
</p>
<p>
<strong>Type:</strong>
<%= @space.type %>
</p>
<p>
<strong>Address:</strong>
<%= @space.address %>
</p>
<p>
<strong>Hours:</strong>
<%= @space.hours %>
</p>
<p>
<strong>Phone:</strong>
<%= @space.phone %>
</p>
<p>
<strong>Email:</strong>
<%= @space.email %>
</p>
<p>
<strong>Website:</strong>
<%= @space.website %>
</p>
<p>
<strong>Description:</strong>
<%= @space.description %>
</p>
<%= link_to 'Edit', edit_space_path(@space) %> |
<%= link_to 'Back', spaces_path %>

View File

@@ -0,0 +1 @@
json.extract! @space, :name, :type, :address, :hours, :phone, :email, :website, :description, :created_at, :updated_at