From: Martyn Taylor mtaylor@redhat.com
--- src/app/controllers/users_controller.rb | 1 + src/app/stylesheets/aggregator.scss | 4 + src/app/views/users/show.haml | 133 ++++++++++++++++++++++++------- src/features/user.feature | 8 ++- 4 files changed, 116 insertions(+), 30 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 #{@user.first_name} #{@user.last_name} (#{@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 diff --git a/src/features/user.feature b/src/features/user.feature index 2c3921c..a99cb20 100644 --- a/src/features/user.feature +++ b/src/features/user.feature @@ -11,7 +11,7 @@ Feature: Manage Users Scenario: Change the password Given I am on the users page And there is a user "testuser" - When I follow "testuser" + When I follow "edit" Then I should see "Editing User:" When I fill in "user[password]" with "new password" And I fill in "user[password_confirmation]" with "" @@ -26,6 +26,12 @@ Feature: Manage Users And I press "Save" Then I should see "User updated!"
+ Scenario: Show user detials + Given I am on the users page + And there is a user "testuser" + When I follow "testuser" + Then I should be on testuser's user page + Scenario: Administrator cancels the creation of a user account Given I am on the users page And there are 2 users