caracal-rails 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a2935583e3455cfde49987311a3241d8b26f1959
4
- data.tar.gz: efca7099ed7095f2b4f230b6ddae532c15cfbb7e
2
+ SHA256:
3
+ metadata.gz: 2eb4b9d05daec06006dadbf3957e46737654baee0f4c0a5df8acae982c1ada61
4
+ data.tar.gz: 719cbefd24e98d26d09260fcd67ee61edf1f598f20964e303bf89cf3359a0a88
5
5
  SHA512:
6
- metadata.gz: c44b86743ce48c94378704e63eaa60ccfff545ca2121c3250a2777de74d4e30f9d99b307dc0c072684e69c8ba1be44f91474280c2e19f4740ad730553d1de6b5
7
- data.tar.gz: 1420152fdf5380dea1096db2e30eb351a371a75922625c5e654f7677be2abc8e8cc5e50adcec9d022b2f80a80842255f52495deedae03f4049dc39c2266daf7b
6
+ metadata.gz: 7672ad6d880149a24fe49690d0d0ea6229f5313d3605d7a6bb137ef00cefd810a068864e641a0910a526598823f9998d00031f05931fc8d7399f8816ad1a93e4
7
+ data.tar.gz: f34463c65d18523be6652fc6f6bf17e1bd026e64b7e5fb8532fddcafa850dba472eb864d408b7771bf8f7c017e4c250e8388503c6590e1c38d9aa1ceec56acbc
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # Caracal-Rails
2
2
 
3
- [Caracal](https://github.com/trade-informatics/caracal) is a ruby library for dynamically creating professional-quality Microsoft Word documents.
3
+ [Caracal](https://github.com/trade-informatics/caracal) is a ruby library for dynamically creating professional-quality Microsoft Word documents.
4
4
 
5
5
  Caracal-Rails is a drop in solution for registering the Microsoft Word mime type and for establishing a template handler in Rails for the :docx format. All caracal documents are rendered with an explicit block passing a reference to the Caracal::Document object named `docx`.
6
6
 
7
+ Please see the [caracal-example](https://github.com/trade-informatics/caracal-example) repository for
8
+ a working demonstration of the library's capabilities.
7
9
 
8
10
  ## Installation
9
11
 
@@ -18,28 +20,36 @@ Then execute:
18
20
 
19
21
  ## Usage
20
22
 
21
- Design your controller normally:
23
+ Design your controller normally and respond to the `docx` format:
22
24
 
23
25
  class ReportsController < ApplicationController
24
26
  def show
25
27
  # collect your models/view models here
28
+
29
+ respond_to do |format|
30
+ format.docx { headers["Content-Disposition"] = "attachment; filename=\"caracal.docx\"" }
31
+ end
26
32
  end
27
33
  end
28
-
34
+
29
35
  Then add a view file with the Caracal extension:
30
36
 
31
37
  apps/views/reports/show.docx.caracal
32
-
38
+
39
+ Specify the format `docx` in your route:
40
+
41
+ resources :reports, only: [:show], format: 'docx'
42
+
33
43
  Inside your view, simply issue Caracal commands on the document object:
34
-
44
+
35
45
  docx.font 'Droid Serif'
36
-
46
+
37
47
  docx.style 'special' do
38
48
  font 'Droid Serif'
39
49
  italic true
40
50
  size 16
41
51
  end
42
-
52
+
43
53
  docx.h1 'Quarterly Report'
44
54
  docx.hr
45
55
  @report.clients.each do |client|
@@ -93,4 +103,4 @@ A tip of the hat to the wonderful PDF generation libraries [Prawn](https://githu
93
103
 
94
104
  Copyright (c) 2014 Trade Informatics, Inc
95
105
 
96
- [MIT License](https://github.com/trade-informatics/caracal-rails/blob/master/LICENSE.txt)
106
+ [MIT License](https://github.com/trade-informatics/caracal-rails/blob/master/LICENSE.txt)
@@ -2,7 +2,7 @@ module Caracal
2
2
  module Rails
3
3
  class TemplateHandler
4
4
 
5
- def self.call(template)
5
+ def self.call(template, source = nil)
6
6
  "Tilt.new('#{ template.identifier }').render(self)"
7
7
  end
8
8
 
@@ -1,5 +1,5 @@
1
1
  module Caracal
2
2
  module Rails
3
- VERSION = '1.0.1'
3
+ VERSION = '1.0.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caracal-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trade Informatics
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-29 00:00:00.000000000 Z
12
+ date: 2020-07-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: caracal
@@ -167,8 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  - !ruby/object:Gem::Version
168
168
  version: '0'
169
169
  requirements: []
170
- rubyforge_project:
171
- rubygems_version: 2.4.8
170
+ rubygems_version: 3.0.3
172
171
  signing_key:
173
172
  specification_version: 4
174
173
  summary: Caracal::Rails makes using Caracal in Rails a no-brainer.