diff --git a/app/assets/stylesheets/pamela.css.scss b/app/assets/stylesheets/macs.css.scss similarity index 100% rename from app/assets/stylesheets/pamela.css.scss rename to app/assets/stylesheets/macs.css.scss diff --git a/app/controllers/pamela_controller.rb b/app/controllers/macs_controller.rb similarity index 94% rename from app/controllers/pamela_controller.rb rename to app/controllers/macs_controller.rb index f47115e..14188e0 100644 --- a/app/controllers/pamela_controller.rb +++ b/app/controllers/macs_controller.rb @@ -1,4 +1,4 @@ -class PamelaController < ApplicationController +class MacsController < ApplicationController #require "active_record" require "optparse" @@ -41,10 +41,13 @@ end # POST /user def create @mac = Mac.new(params[:mac]) + @mac.user_id = params[:user_id] + + Rails.logger.info @macs.inspect respond_to do |format| if @mac.save - format.html { redirect_to "/pamela", :notice => 'Mac was successfully created.' } + format.html { redirect_to macs_path, :notice => 'Mac was successfully created.' } format.json { render :json => @mac, :status => :created, :location => @mac } else format.html { render :action => "new" } @@ -61,7 +64,8 @@ end respond_to do |format| if @mac.update_attributes(params[:mac]) - format.html { redirect_to "/pamela", :notice => 'User certification was successfully updated.' } + Rails.logger.info @mac.inspect + format.html { redirect_to macs_path, :notice => 'User certification was successfully updated.' } format.json { head :no_content } else format.html { render :action => "edit" } diff --git a/app/views/pamela/_form.html.erb b/app/views/macs/_form.html.erb similarity index 100% rename from app/views/pamela/_form.html.erb rename to app/views/macs/_form.html.erb diff --git a/app/views/macs/edit.html.erb b/app/views/macs/edit.html.erb new file mode 100644 index 0000000..2765d61 --- /dev/null +++ b/app/views/macs/edit.html.erb @@ -0,0 +1,6 @@ +

Editing Mac

+ +<%= render 'form' %> + +<%= link_to 'Show', @mac %> | +<%= link_to 'Back', macs_path %> diff --git a/app/views/pamela/index.html.erb b/app/views/macs/index.html.erb similarity index 100% rename from app/views/pamela/index.html.erb rename to app/views/macs/index.html.erb diff --git a/app/views/macs/new.html.erb b/app/views/macs/new.html.erb new file mode 100644 index 0000000..0b1d5c5 --- /dev/null +++ b/app/views/macs/new.html.erb @@ -0,0 +1,5 @@ +

New Mac

+ +<%= render 'form' %> + +<%= link_to 'Back', macs_path %> diff --git a/app/views/pamela/scan.html.erb b/app/views/macs/scan.html.erb similarity index 100% rename from app/views/pamela/scan.html.erb rename to app/views/macs/scan.html.erb diff --git a/app/views/macs/show.html.erb b/app/views/macs/show.html.erb new file mode 100644 index 0000000..340d91c --- /dev/null +++ b/app/views/macs/show.html.erb @@ -0,0 +1,12 @@ +

+ User: + <%= @mac.user.name unless @mac.user.blank? %> +

+ +

+ Mac: + <%= @mac.mac %> +

+ +<%= link_to 'Edit', edit_mac_path(@mac) %> | +<%= link_to 'Back', macs_path %> diff --git a/app/views/pamela/edit.html.erb b/app/views/pamela/edit.html.erb deleted file mode 100644 index bad1ee6..0000000 --- a/app/views/pamela/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Editing User Certification

- -<%= render 'form' %> - -<%= link_to 'Show', @user_certification %> | -<%= link_to 'Back', user_certifications_path %> diff --git a/app/views/pamela/new.html.erb b/app/views/pamela/new.html.erb deleted file mode 100644 index e2d36ae..0000000 --- a/app/views/pamela/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New User Certification

- -<%= render 'form' %> - -<%= link_to 'Back', user_certifications_path %> diff --git a/config/routes.rb b/config/routes.rb index 04288db..2febb7a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -27,14 +27,8 @@ Dooraccess::Application.routes.draw do match 'door_logs/download' => 'door_logs#download', :as => :download match 'door_logs/auto_download' => 'door_logs#auto_download', :as => :auto_download - match 'pamela/scan' => 'pamela#scan' - match 'pamela' => 'pamela#index', :as => :macs - match 'pamela/:id' => 'pamela#show', :as => :mac - match 'pamela/:id/edit' => 'pamela#edit', :as => :edit_mac - put 'pamela/:id' => 'pamela#update' #PUT - match 'pamela/new' => 'pamela#new', :as => :new_mac - post 'pamela' => 'pamela#create' #POST - + match 'macs/scan' => 'macs#scan' + resources :macs root :to => "home#index"