diff --git a/app/controllers/admin/members_controller.rb b/app/controllers/admin/members_controller.rb new file mode 100644 index 000000000..ed5f31939 --- /dev/null +++ b/app/controllers/admin/members_controller.rb @@ -0,0 +1,12 @@ +class Admin::MembersController < ApplicationController + before_action :auth! + def index + @members = Member.order(:login_name).paginate(page: params[:page]) + end + + private + + def auth! + authorize! :manage, :all + end +end diff --git a/app/views/admin/index.html.haml b/app/views/admin/index.html.haml index cd65d7843..673461aa5 100644 --- a/app/views/admin/index.html.haml +++ b/app/views/admin/index.html.haml @@ -21,6 +21,7 @@ %h2 Member admin %ul %li= link_to "Newsletter subscribers", admin_newsletter_path + %li= link_to "Members", admin_members_path .row .col-md-12 diff --git a/app/views/admin/members/index.html.haml b/app/views/admin/members/index.html.haml new file mode 100644 index 000000000..247f8fe77 --- /dev/null +++ b/app/views/admin/members/index.html.haml @@ -0,0 +1,15 @@ +.pagination + = page_entries_info @members + = will_paginate @members + + +%table.table.table-striped + %tr + %th Name + %th Email + %th + %th + - @members.each do |member| + %tr + %td=member.login_name + %td=member.email diff --git a/config/routes.rb b/config/routes.rb index 2a9aa7d5e..eb963311a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -90,6 +90,9 @@ Growstuff::Application.routes.draw do get '/shop/:action' => 'shop#:action' comfy_route :cms_admin, path: '/admin/cms' + namespace :admin do + resources :members + end get '/admin/orders' => 'admin/orders#index' get '/admin/orders/:action' => 'admin/orders#:action' get '/admin' => 'admin#index'