On 12/21/2010 01:52 PM, [email protected] wrote:
> From: Ladislav Martincik<[email protected]>
>
> ---
>   src/app/controllers/admin/users_controller.rb |   13 +++
>   src/app/views/admin/users/_list.haml          |    2 -
>   src/app/views/admin/users/_properties.haml    |   98 
> ++++++++++++++++++++++++
>   src/app/views/admin/users/show.haml           |   99 
> -------------------------
>   src/config/environment.rb                     |    2 +-
>   src/features/user.feature                     |    3 +-
>   6 files changed, 114 insertions(+), 103 deletions(-)
>   create mode 100644 src/app/views/admin/users/_properties.haml
>   delete mode 100644 src/app/views/admin/users/show.haml
>
> diff --git a/src/app/controllers/admin/users_controller.rb 
> b/src/app/controllers/admin/users_controller.rb
> index 65b1ce6..0e854a9 100644
> --- a/src/app/controllers/admin/users_controller.rb
> +++ b/src/app/controllers/admin/users_controller.rb
> @@ -35,6 +35,19 @@ class Admin::UsersController<  ApplicationController
>     def show
>       @user = User.find_by_id(params[:id]) || current_user
>       @quota_resources = @user.quota.quota_resources
> +
> +    @url_params = params.clone
> +    @tab_captions = ['Properties']
> +    @details_tab = params[:details_tab].blank? ? 'properties' : 
> params[:details_tab]
> +    respond_to do |format|
> +      format.js do
> +        if @url_params.delete :details_pane
> +          render :partial =>  'layouts/details_pane' and return
> +        end
> +        render :partial =>  @details_tab
> +      end
> +      format.html { render :partial =>  @details_tab }
> +    end
>     end
>
>     def edit
> diff --git a/src/app/views/admin/users/_list.haml 
> b/src/app/views/admin/users/_list.haml
> index ff62782..6a544ed 100644
> --- a/src/app/views/admin/users/_list.haml
> +++ b/src/app/views/admin/users/_list.haml
> @@ -14,7 +14,6 @@
>             =link_to "Quota", admin_users_url(:sort_by =>  "quota")
>             %span (Instances)
>           %th= link_to "e-mail", admin_users_url(:sort_by =>  "email")
> -        %th
>       [email protected] do |user|
>         %tr
>           %td
> @@ -25,7 +24,6 @@
>           %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_admin_user_path(user)
>
>   :javascript
>     $(document).ready(function () {
> diff --git a/src/app/views/admin/users/_properties.haml 
> b/src/app/views/admin/users/_properties.haml
> new file mode 100644
> index 0000000..fc8af9c
> --- /dev/null
> +++ b/src/app/views/admin/users/_properties.haml
> @@ -0,0 +1,98 @@
> +.grid_13
> +  %h2 #[email protected]_name} #[email protected]_name} (#[email protected]})
> +
> +  = link_to 'Edit', edit_admin_user_path(@user), :class =>  'button'
> +
> +  %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
> diff --git a/src/app/views/admin/users/show.haml 
> b/src/app/views/admin/users/show.haml
> deleted file mode 100644
> index c5cca96..0000000
> --- a/src/app/views/admin/users/show.haml
> +++ /dev/null
> @@ -1,99 +0,0 @@
> --content_for :list do
> -  = render :partial =>  'list'
> --content_for :details do
> -  .grid_13
> -    %h2 #[email protected]_name} #[email protected]_name} (#[email protected]})
> -
> -    %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
> diff --git a/src/config/environment.rb b/src/config/environment.rb
> index 09ec85b..6b21c42 100644
> --- a/src/config/environment.rb
> +++ b/src/config/environment.rb
> @@ -51,7 +51,7 @@ Rails::Initializer.run do |config|
>     config.gem "compass-960-plugin", :lib =>  "ninesixty"
>     config.gem "simple-navigation"
>     config.gem "typhoeus"
> -  config.gem "rb-inotify"
> +  #config.gem "rb-inotify"

this shouldn't be commented

>     config.gem 'rack-restful_submit', :version =>  '1.1.2'
>
>     config.middleware.swap Rack::MethodOverride, 'Rack::RestfulSubmit'
> diff --git a/src/features/user.feature b/src/features/user.feature
> index 2160ed1..89dd7d5 100644
> --- a/src/features/user.feature
> +++ b/src/features/user.feature
> @@ -12,7 +12,8 @@ Feature: Manage Users
>     Scenario: Change the password
>       Given I am on the admin users page
>       And there is a user "testuser"
> -    When I follow "edit"
> +    When I follow "testuser"
> +    And 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 ""

ACK with one inline note
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to