diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 11dc714..f0c276a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml index 04abf65..ba226dc 100644 --- a/app/views/layouts/_header.html.haml +++ b/app/views/layouts/_header.html.haml @@ -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} diff --git a/app/views/users/_user.html.haml b/app/views/users/_user.html.haml deleted file mode 100644 index 1e7f1cc..0000000 --- a/app/views/users/_user.html.haml +++ /dev/null @@ -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?" } diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml deleted file mode 100644 index b8f4e11..0000000 --- a/app/views/users/index.html.haml +++ /dev/null @@ -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 diff --git a/config/routes.rb b/config/routes.rb index d56ffdd..ddeb240 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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' diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 8dcd250..7a982f4 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -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