diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index d43dd81..1a671f7 100755 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -1,6 +1,6 @@ class AdminController < ApplicationController - #before_filter :administrative + before_filter :administrative, :if => :admin_param skip_before_filter :has_info def dashboard @@ -44,5 +44,11 @@ class AdminController < ApplicationController format.json { render :json => { :msg => message ? "success" : "failure"} } end end + + private + + def admin_param + params[:id] == '1' + end end diff --git a/app/views/admin/dashboard.html.erb b/app/views/admin/dashboard.html.erb index 3e1466c..da2c845 100755 --- a/app/views/admin/dashboard.html.erb +++ b/app/views/admin/dashboard.html.erb @@ -59,7 +59,7 @@ function makeActive(){ }; function loadTable(){ - $("#userDataTable").load("/admin/"+ <%=current_user.user_id %> + "/get_all_users") + $("#userDataTable").load("/admin/"+ <%= params[:admin_id] %> + "/get_all_users") }; $(document).ready( diff --git a/app/views/layouts/admin/_get_user.html.erb b/app/views/layouts/admin/_get_user.html.erb index eda97d7..9557b7d 100755 --- a/app/views/layouts/admin/_get_user.html.erb +++ b/app/views/layouts/admin/_get_user.html.erb @@ -83,7 +83,7 @@ $('#delete_button').click(function() { $("#editAcct").modal('hide'); $.ajax({ - url: "/admin/" + <%= @user.user_id %> + "/delete_user.json", + url: "/admin/" + <%= params[:admin_id] %> + "/delete_user.json", type: "POST", success: function(response) { $('#success').show(500).delay(1500).fadeOut(); diff --git a/db/seeds.rb b/db/seeds.rb index 7a46893..9750f25 100755 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -33,8 +33,8 @@ users = [ { :email => "mike@metacorp.com", :admin => false, - :password => "motorcross1445", - :password_confirmation => "motorcross1445", + :password => "motocross1445", + :password_confirmation => "motocross1445", :first_name => "Mike", :last_name => "McCabe", :user_id =>4