Initial commit

This commit is contained in:
2013-04-29 22:55:08 -07:00
commit 067ebd998f
68 changed files with 1593 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

+15
View File
@@ -0,0 +1,15 @@
// 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
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
@@ -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/
+13
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 .
*/
+3
View File
@@ -0,0 +1,3 @@
// Place all the styles related to the Payments controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+69
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;
}
}
@@ -0,0 +1,3 @@
class ApplicationController < ActionController::Base
protect_from_forgery
end
+83
View File
@@ -0,0 +1,83 @@
class PaymentsController < ApplicationController
# GET /payments
# GET /payments.json
def index
@payments = Payment.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @payments }
end
end
# GET /payments/1
# GET /payments/1.json
def show
@payment = Payment.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @payment }
end
end
# GET /payments/new
# GET /payments/new.json
def new
@payment = Payment.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @payment }
end
end
# GET /payments/1/edit
def edit
@payment = Payment.find(params[:id])
end
# POST /payments
# POST /payments.json
def create
@payment = Payment.new(params[:payment])
respond_to do |format|
if @payment.save
format.html { redirect_to @payment, notice: 'Payment was successfully created.' }
format.json { render json: @payment, status: :created, location: @payment }
else
format.html { render action: "new" }
format.json { render json: @payment.errors, status: :unprocessable_entity }
end
end
end
# PUT /payments/1
# PUT /payments/1.json
def update
@payment = Payment.find(params[:id])
respond_to do |format|
if @payment.update_attributes(params[:payment])
format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @payment.errors, status: :unprocessable_entity }
end
end
end
# DELETE /payments/1
# DELETE /payments/1.json
def destroy
@payment = Payment.find(params[:id])
@payment.destroy
respond_to do |format|
format.html { redirect_to payments_url }
format.json { head :no_content }
end
end
end
+2
View File
@@ -0,0 +1,2 @@
module ApplicationHelper
end
+2
View File
@@ -0,0 +1,2 @@
module PaymentsHelper
end
View File
View File
+3
View File
@@ -0,0 +1,3 @@
class Payment < ActiveRecord::Base
attr_accessible :profile
end
+14
View File
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>RubyPaypalExample</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>
+21
View File
@@ -0,0 +1,21 @@
<%= form_for(@payment) do |f| %>
<% if @payment.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@payment.errors.count, "error") %> prohibited this payment from being saved:</h2>
<ul>
<% @payment.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :profile %><br />
<%= f.text_field :profile %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
+6
View File
@@ -0,0 +1,6 @@
<h1>Editing payment</h1>
<%= render 'form' %>
<%= link_to 'Show', @payment %> |
<%= link_to 'Back', payments_path %>
+23
View File
@@ -0,0 +1,23 @@
<h1>Listing payments</h1>
<table>
<tr>
<th>Profile</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @payments.each do |payment| %>
<tr>
<td><%= payment.profile %></td>
<td><%= link_to 'Show', payment %></td>
<td><%= link_to 'Edit', edit_payment_path(payment) %></td>
<td><%= link_to 'Destroy', payment, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New Payment', new_payment_path %>
+5
View File
@@ -0,0 +1,5 @@
<h1>New payment</h1>
<%= render 'form' %>
<%= link_to 'Back', payments_path %>
+10
View File
@@ -0,0 +1,10 @@
<p id="notice"><%= notice %></p>
<p>
<b>Profile:</b>
<%= @payment.profile %>
</p>
<%= link_to 'Edit', edit_payment_path(@payment) %> |
<%= link_to 'Back', payments_path %>