diff --git a/app/.DS_Store b/app/.DS_Store
new file mode 100644
index 0000000..84f5661
Binary files /dev/null and b/app/.DS_Store differ
diff --git a/app/assets/images/logo.png b/app/assets/images/logo.png
new file mode 100644
index 0000000..965f1a5
Binary files /dev/null and b/app/assets/images/logo.png differ
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index e07c5a8..8233b43 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -13,4 +13,3 @@
//= require jquery
//= require jquery_ujs
//= require turbolinks
-//= require_tree .
diff --git a/app/assets/javascripts/login_signup.js b/app/assets/javascripts/login_signup.js
new file mode 100644
index 0000000..12f3a8d
--- /dev/null
+++ b/app/assets/javascripts/login_signup.js
@@ -0,0 +1,7 @@
+$(function () {
+ $('img').hover(function () {
+ $(this).addClass('dancing');
+ }, function () {
+ $(this).removeClass('dancing');
+ });
+});
diff --git a/app/assets/javascripts/transgressions.coffee b/app/assets/javascripts/transgressions.coffee
new file mode 100644
index 0000000..24f83d1
--- /dev/null
+++ b/app/assets/javascripts/transgressions.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://coffeescript.org/
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index 125c24e..44e64e4 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -14,6 +14,14 @@
*= require_self
*/
+* {
+ box-sizing: border-box;
+}
+
+html {
+ font-size: 24px;
+}
+
div.alert {
background: pink;
border: 1px solid black;
@@ -21,3 +29,48 @@ div.alert {
padding: 1rem;
font-size: 1.4rem;
}
+
+header {
+ height: 4rem;
+
+ border-bottom: 2px solid grey;
+}
+
+header {
+ background: #222;
+ color: deeppink;
+ padding: 0.5rem;
+}
+
+.logo > img {
+ display: block;
+ float: left;
+ height: 3rem;
+ padding: 0.5rem;
+
+ transition: 0.5s transform bounce;
+}
+
+.logo > img.dancing {
+ transform: scaleX(-1);
+}
+
+span {
+ font-family: cursive;
+ display: block;
+ float: left;
+ font-size: 2.6rem;
+ line-height: 3rem;
+}
+
+nav {
+ float: right;
+ color: white;
+}
+
+nav a {
+ color: white;
+ text-decoration: none;
+ font-size: 1.3rem;
+ line-height: 3rem;
+}
diff --git a/app/assets/stylesheets/transgressions.scss b/app/assets/stylesheets/transgressions.scss
new file mode 100644
index 0000000..c1b1bd4
--- /dev/null
+++ b/app/assets/stylesheets/transgressions.scss
@@ -0,0 +1,10 @@
+// Place all the styles related to the transgressions controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+form input, form select {
+ padding: 0.5rem;
+ font-size: 2rem;
+ border: 1px solid green;
+ width: 75%;
+}
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 9617794..ecabe61 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -24,4 +24,12 @@ class ApplicationController < ActionController::Base
@current_user = false
end
end
+
+ def logged_in?
+ !!current_user
+ end
+
+ def require_current_user
+ redirect_to root_path unless logged_in?
+ end
end
diff --git a/app/controllers/transgressions_controller.rb b/app/controllers/transgressions_controller.rb
new file mode 100644
index 0000000..5f7b2ad
--- /dev/null
+++ b/app/controllers/transgressions_controller.rb
@@ -0,0 +1,43 @@
+class TransgressionsController < ApplicationController
+ before_action :require_current_user
+
+ def new
+ @transgression = Transgression.new
+ end
+
+ def create
+ @transgression = current_user.transgressions
+ .new(transgression_params)
+
+ if @transgression.save
+ redirect_to transgressions_path
+ else
+ flash[:message] = @transgression.errors.full_messages.to_sentence
+ render :new
+ end
+ end
+
+ def edit
+ end
+
+ def update
+ # params[:id]
+ end
+
+ def show
+ end
+
+ def index
+ @transgressions = current_user.transgressions
+ end
+
+ def delete
+ end
+
+ private
+
+ def transgression_params
+ return params.require(:transgression)
+ .permit(:sin_type, :description)
+ end
+end
diff --git a/app/helpers/transgressions_helper.rb b/app/helpers/transgressions_helper.rb
new file mode 100644
index 0000000..341e0fd
--- /dev/null
+++ b/app/helpers/transgressions_helper.rb
@@ -0,0 +1,2 @@
+module TransgressionsHelper
+end
diff --git a/app/models/transgression.rb b/app/models/transgression.rb
new file mode 100644
index 0000000..7f4c475
--- /dev/null
+++ b/app/models/transgression.rb
@@ -0,0 +1,14 @@
+class Transgression < ActiveRecord::Base
+ SIN_TYPES = [
+ 'Gluttony', 'Greed', 'Anger', 'Pride',
+ 'Lust', 'Sloth', 'Envy'
+ ]
+
+ validates :description, presence: true
+ validates :user, presence: true
+ validates :sin_type, inclusion: { in: SIN_TYPES }
+
+ belongs_to :user
+end
+
+# Transgression::SIN_TYPES
diff --git a/app/models/user.rb b/app/models/user.rb
index b6922d9..8e0dc61 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -7,4 +7,6 @@ class User < ActiveRecord::Base
validates :password, length: {
minimum: 8, allow_nil: true
}
+
+ has_many :transgressions
end
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
new file mode 100644
index 0000000..50fcd76
--- /dev/null
+++ b/app/views/layouts/_header.html.erb
@@ -0,0 +1,17 @@
+