summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-07-04 01:34:06 -0700
committerelijah <elijah@riseup.net>2013-07-04 04:15:04 -0700
commit03fc85ad20e91964267dfcdaab9e3036c5702689 (patch)
tree9bdd64920ace370d9d8850cf62960d092513560b
parent89ad6bd802f9e57c687e8cdb8593c3984e2fbd1b (diff)
users - make a nice overview page (well, nice enough) and better users index/search.
-rw-r--r--users/app/controllers/users_controller.rb9
-rw-r--r--users/app/views/overviews/show.html.haml27
-rw-r--r--users/app/views/users/_user.html.haml12
-rw-r--r--users/config/locales/en.yml14
4 files changed, 39 insertions, 23 deletions
diff --git a/users/app/controllers/users_controller.rb b/users/app/controllers/users_controller.rb
index 0dbf641..81336be 100644
--- a/users/app/controllers/users_controller.rb
+++ b/users/app/controllers/users_controller.rb
@@ -12,11 +12,16 @@ class UsersController < UsersBaseController
def index
if params[:query]
- @users = User.by_login.startkey(params[:query]).endkey(params[:query].succ)
+ if @user = User.find_by_login(params[:query])
+ redirect_to user_overview_url(@user)
+ return
+ else
+ @users = User.by_login.startkey(params[:query]).endkey(params[:query].succ)
+ end
else
@users = User.by_created_at.descending
end
- @users = @users.limit(APP_CONFIG[:pagination_size])
+ @users = @users.limit(100)
end
def new
diff --git a/users/app/views/overviews/show.html.haml b/users/app/views/overviews/show.html.haml
index eda9899..b8ad814 100644
--- a/users/app/views/overviews/show.html.haml
+++ b/users/app/views/overviews/show.html.haml
@@ -1,15 +1,18 @@
-%p
- Username:
- = @user.login
+.overview
-%p
- User since:
- = @user.created_at
+ %h2.first= t(:overview_welcome, :username => @user.login)
-%p
- Last update:
- = @user.updated_at
+ - if admin?
+ %p
+ = t(:created)
+ = @user.created_at
+ %br
+ = t(:updated)
+ = @user.updated_at
-%p
- Quota:
- N/A \ No newline at end of file
+ %p= t(:overview_intro)
+
+ %ul.unstyled
+ %li= icon('user') + link_to(t(:overview_account), edit_user_path(@user))
+ %li= icon('envelope') + link_to(t(:overview_email), edit_user_email_settings_path(@user))
+ %li= icon('question-sign') + link_to(t(:overview_tickets), user_tickets_path(@user))
diff --git a/users/app/views/users/_user.html.haml b/users/app/views/users/_user.html.haml
index ca03d34..990d9cf 100644
--- a/users/app/views/users/_user.html.haml
+++ b/users/app/views/users/_user.html.haml
@@ -1,10 +1,4 @@
%tr
- %td= link_to user.login, user
- %td= time_ago_in_words(user.created_at) + " ago"
- %td
- = link_to edit_user_path(user), :class => "btn btn-mini btn-primary" do
- %i.icon-edit.icon-white
- Edit
- = link_to user_path(user), :method => :delete, :class => "btn btn-danger btn-mini" do
- %i.icon-remove.icon-white
- Remove
+ %td= link_to user.login, user_overview_path(user)
+ %td= l(user.created_at, :format => :short)
+ %td= l(user.updated_at, :format => :short)
diff --git a/users/config/locales/en.yml b/users/config/locales/en.yml
index 63ac692..b880887 100644
--- a/users/config/locales/en.yml
+++ b/users/config/locales/en.yml
@@ -29,6 +29,20 @@ en:
advanced_options: "Advanced Options"
not_authorized: "Sorry, but you are not authorized to perform that action."
not_authorized_login: "Please log in to perform that action."
+ search: "Search"
+
+ #
+ # overview
+ #
+ overview_welcome: "Welcome %{username}."
+ overview_intro: "From this user control panel, you can:"
+ overview_tickets: "Create and check support tickets."
+ overview_email: "Modify email settings."
+ overview_account: "Change your password or delete your account."
+
+ #
+ # rails
+ #
activemodel:
models:
user: