diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..544f411 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,12 @@ module ApplicationHelper + def number_to_won(number) + number_to_currency number, unit: '원', precision: 0, format: '%n%u' + end + + def facebook_image_tag_by_uid(uid, *args, &block) + options = args.extract_options! + url_options = options.slice(:width, :height) + image_url = "//graph.facebook.com/#{uid}/picture?#{url_options.to_query}" + image_tag image_url, options, &block + end end diff --git a/app/views/contributions/new.html.erb b/app/views/contributions/new.html.erb index e26e6ee..a1b6787 100644 --- a/app/views/contributions/new.html.erb +++ b/app/views/contributions/new.html.erb @@ -1,5 +1,5 @@
- +
<%= form_for @contribution_form, url: fund_contributions_path do |f| %> diff --git a/app/views/friends/index.html.erb b/app/views/friends/index.html.erb index d70c8f1..f9c9937 100644 --- a/app/views/friends/index.html.erb +++ b/app/views/friends/index.html.erb @@ -8,7 +8,7 @@
<%= link_to new_friend_path(uid: @user.uid, name: @user.name) do %>
- + <%= facebook_image_tag_by_uid(@user.uid, width: 192, height: 192) %>

나에게 선물하기

@@ -20,7 +20,7 @@
<%= link_to new_friend_path(uid: f['id'], name: f['name']) do %>
- /picture?height=192&width=192"> + <%= facebook_image_tag_by_uid(f.id, width: 192, height: 192) %>

<%= f["name"] %>

diff --git a/app/views/funds/_new.html.erb b/app/views/funds/_new.html.erb index d1a3b90..cbf6322 100644 --- a/app/views/funds/_new.html.erb +++ b/app/views/funds/_new.html.erb @@ -8,7 +8,7 @@

<%= @gift.name %>

- <%= number_to_currency @gift.price, unit: '₩', precision: 0 %> + <%= number_to_won @gift.price %> To <%= @friend.name %>
diff --git a/app/views/funds/show.html.erb b/app/views/funds/show.html.erb index 11c8a11..59893d9 100644 --- a/app/views/funds/show.html.erb +++ b/app/views/funds/show.html.erb @@ -39,7 +39,7 @@

<%= @fund.gift.name %>

- <%= number_to_currency @fund.gift.price, unit: '₩', precision: 0 %> + <%= number_to_won @fund.gift.price %>
@@ -49,7 +49,7 @@
-

<%= number_to_currency @fund.total_amount, unit: '원', precision: 0, format: '%n%u' %>

+

<%= number_to_won @fund.total_amount %>

@@ -66,7 +66,7 @@
<% contributions.each do |contribution| %>
- <%= image_tag "http://graph.facebook.com/#{ contribution.user.uid}/picture?height=1000&width=1000" %> + <%= facebook_image_tag_by_uid(contribution.user.uid, width: 1000, height: 1000)
<% end %>
diff --git a/app/views/gifts/_gift.html.erb b/app/views/gifts/_gift.html.erb index 049dcd9..45e974e 100644 --- a/app/views/gifts/_gift.html.erb +++ b/app/views/gifts/_gift.html.erb @@ -6,7 +6,7 @@

<%= gift.name %>

- <%= number_to_currency gift.price, unit: '₩ ', precision: 0 %> + <%= number_to_won gift.price %>