From 1d6699ae9f8dc87111d8ed333e333129f907002b Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Tue, 24 Jun 2014 12:20:17 -0700 Subject: [PATCH] Increasing visible detail of mac log --- app/controllers/mac_logs_controller.rb | 4 ++++ app/views/mac_logs/index.html.erb | 32 ++++++++++++++++++++++++-- app/views/macs/index.html.erb | 3 ++- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/app/controllers/mac_logs_controller.rb b/app/controllers/mac_logs_controller.rb index 0008f3f..f2905fe 100755 --- a/app/controllers/mac_logs_controller.rb +++ b/app/controllers/mac_logs_controller.rb @@ -4,6 +4,10 @@ before_filter :authenticate_user! def index @mac_logs = MacLog.desc.limit(1000) + @macs = {} + @mac_logs.each do |log| + @macs.merge!({log.mac => Mac.find_by_mac(log.mac)}) + end end end diff --git a/app/views/mac_logs/index.html.erb b/app/views/mac_logs/index.html.erb index 7baf7ba..c18c949 100755 --- a/app/views/mac_logs/index.html.erb +++ b/app/views/mac_logs/index.html.erb @@ -1,9 +1,37 @@ + <% @mac_logs.each do |mac_log| %> - + + - + <% end %> diff --git a/app/views/macs/index.html.erb b/app/views/macs/index.html.erb index d93c444..3ebb75f 100755 --- a/app/views/macs/index.html.erb +++ b/app/views/macs/index.html.erb @@ -33,10 +33,11 @@ @active_macs.each do |mac| Rails.logger.info mac.inspect %>
  • + <%= link_to mac do %> <%= " - "+((Time.now - mac.since) / 1.hour).round(1).to_s+" hours" if can? :manage, mac %>"> <%= mac.user.name unless mac.user.blank? %> <%= mac.mac if mac.user.blank? %> - <%= "("+mac.note+")" unless mac.note.blank? %> + <%= "("+mac.note+")" unless mac.note.blank? %><% end %>   <%= link_to ' Edit', edit_mac_path(mac) if can? :update, mac %>
  • <% end %>
    <%= mac_log.mac %> + <% if @macs[mac_log.mac].user_id.blank? %> + <% else %> + <%= link_to @macs[mac_log.mac].user.name, @macs[mac_log.mac].user %>
    + <% end %> +
    + <% if @macs[mac_log.mac].blank? %> + <%= mac_log.mac %> + <% else %> + <% if @macs[mac_log.mac].note.blank? %> + <%= link_to mac_log.mac, @macs[mac_log.mac] %>
    + <% else %> + <%= link_to @macs[mac_log.mac].note, @macs[mac_log.mac] %>
    + <%= mac_log.mac %> + <% end %> + <% end %> +
    <%= mac_log.ip %><%= mac_log.action %> + <% if mac_log.action == "activate" %> + + <% else %> + + <% end %> + <%= mac_log.action %> + + <%= mac_log.created_at %>