Remove index and destroy on userscontroller

This commit is contained in:
benji 2015-09-18 21:05:32 +02:00
parent 4fcc598193
commit 17a54723ec
6 changed files with 1 additions and 52 deletions

View file

@ -18,16 +18,6 @@ class UsersController < ApplicationController
end
end
def index
@users = User.members
end
def destroy
@user.destroy
flash[:success] = "Succesfully removed user"
redirect_to users_path
end
def edit_dagschotel
@dagschotel = @user.dagschotel

View file

@ -28,12 +28,6 @@
%li= link_to "List", products_path
%li= link_to "Add product" , new_product_path
%li= link_to "Add stock", new_stock_path
%li.dropdown
%a.dropdown-toggle{"aria-expanded" => "false", "data-toggle" => "dropdown", href: "#", role: "button"}
Users
%span.caret
%ul.dropdown-menu{role: "menu"}
%li= link_to "List" , users_path
%li.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
Logged in as #{current_user.name}

View file

@ -1,8 +0,0 @@
%tr
%td= user.id
%td= image_tag user.avatar(:small)
%td= user.name
%td= euro(user.debt)
- if current_user.admin?
%td
= link_to "Delete", user_path(user), method: :delete, class: "btn btn-danger", data: { confirm: "Are you sure?" }

View file

@ -1,12 +0,0 @@
.row.users
.col-md-8.col-md-offset-2
%h1 All users
= render partial: 'flash'
%table#users-table.table.table-striped
%tr
%th ID
%th
%th Nickname
%th Debt
%th
= render @users

View file

@ -18,7 +18,7 @@ Rails.application.routes.draw do
end
end
resources :users, only: [:show, :edit, :update, :index, :destroy] do
resources :users, only: [:show, :edit, :update] do
resources :orders, only: [:new, :create, :destroy]
member do
get 'quickpay' => 'users#quickpay'

View file

@ -51,21 +51,6 @@ describe UsersController, type: :controller do
end
end
describe 'GET index' do
before :each do
get :index
end
it 'should load an array of all users' do
expect(assigns(:users)).to eq([@user])
end
it 'should render the correct template' do
expect(response).to render_template(:index)
expect(response).to have_http_status(200)
end
end
describe 'GET edit_dagschotel' do
it 'should render the page' do
get :edit_dagschotel, id: @user