techvision/brails4

View on GitHub
app/views/admin/users/show.html.haml

Summary

Maintainability
Test Coverage
- model_class = User
.page-header
  %h1=t '.title', :default => model_class.model_name.human.titleize

%p
  %strong= model_class.human_attribute_name(:role) + ':'
  %br
  = @user.role.name
%p
  %strong= model_class.human_attribute_name(:name) + ':'
  %br
  = @user.profile.name
%p
  %strong= model_class.human_attribute_name(:email) + ':'
  %br
  = @user.email
%p
  %strong= model_class.human_attribute_name(:gender) + ':'
  %br
  = @user.profile.gender
%p
  %strong= model_class.human_attribute_name(:address) + ':'
  %br
  = @user.profile.address
%p
  %strong= model_class.human_attribute_name(:country) + ':'
  %br
  = @user.profile.country
%p
  %strong= model_class.human_attribute_name(:total_points) + ':'
  %br
  = @user.profile.total_points
%p
  %strong= model_class.human_attribute_name(:current_sign_in_at) + ':'
  %br
  = @user.current_sign_in_at
%p
  %strong= model_class.human_attribute_name(:last_sign_in_at) + ':'
  %br
  = @user.last_sign_in_at
%p
  %strong= model_class.human_attribute_name(:invitation_limit) + ':'
  %br
  = @user.invitation_limit

.form-actions
  = link_to t('.back', :default => t("helpers.links.back")), admin_users_path, :class => 'btn'
  = link_to t('.edit', :default => t("helpers.links.edit")), edit_admin_user_path(@user), :class => 'btn'

%h3 Achievements

%table.table.table-striped
  %thead
    %tr
      %th= Achievement.human_attribute_name(:topic)
      %th= Achievement.human_attribute_name(:score)
      %th= Achievement.human_attribute_name(:created_at)
  %tbody
    - @achievements.each do |achievement|
      %tr
        %td= link_to admin_topic_path(achievement.topic_id)
        %td= achievement.score
        %td= achievement.created_at