caracal-rails 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +18 -8
- data/lib/caracal/rails/template_handler.rb +1 -1
- data/lib/caracal/rails/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2eb4b9d05daec06006dadbf3957e46737654baee0f4c0a5df8acae982c1ada61
|
4
|
+
data.tar.gz: 719cbefd24e98d26d09260fcd67ee61edf1f598f20964e303bf89cf3359a0a88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
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.
|
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:
|
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
|
-
|
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.
|