This commit is contained in:
MatsMyncke 2014-11-06 18:56:00 +01:00
parent ec6ca60887
commit af6f2668e6
14 changed files with 60 additions and 5 deletions

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,3 @@
// Place all the styles related to the Orders 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,13 @@
class OrdersController < ApplicationController
def new
end
def show
@user = User.find(params[:id])
end
def create
end
end

View file

@ -14,6 +14,8 @@ class SessionsController < ApplicationController
end
def destroy
log_out
redirect_to root_url
end
end

View file

@ -9,8 +9,9 @@ class UsersController < ApplicationController
def create
@user = User.new(user_params)
if @user.save
log_in @user
flash[:success] = "Welcome to the Sample App!"
redirect_to @user
else
render 'new'

View file

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

View file

@ -11,4 +11,10 @@ module SessionsHelper
def logged_in?
!current_user.nil?
end
def log_out
session.delete(:user_id)
@current_user = nil
end
end

View file

@ -0,0 +1,3 @@
<h1>Orders#new</h1>
<p>Find me in app/views/orders/new.html.erb</p>
<p>In opbouw!</p>

View file

@ -0,0 +1 @@
<%= @user.name %>

View file

@ -1,5 +1,6 @@
<% @users.each do |user| %>
<tr class="clickableRow" href= "order" >
<tr class="clickableRow" href= <%= "order"%> >
<td><%= user.id %></td>
<td><%= user.name %></td>
<td><% user.marks.times do %>

View file

@ -1 +0,0 @@
<h1> order page </h1>

View file

@ -1,20 +1,28 @@
Rails.application.routes.draw do
get 'orders/new'
root 'static_pages#home'
get 'sessions/new'
get 'users/new'
get 'order' => 'static_pages#order'
get 'help' => 'static_pages#help'
get 'static_pages/home'
get 'overview' => 'static_pages#overview'
get 'static_pages/overview'
#order stuff
get 'order' => 'orders#new'
post 'order' => 'orders#create'
delete 'chaos' => 'orders#destroy'
#account stuff
get 'signup' => 'users#new'
get 'login' => 'sessions#new'
post 'login' => 'sessions#create'
delete 'logout' => 'sessions#destroy'

View file

@ -0,0 +1,9 @@
require 'test_helper'
class OrdersControllerTest < ActionController::TestCase
test "should get new" do
get :new
assert_response :success
end
end

View file

@ -0,0 +1,4 @@
require 'test_helper'
class OrdersHelperTest < ActionView::TestCase
end