From: Martyn Taylor <mtaylor(a)redhat.com>
---
src/app/models/hardware_profile.rb | 5 ++++-
src/app/views/users/index.haml | 4 +++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/app/models/hardware_profile.rb b/src/app/models/hardware_profile.rb
index f6dead3..d5f66eb 100644
--- a/src/app/models/hardware_profile.rb
+++ b/src/app/models/hardware_profile.rb
@@ -21,7 +21,10 @@
class HardwareProfile < ActiveRecord::Base
has_many :instances
+
+ named_scope :frontend, :conditions => { :provider_id => nil }
named_scope :frontend, :conditions => { :provider_id => nil }
+
has_many :provider_instances, :class_name => "Instance",
:foreign_key => "provider_hardware_profile_id"
@@ -104,7 +107,7 @@ class HardwareProfile < ActiveRecord::Base
def self.matching_hwps(hwp)
matching_hwps = []
- provider_hwps = HardwareProfile.find_by_sql("SELECT * FROM hardware_profiles
WHERE provider_id IS NOT NULL")
+ provider_hwps = HardwareProfile.all(:conditions => 'provider_id IS NOT
NULL')
provider_hwps.each do |phwp|
if check_properties(hwp, phwp)
diff --git a/src/app/views/users/index.haml b/src/app/views/users/index.haml
index d0a5d7e..8ec3178 100644
--- a/src/app/views/users/index.haml
+++ b/src/app/views/users/index.haml
@@ -26,16 +26,18 @@
=link_to "Quota", users_url(:sort_by => "quota")
%span (Instances)
%th= link_to "e-mail", users_url(:sort_by => "email")
+ %th
-(a)users.each do |user|
%tr
%td
%input{:name => "user_checkbox", :type => "radio",
:value => user.id, :id => "user_checkbox_#{user.id}" }
- %td= link_to user.login, {:action => "edit", :id => user.id}
+ %td= link_to user.login, user_path(user)
%td= user.last_name
%td= user.first_name
%td= sprintf("%.2f", user.quota.percentage_used)
%td= Quota.no_limit(user.quota.maximum_running_instances) ? "Unlimited"
: user.quota.maximum_running_instances
%td= user.email
+ %td= link_to "edit", edit_user_path(user)
:javascript
$(document).ready(function () {
--
1.7.2.3
Show replies by date
From: Martyn Taylor <mtaylor(a)redhat.com>
---
src/app/controllers/users_controller.rb | 1 +
src/app/stylesheets/aggregator.scss | 4 +
src/app/views/users/show.haml | 133 ++++++++++++++++++++++++-------
3 files changed, 109 insertions(+), 29 deletions(-)
diff --git a/src/app/controllers/users_controller.rb
b/src/app/controllers/users_controller.rb
index 9896c98..0e3220f 100644
--- a/src/app/controllers/users_controller.rb
+++ b/src/app/controllers/users_controller.rb
@@ -58,6 +58,7 @@ class UsersController < ApplicationController
else
@user = current_user
end
+ @quota_resources = @user.quota.quota_resources()
end
def edit
diff --git a/src/app/stylesheets/aggregator.scss b/src/app/stylesheets/aggregator.scss
index ce62b89..fe37976 100644
--- a/src/app/stylesheets/aggregator.scss
+++ b/src/app/stylesheets/aggregator.scss
@@ -260,6 +260,10 @@ table {
background: #fff url(../../images/order-asc.png) no-repeat center right;
}
}
+ &.show {
+ border: 0px;
+ width: 50%
+ }
a, a:hover, a:active {
display: block;
margin: 0;
diff --git a/src/app/views/users/show.haml b/src/app/views/users/show.haml
index fd7254f..7c522c8 100644
--- a/src/app/views/users/show.haml
+++ b/src/app/views/users/show.haml
@@ -1,29 +1,104 @@
-.dcloud_form.grid_16
- %h2
- User Profile for #{h @user.login}
- %ul.block
- %li.block.grid_3.alpha
- %label Username:
- %li.block.grid_5
- = h @user.login
- %li.block.grid_3
- %label Login Count:
- %li.block.grid_5.omega
- = h @user.login_count
- %li.block.grid_3.alpha.clear
- %label Last Request at:
- %li.block.grid_5
- = h @user.last_request_at
- %li.block.grid_3
- %label Current Login at:
- %li.block.grid_5.omega
- = h @user.current_login_at
- %li.block.grid_3.alpha.clear
- %label Last Login IP:
- %li.block.grid_5
- = h @user.last_login_ip
- %li.block.grid_3
- %label Current Login IP:
- %li.block.grid_5.omega
- = h @user.current_login_ip
- = link_to 'Edit', edit_account_path, :class => 'actionlink button'
+.grid_3.actionsidebar
+ %dl
+ %dt
+ Users
+ %dd.edit
+ %span
+ = link_to "edit", edit_user_path(@user)
+
+.grid_13
+ %h2 #{(a)user.first_name} #{(a)user.last_name} (#{(a)user.login})
+
+ %table
+ %thead
+ %tr
+ %th.show
+ Personal Details
+ %th.show
+ %tbody
+ %tr
+ %td
+ %label Username
+ %td
+ = @user.login
+ %tr
+ %td
+ %label First Name
+ %td
+ = @user.first_name
+ %tr
+ %td
+ %label Last Name
+ %td
+ = @user.last_name
+ %tr
+ %td
+ %label e-mail
+ %td
+ = @user.email
+
+ %table
+ %thead
+ %tr
+ %th.show
+ Quota Status
+ %th.show
+ %tbody
+ %tr
+ %td
+ %label Maximum
+ %td
+ = @quota_resources["running_instances"].max
+ %tr
+ %td
+ %label Used
+ %td
+ = @quota_resources["running_instances"].used
+ %tr
+ %td
+ %label Availabe
+ %td
+ = @quota_resources["running_instances"].available
+
+ %table
+ %thead
+ %tr
+ %th.show
+ Login Information
+ %th.show
+ %tbody
+ %tr
+ %td
+ %label Current Login IP
+ %td
+ = @user.current_login_ip
+ %tr
+ %td
+ %label Current Login at
+ %td
+ = @user.current_login_at
+ %tr
+ %td
+ %label Last Login IP
+ %td
+ = @user.last_login_ip
+ %tr
+ %td
+ %label Last Login at
+ %td
+ = @user.last_login_at
+ %tr
+ %td
+ %label Login Count
+ %td
+ = @user.login_count
+ %tr
+ %td
+ %label Failed Login Count
+ %td
+ = @user.login_count
+ %tr
+ %td
+ %label Last Request at
+ %td
+ = @user.last_request_at
\ No newline at end of file
--
1.7.2.3