touchstone 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,7 +20,7 @@
20
20
  <td><%= link_to "#{campaign.name}", campaign_url(campaign.id) %></td>
21
21
  <td><%= campaign.start_date.strftime("%d %B %Y") %></td>
22
22
  <td><%= campaign.end_date.strftime("%d %B %Y") %></td>
23
- <td>$<%= sprintf("%.2f", campaign.spend_amount) %></td>
23
+ <td><%= Touchstone.currency %><%= sprintf("%.2f", campaign.spend_amount) %></td>
24
24
  </tr>
25
25
  <% end %>
26
26
  </tbody>
@@ -13,8 +13,8 @@
13
13
  </section><!-- #campaign-info -->
14
14
 
15
15
  <section id="financials" class="stats">
16
- <h3>Campaign Spend: <span>$<%= sprintf("%.2f", @campaign.spend_amount) %></span></h3>
17
- <h3>Campaign Revenue: <span>$<%= sprintf("%.2f", @campaign.revenue) %></span></h3>
16
+ <h3>Campaign Spend: <span><%= Touchstone.currency %><%= sprintf("%.2f", @campaign.spend_amount) %></span></h3>
17
+ <h3>Campaign Revenue: <span><%= Touchstone.currency %><%= sprintf("%.2f", @campaign.revenue) %></span></h3>
18
18
  <h3>Return on investment: <span><%= sprintf("%.2f", @campaign.roi) %>%</span></h3>
19
19
  </section>
20
20
 
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  Touchstone.config do |c|
2
4
 
3
5
  # By default, Touchstone assumes that you have a User model
@@ -16,4 +18,9 @@ Touchstone.config do |c|
16
18
 
17
19
  c.column_names = [:id,:created_at]
18
20
 
21
+ # This sets the currency symbol that you would like
22
+ # displayed. By default it is $
23
+
24
+ c.currency = "$"
25
+
19
26
  end
@@ -4,7 +4,7 @@ module Touchstone
4
4
 
5
5
  extend self
6
6
 
7
- attr_accessor :association_name, :column_names
7
+ attr_accessor :association_name, :column_names, :currency
8
8
 
9
9
  def association_name=name
10
10
  @name = name.downcase
@@ -22,5 +22,13 @@ module Touchstone
22
22
  @columns || [:id,:created_at]
23
23
  end
24
24
 
25
+ def currency=currency
26
+ @currency = currency
27
+ end
28
+
29
+ def currency
30
+ @currency || "$"
31
+ end
32
+
25
33
  end
26
34
  end
@@ -1,3 +1,3 @@
1
1
  module Touchstone
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/touchstone.rb CHANGED
@@ -19,6 +19,10 @@ module Touchstone
19
19
  Touchstone::Configuration.column_names
20
20
  end
21
21
 
22
+ def currency
23
+ Touchstone::Configuration.currency
24
+ end
25
+
22
26
  end
23
27
 
24
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: touchstone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -159,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  segments:
161
161
  - 0
162
- hash: -3745211063638779755
162
+ hash: 3458186603622929131
163
163
  required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  none: false
165
165
  requirements:
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  segments:
170
170
  - 0
171
- hash: -3745211063638779755
171
+ hash: 3458186603622929131
172
172
  requirements: []
173
173
  rubyforge_project:
174
174
  rubygems_version: 1.8.20