From 8141876126aa25d713cf4b2c76c3ecff837c4ba7 Mon Sep 17 00:00:00 2001 From: jessib Date: Mon, 14 Jan 2013 12:39:59 -0800 Subject: Use partials for displaying details shown when viewing a user. Some of these partials have specific CSS for another use, so we will likely want to tweak this. --- help/app/views/tickets/_ticket.html.haml | 5 +++-- users/app/models/user.rb | 2 +- users/app/views/emails/_email.html.haml | 5 +++-- users/app/views/users/show.html.haml | 21 ++++++++------------- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/help/app/views/tickets/_ticket.html.haml b/help/app/views/tickets/_ticket.html.haml index 3edfa8b..e02aaeb 100644 --- a/help/app/views/tickets/_ticket.html.haml +++ b/help/app/views/tickets/_ticket.html.haml @@ -1,3 +1,4 @@ += # TODO---this is now used in 2 places, and not sure we want the same CSS in both places %tr %td %b @@ -5,9 +6,9 @@ %br %small created: - = ticket.created_at.to_s(:short) + = ticket.created_at.to_s(:short) #todo doesn't show year updated: - = ticket.updated_at.to_s(:short) + = ticket.updated_at.to_s(:short) # doesn't show year %small.pull-right comments by: = ticket.commenters diff --git a/users/app/models/user.rb b/users/app/models/user.rb index 42900ea..1e8ee0e 100644 --- a/users/app/models/user.rb +++ b/users/app/models/user.rb @@ -95,7 +95,7 @@ class User < CouchRest::Model::Base end def most_recent_tickets(count=3) - Ticket.for_user(self).limit(count) #defaults to having most recent updated first + Ticket.for_user(self).limit(count).all #defaults to having most recent updated first end protected diff --git a/users/app/views/emails/_email.html.haml b/users/app/views/emails/_email.html.haml index 3feb6f0..948d847 100644 --- a/users/app/views/emails/_email.html.haml +++ b/users/app/views/emails/_email.html.haml @@ -1,6 +1,7 @@ - if email.valid? %li.pull-right %code= email - = link_to(user_email_alias_path(@user, email), :method => :delete) do - %i.icon-remove + - if params[:action] == 'edit' + = link_to(user_email_alias_path(@user, email), :method => :delete) do + %i.icon-remove .clearfix diff --git a/users/app/views/users/show.html.haml b/users/app/views/users/show.html.haml index 9df029e..2b59c66 100644 --- a/users/app/views/users/show.html.haml +++ b/users/app/views/users/show.html.haml @@ -1,5 +1,7 @@ .span8.offset1 %h2= @user.login + .small + = link_to 'edit', edit_user_path(@user) %dl.offset1 - fields = ['login', 'email', 'created_at', 'updated_at', 'email_forward'] - fields.each do |field| @@ -14,19 +16,12 @@ - if aliases.empty? none set - else - %ul.unstyled - - aliases.each do |al| - %li - = al.email + .pull-left + = render aliases + .clearfix %dt =t :most_recently_updated_tickets %dd - %ul - - @user.most_recent_tickets.each do |ticket| - %li - = link_to ticket.title, ticket - %small - updated: - = ticket.updated_at.to_s(:long) - - + %table + %tbody + = render @user.most_recent_tickets \ No newline at end of file -- cgit v1.2.3