taxedo 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -46,7 +46,7 @@ tax_for 'quebec', 1000, format: :html
46
46
  * **format**: Format of the output ( _hash, html, json, **text**_ ).
47
47
  * **on**: Date parameter. Taxedo should use tax rate active for a particular date.
48
48
  * **html_options**: hash of options for the html output
49
- * **format**: Format of the output ( _lines, rows, **table**_ ).
49
+ * **template**: HTML Template for the output ( _lines, rows, **table**_ ).
50
50
  * **columns**: Number of colspan in the row. Only available with the ouput **rows**.
51
51
  * **custom_content**: Content of the first column. Only availabie with the output **rows**.
52
52
 
@@ -1,6 +1,6 @@
1
1
  class Taxedo::Builder::Html < Taxedo::Builder::Base
2
- def generate(format, options={})
3
- case format
2
+ def generate(template, options={})
3
+ case template
4
4
  when :lines then lines
5
5
  when :rows then table_rows options[:columns], options[:custom_content]
6
6
  else table
@@ -23,7 +23,7 @@ class Taxedo::Builder::Html < Taxedo::Builder::Base
23
23
  def line(label, value, options={})
24
24
  options = { :class => '' }.merge(options)
25
25
 
26
- @content << ('<div class="line ' + options[:class] + '"><label>' + label + '</label><span>' + price(value) + '</span></div>')
26
+ @content << ('<div class="line ' + options[:class] + '"><label>' + label + '</label><span class="price">' + price(value) + '</span></div>')
27
27
  end
28
28
 
29
29
  def table
@@ -32,7 +32,7 @@ class Taxedo::Builder::Html < Taxedo::Builder::Base
32
32
  @content << '</tbody></table>'
33
33
  end
34
34
 
35
- def table_rows(columns=0, custom_content='')
35
+ def table_rows(columns=1, custom_content='')
36
36
  table_row t('subtotal'), subtotal, :class => 'subtotal', :custom_columns => columns, :custom_content => custom_content
37
37
  taxes.each { |tax| table_row tax.name, tax.amount, :class => "tax #{tax.id}" }
38
38
  table_row t('total'), total, :class => 'total'
@@ -43,7 +43,7 @@ class Taxedo::Builder::Html < Taxedo::Builder::Base
43
43
 
44
44
  content = ['<tr class="' + options[:class] + '">']
45
45
  content << '<td class="custom" rowspan="4" colspan="' + options[:custom_columns].to_s + '">' + options[:custom_content] + '</td>' if options[:custom_columns] > 0
46
- content << '<td class="label">' + label + '</td><td class="value">' + price(value) + '</td></tr>'
46
+ content << '<td class="label" align="right">' + label + '</td><td class="value" align="right">' + price(value) + '</td></tr>'
47
47
 
48
48
  @content << content.join
49
49
  end
@@ -46,9 +46,9 @@ class Taxedo::Receipt
46
46
  end
47
47
 
48
48
  def to_html(options={})
49
- options = { columns: 0, custom_content: '', format: :table }.merge(options)
49
+ options = { columns: 0, custom_content: '', template: :table }.merge(options)
50
50
 
51
- return Taxedo::Builder::Html.new(self).generate(options[:format], options)
51
+ return Taxedo::Builder::Html.new(self).generate(options[:template], options)
52
52
  end
53
53
 
54
54
  def to_json
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taxedo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-22 00:00:00.000000000 Z
12
+ date: 2012-05-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &2151824180 !ruby/object:Gem::Requirement
16
+ requirement: &2151812360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.8.7
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2151824180
24
+ version_requirements: *2151812360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &2151823460 !ruby/object:Gem::Requirement
27
+ requirement: &2151810620 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '2.0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2151823460
35
+ version_requirements: *2151810620
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec-aspic
38
- requirement: &2151822780 !ruby/object:Gem::Requirement
38
+ requirement: &2151809700 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 0.0.2
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2151822780
46
+ version_requirements: *2151809700
47
47
  description: ''
48
48
  email:
49
49
  - sebastien@demarque.com