Skip to content

Commit

Permalink
Merge pull request #14 from fjordllc/add-user-icon
Browse files Browse the repository at this point in the history
Add user icon
  • Loading branch information
hrysd committed Mar 25, 2013
2 parents e58b4be + 32b7bad commit a57ab53
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/assets/javascripts/i18n/translations.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions app/models/practice.rb
Expand Up @@ -3,6 +3,14 @@ class Practice < ActiveRecord::Base
ranks :row_order
as_enum :target, [:everyone, :programmer, :designer]
has_many :learnings

has_many :completed_learnings,
-> { where(status_cd: 1) },
class_name: 'Learning'
has_many :completed_users,
through: :completed_learnings,
source: :user

validates :title, presence: true
validates :description, presence: true
validates :goal, presence: true
Expand Down
6 changes: 6 additions & 0 deletions app/views/practices/show.html.haml
Expand Up @@ -6,3 +6,9 @@
.goal= simple_format rendering(@practice.goal)
= link_to t('edit'), edit_practice_path(@practice), class: 'btn btn-primary'
= link_to t('destroy'), practice_path(@practice), data: { confirm: t('are_you_sure') }, method: :delete, class: 'btn btn-danger'

%h3= t('completed_users')
- @practice.completed_users.each do |user|
.icon
= link_to user do
= gravatar_tag user, size: 50
5 changes: 5 additions & 0 deletions app/views/users/show.html.haml
Expand Up @@ -15,5 +15,10 @@
- if @user.blog_url?
%dt= t('helpers.label.user.blog_url')
%dd= link_to @user.blog_url
%h3= t('completed_practices')
%ul
- @user.completed_practices.each do |practice|
%li
.title= link_to practice.title, practice
- if current_user
= link_to t('edit'), edit_user_path(current_user), class: 'btn btn-primary'
2 changes: 2 additions & 0 deletions config/locales/ja.yml
Expand Up @@ -349,3 +349,5 @@ ja:
for_designer: "デザイナー向け"
all: "全て"
how_256interns_works: "256インターンとは"
completed_users: 'プラクティスを完了したユーザー一覧'
completed_practices: '終了した課題一覧'

0 comments on commit a57ab53

Please sign in to comment.