Improve profile page

footer-fixes
Marcin Kulik 10 years ago
parent 4909d83f9f
commit 70e20c84ef

@ -15,9 +15,9 @@ class UserDecorator < ApplicationDecorator
def full_name
if model.name.present?
"#{model.name} (#{model.username})"
"#{model.name} (#{display_name})"
else
model.username
display_name
end
end

@ -18,7 +18,7 @@ class UserPagePresenter
end
def title
"#{user.username}'s profile".html_safe
"#{user.display_name}'s profile".html_safe
end
def user_full_name
@ -38,8 +38,21 @@ class UserPagePresenter
end
def asciicast_count_text(h)
count = h.pluralize(user.asciicast_count, 'asciicast')
"#{count} by #{user.username}"
if current_users_profile?
if user.asciicast_count > 0
count = h.pluralize(user.asciicast_count, 'asciicast')
"You have recorded #{count}"
else
"You haven't recorded anything yet"
end
else
if user.asciicast_count > 0
count = h.pluralize(user.asciicast_count, 'asciicast')
"#{count} by #{user.display_name}"
else
"#{user.display_name} hasn't recorded anything yet"
end
end
end
def user_username

@ -0,0 +1,9 @@
markdown:
Make sure you have asciinema recorder [installed](#{docs_path(:installation)}).
To start recording go to your terminal and run the following command:
$ asciinema rec
When you're ready to finish just exit the shell (either by typing `exit`
or hitting `<C-d>`).

@ -9,7 +9,7 @@
small = "Joined on #{page.user_joined_at}"
- if page.show_settings?
p.actions = link_to 'Settings', edit_user_path
p.actions = link_to 'Edit information', edit_user_path
.container
h2 = page.asciicast_count_text(self)
@ -20,14 +20,10 @@
= paginate page.asciicasts
- else
- if page.current_users_profile?
= render 'recording_instructions'
p
' Seems like you haven't recorded anything yet.
= link_to 'Record now', docs_path('getting-started')
' .
p
br
' If you have already recorded an asciicast but you don't see it
here then associate it with your account by running
code asciinema auth
' in your terminal.
- else
' #{page.user_username} hasn't recorded anything yet.

Loading…
Cancel
Save