diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 33176298..55d38ad7 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -3,8 +3,7 @@ class UsersController < ApplicationController skip_before_filter :login_required, :only => [ :new, :create ] prepend_before_filter :login_optional, :only => [ :new, :create ] - # GET /users - # GET /users.xml + # GET /users GET /users.xml def index @users = User.find(:all, :order => 'login') respond_to do |format| @@ -12,18 +11,17 @@ class UsersController < ApplicationController @page_title = "TRACKS::Manage Users" @users = User.paginate :page => params[:page], :order => 'login ASC' @total_users = User.count - # When we call users/signup from the admin page - # we store the URL so that we get returned here when signup is successful + # When we call users/signup from the admin page we store the URL so that + # we get returned here when signup is successful store_location end format.xml { render :xml => @users.to_xml(:except => [ :password ]) } end end - # GET /users/somelogin - # GET /users/somelogin.xml + # GET /users/id GET /users/id.xml def show - @user = User.find_by_login(params[:id]) + @user = User.find_by_id(params[:id]) render :xml => @user.to_xml(:except => [ :password ]) end @@ -46,13 +44,13 @@ class UsersController < ApplicationController render :layout => "login" end - # Example usage: curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' + # Example usage: curl -H 'Accept: application/xml' -H 'Content-Type: + # application/xml' # -u admin:up2n0g00d # -d 'usernameabc123' # http://our.tracks.host/users # - # POST /users - # POST /users.xml + # POST /users POST /users.xml def create if params['exception'] render_failure "Expected post format is valid xml like so: usernameabc123." @@ -107,10 +105,9 @@ class UsersController < ApplicationController end end - # DELETE /users/somelogin - # DELETE /users/somelogin.xml + # DELETE /users/id DELETE /users/id.xml def destroy - @deleted_user = User.find_by_login(params[:id]) + @deleted_user = User.find_by_id(params[:id]) @saved = @deleted_user.destroy @total_users = User.find(:all).size @@ -150,9 +147,8 @@ class UsersController < ApplicationController if (params[:open_id_complete] || (params[:user][:auth_type] == 'open_id')) && openid_enabled? authenticate_with_open_id do |result, identity_url| if result.successful? - # Success means that the transaction completed without - # error. If info is nil, it means that the user cancelled - # the verification. + # Success means that the transaction completed without error. If info + # is nil, it means that the user cancelled the verification. @user.auth_type = 'open_id' @user.open_id_url = identity_url if @user.save @@ -207,5 +203,4 @@ class UsersController < ApplicationController return true end - -end +end \ No newline at end of file diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 0f78bf06..5905aa4f 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -2,34 +2,38 @@

You have a total of <%= @total_users %> users

- +
- - - - - - - - - + + + + + + + + + <% for user in @users %> - id="user-<%= user.id %>"> - - - - - - - - - - - <% end %> -
LoginFull nameAuthorization typeOpen ID URLTotal actionsTotal contextsTotal projectsTotal notes LoginFull nameAuthorization typeOpen ID URLTotal actionsTotal contextsTotal projectsTotal notes 
<%=h user.login %><%=h user.last_name? ? user.display_name : '-' %><%= h user.auth_type %><%= h user.open_id_url || '-' %><%= h user.todos.size %><%= h user.contexts.size %><%= h user.projects.size %><%= h user.notes.size %><%= !user.is_admin? ? link_to_remote( image_tag("blank.png", :title =>"Destroy user", :class=>"delete_item"), {:url => user_path(user), :method => :delete, :confirm => "Warning: this will delete user \'#{user.login}\', all their actions, contexts, project and notes. Are you sure that you want to continue?" }, { :class => "icon" } ) : " " %>
-

- <%= will_paginate @users %> -

- -

<%= link_to 'Signup new user', signup_path %>

\ No newline at end of file + id="user-<%= user.id %>"> + <%=h user.login %> + <%=h user.last_name? ? user.display_name : '-' %> + <%= h user.auth_type %> + <%= h user.open_id_url || '-' %> + <%= h user.todos.size %> + <%= h user.contexts.size %> + <%= h user.projects.size %> + <%= h user.notes.size %> + <%= !user.is_admin? ? link_to_remote( + image_tag("blank.png", :title =>"Destroy user", :class=>"delete_item"), + { :url => user_path(user.id), :method => :delete, + :confirm => "Warning: this will delete user \'#{user.login}\', all their actions, contexts, project and notes. Are you sure that you want to continue?" }, + { :class => "icon" } ) : " " %> + + <% end %> + +

+ <%= will_paginate @users %> +

+ +

<%= link_to 'Signup new user', signup_path %>

\ No newline at end of file