From 04764af983fff9c556b38d492d5624c76c6b2901 Mon Sep 17 00:00:00 2001
From: Will Bradley
- <%= collection_select(:mac, :user_id, @users, :id, :name) %>
+ <%= collection_select(:mac, :user_id, @users, :id, :name, :include_blank => true) %>
+ <%= f.label :mac %>
<%= f.text_field :mac %>
+ <%= f.text_field :note %>
+
+ <%= f.check_box :hidden %>
+ What machines are on our network?
-<% @macs.each do |mac| %>
+<% @active_macs.each do |mac| %>
<%= mac.user.name unless mac.user.blank? %>
<%= mac.mac if mac.user.blank? %> |
<%= link_to 'Edit', edit_mac_path(mac) %>
<% end %>
+
+<% @hidden_macs.each do |mac| %>
+ <%= mac.user.name unless mac.user.blank? %>
+ <%= mac.mac if mac.user.blank? %>
+ (<%= mac.note %>) |
+ <%= link_to 'Edit', edit_mac_path(mac) %>
+<% end %>
+
+<% @inactive_macs.each do |mac| %>
+ <%= mac.user.name unless mac.user.blank? %>
+ <%= mac.mac if mac.user.blank? %>
+ (<%= mac.note %>) |
+ <%= link_to 'Edit', edit_mac_path(mac) %>
+<% end %>
diff --git a/app/views/macs/show.html.erb b/app/views/macs/show.html.erb
index 340d91c..d8f503f 100644
--- a/app/views/macs/show.html.erb
+++ b/app/views/macs/show.html.erb
@@ -8,5 +8,20 @@
<%= @mac.mac %>
+ Note: + <%= @mac.note %> +
+ ++ Hidden: + <%= @mac.hidden %> +
+ ++ IP: + <%= @mac.ip %> +
+ <%= link_to 'Edit', edit_mac_path(@mac) %> | <%= link_to 'Back', macs_path %> diff --git a/db/migrate/20130201042646_add_properties_to_macs.rb b/db/migrate/20130201042646_add_properties_to_macs.rb new file mode 100644 index 0000000..f75672a --- /dev/null +++ b/db/migrate/20130201042646_add_properties_to_macs.rb @@ -0,0 +1,6 @@ +class AddPropertiesToMacs < ActiveRecord::Migration + def change + add_column :macs, :hidden, :boolean + add_column :macs, :note, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 148d575..d957967 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130201022153) do +ActiveRecord::Schema.define(:version => 20130201042646) do create_table "cards", :force => true do |t| t.string "card_number" @@ -52,6 +52,8 @@ ActiveRecord::Schema.define(:version => 20130201022153) do t.boolean "active" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.boolean "hidden" + t.string "note" end add_index "macs", ["user_id"], :name => "index_macs_on_user_id"